def attach_stream(self, stream, circuits):
        if stream.target_port in self.disallow_ports:
            print "Disallowing", stream, "to port", stream.target_port
            d = self.state.close_stream(stream)
            d.addCallback(stream_closed)
            d.addErrback(log.err)
            return txtorcon.TorState.DO_NOT_ATTACH

        # Ask Tor to assign stream to a circuit by itself
        return None
IStreamAttacher API
dataset/ETHPy150Open meejah/txtorcon/examples/disallow_streams_by_port.py/PortFilterAttacher.attach_stream