Details
Streams are the interface between local requests coming from OppySOCKSProtocol instances and circuits. Streams are responsible for:
- Initiating a connection request (i.e. a RelayBeginCell) on behalf of a local application
- Passing data from circuits to local applications and vice versa
- Informing OppySOCKSProtocol instances (and thus, the client application) when a remote resource closes the stream
- Informing the circuit when the local application closes the stream
- Splitting up data to be written to the network into chunks that can fit into a RelayData cell
- Doing some rudimentary flow-control
Bases: object
Represent a Tor Stream.
Put data received from the network on this stream’s read queue.
Called when the circuit attached to this stream passes data to this stream.
Parameters: | data (str) – data passed in from circuit to write to this stream’s attached SOCKS protocol |
---|
Split data into chunks that can fit in a RelayData cell, and put each chunk on this stream’s write queue.
Called when the local application attached to this stream sends data to the network.
Parameters: | data (str) – data passed in from this stream’s attached SOCKS protocol to write to this stream’s circuit |
---|
Increment this stream’s package window and, if the package window is now above zero and this stream was in a buffering state, begin listening for local data again.
Called by the attached circuit when it receives a sendme cell for this stream.
Begin listening for local data from the attached SOCKS protocol to write to this stream’s circuit.
Called when the attached circuit receives a RelayConnected cell for this stream’s RelayBegin request.
Called when this stream is closed by the circuit.
This can be caused by receiving a RelayEnd cell, the circuit being torn down, or the connection going down. We do not need to send a RelayEnd cell ourselves if the circuit closed this stream.
Notify any associated SOCKS protocols and let circuit know this stream has closed.