Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 43 additions & 21 deletions Doc/library/socketserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,23 @@ server is the address family.
:class:`ForkingMixIn` and the Forking classes mentioned below are
only available on POSIX platforms that support :func:`~os.fork`.

:meth:`socketserver.ForkingMixIn.server_close` waits until all child
:meth:`!ForkingMixIn.server_close` waits until all child
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all these be documented rather than excluding via !?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are documented, but in a base class. I don't think that we should document implementation methods, they are just, well, implementations :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. method:: server_close()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verbose, but a potential option?

Suggested change
:meth:`!ForkingMixIn.server_close` waits until all child
:meth:`ForkingMixIn.server_close <BaseServer.server_close>` waits until all child

I think it might be worth documenting these methods, though, as their behaviour does differ significantly.

A

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the verbose option :)

I don't agree that their behavior is different: they all just clean things up afterwards. But in a different way (which is an implementation detail that should not be a part of the docs).

processes complete, except if
:attr:`socketserver.ForkingMixIn.block_on_close` attribute is false.
:attr:`!ForkingMixIn.block_on_close` attribute is false.

:meth:`socketserver.ThreadingMixIn.server_close` waits until all non-daemon
:meth:`!ThreadingMixIn.server_close` waits until all non-daemon
threads complete, except if
:attr:`socketserver.ThreadingMixIn.block_on_close` attribute is false. Use
:attr:`!ThreadingMixIn.block_on_close` attribute is false. Use
daemonic threads by setting
:data:`ThreadingMixIn.daemon_threads` to ``True`` to not wait until threads
:data:`!ThreadingMixIn.daemon_threads` to ``True`` to not wait until threads
complete.

.. versionchanged:: 3.7

:meth:`socketserver.ForkingMixIn.server_close` and
:meth:`socketserver.ThreadingMixIn.server_close` now waits until all
:meth:`!ForkingMixIn.server_close` and
:meth:`!ThreadingMixIn.server_close` now waits until all
child processes and non-daemonic threads complete.
Add a new :attr:`socketserver.ForkingMixIn.block_on_close` class
Add a new :attr:`!ForkingMixIn.block_on_close` class
attribute to opt-in for the pre-3.7 behaviour.


Expand Down Expand Up @@ -412,13 +412,13 @@ Request Handler Objects

This function must do all the work required to service a request. The
default implementation does nothing. Several instance attributes are
available to it; the request is available as :attr:`self.request`; the client
address as :attr:`self.client_address`; and the server instance as
:attr:`self.server`, in case it needs access to per-server information.
available to it; the request is available as :attr:`request`; the client
address as :attr:`client_address`; and the server instance as
:attr:`server`, in case it needs access to per-server information.

The type of :attr:`self.request` is different for datagram or stream
services. For stream services, :attr:`self.request` is a socket object; for
datagram services, :attr:`self.request` is a pair of string and socket.
The type of :attr:`request` is different for datagram or stream
services. For stream services, :attr:`request` is a socket object; for
datagram services, :attr:`request` is a pair of string and socket.


.. method:: finish()
Expand All @@ -428,20 +428,42 @@ Request Handler Objects
raises an exception, this function will not be called.


.. attribute:: request

The *new* :class:`socket.socket` object
to be used to communicate with the client.


.. attribute:: client_address

Client address returned by :meth:`BaseServer.get_request`.


.. attribute:: server

:class:`BaseServer` object used for handling the request.


.. class:: StreamRequestHandler
DatagramRequestHandler

These :class:`BaseRequestHandler` subclasses override the
:meth:`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish`
methods, and provide :attr:`self.rfile` and :attr:`self.wfile` attributes.
The :attr:`self.rfile` and :attr:`self.wfile` attributes can be
read or written, respectively, to get the request data or return data
to the client.
The :attr:`!rfile` attributes support the :class:`io.BufferedIOBase` readable interface,
and :attr:`!wfile` attributes support the :class:`!io.BufferedIOBase` writable interface.
methods, and provide :attr:`rfile` and :attr:`wfile` attributes.

.. attribute:: rfile

A file object from which receives the request is read.
Support the :class:`io.BufferedIOBase` readable interface.

.. attribute:: wfile

A file object to which the reply is written.
Support the :class:`io.BufferedIOBase` writable interface


.. versionchanged:: 3.6
:attr:`StreamRequestHandler.wfile` also supports the
:attr:`wfile` also supports the
:class:`io.BufferedIOBase` writable interface.


Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ Doc/library/shelve.rst
Doc/library/signal.rst
Doc/library/smtplib.rst
Doc/library/socket.rst
Doc/library/socketserver.rst
Doc/library/ssl.rst
Doc/library/stdtypes.rst
Doc/library/string.rst
Expand Down