diff --git a/docs/internals.rst b/docs/internals.rst index a2b160b7..20210ede 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -21,8 +21,48 @@ Stream Classes .. currentmodule:: mitogen.core -.. autoclass:: BasicStream - :members: +.. class:: BasicStream + + .. data:: receive_side + + A :py:class:`Side` representing the stream's receive file descriptor. + + .. data:: transcmit_side + + A :py:class:`Side` representing the stream's transmit file descriptor. + + .. method:: on_disconnect (broker) + + Called by :py:class:`Broker` to force disconnect the stream. The base + implementation simply closes :py:attr:`receive_side` and + :py:attr:`transmit_side` and unregisters the stream from the broker. + + .. method:: on_receive (broker) + + Called by :py:class:`Broker` when the stream's :py:attr:`receive_side` has + been marked readable using :py:meth:`Broker.start_receive` and the + broker has detected the associated file descriptor is ready for + reading. + + Subclasses must implement this method if + :py:meth:`Broker.start_receive` is ever called on them, and the method + must call :py:meth:`on_disconect` if reading produces an empty string. + + .. method:: on_transmit (broker) + + Called by :py:class:`Broker` when the stream's :py:attr:`transmit_side` + has been marked writeable using :py:meth:`Broker.start_transmit` and + the broker has detected the associated file descriptor is ready for + writing. + + Subclasses must implement this method if + :py:meth:`Broker.start_transmit` is ever called on them. + + .. method:: on_shutdown (broker) + + Called by :py:meth:`Broker.shutdown` to allow the stream time to + gracefully shutdown. The base implementation simply called + :py:meth:`on_disconnect`. .. autoclass:: Stream :members: diff --git a/mitogen/core.py b/mitogen/core.py index c0492eea..eb35982a 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -550,46 +550,7 @@ class Side(object): class BasicStream(object): - """ - - .. method:: on_disconnect (broker) - - Called by :py:class:`Broker` to force disconnect the stream. The base - implementation simply closes :py:attr:`receive_side` and - :py:attr:`transmit_side` and unregisters the stream from the broker. - - .. method:: on_receive (broker) - - Called by :py:class:`Broker` when the stream's :py:attr:`receive_side` has - been marked readable using :py:meth:`Broker.start_receive` and the - broker has detected the associated file descriptor is ready for - reading. - - Subclasses must implement this method if - :py:meth:`Broker.start_receive` is ever called on them, and the method - must call :py:meth:`on_disconect` if reading produces an empty string. - - .. method:: on_transmit (broker) - - Called by :py:class:`Broker` when the stream's :py:attr:`transmit_side` - has been marked writeable using :py:meth:`Broker.start_transmit` and - the broker has detected the associated file descriptor is ready for - writing. - - Subclasses must implement this method if - :py:meth:`Broker.start_transmit` is ever called on them. - - .. method:: on_shutdown (broker) - - Called by :py:meth:`Broker.shutdown` to allow the stream time to - gracefully shutdown. The base implementation simply called - :py:meth:`on_disconnect`. - - """ - #: A :py:class:`Side` representing the stream's receive file descriptor. receive_side = None - - #: A :py:class:`Side` representing the stream's transmit file descriptor. transmit_side = None def on_disconnect(self, broker):