summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-01-19 16:26:13 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-01-19 16:26:13 (GMT)
commite45a77adbec3ceb2aefe7ae7e60e28e903d16172 (patch)
treedbb47d9de478721f04abc073d3d85bd466c18e95 /Doc
parent5e3745c886929bc8db4b987b5eb178fbeede75da (diff)
downloadcpython-e45a77adbec3ceb2aefe7ae7e60e28e903d16172.zip
cpython-e45a77adbec3ceb2aefe7ae7e60e28e903d16172.tar.gz
cpython-e45a77adbec3ceb2aefe7ae7e60e28e903d16172.tar.bz2
Patch #742598 from Michael Pomraning: add .timeout attribute to SocketServer that will call
.handle_timeout() method when no requests are received within the timeout period.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/socketserver.rst16
1 files changed, 15 insertions, 1 deletions
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index c900ea7..2c85c86 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -44,7 +44,7 @@ to behave autonomously; the default is :const:`False`, meaning that Python will
not exit until all threads created by :class:`ThreadingMixIn` have exited.
Server classes have the same external methods and attributes, no matter what
-network protocol they use:
+network protocol they use.
Server Creation Notes
@@ -193,6 +193,13 @@ The server classes support the following class variables:
The type of socket used by the server; :const:`socket.SOCK_STREAM` and
:const:`socket.SOCK_DGRAM` are two possible values.
+.. data:: timeout
+
+ Timeout duration, measured in seconds, or :const:`None` if no timeout is desired.
+ If no incoming requests are received within the timeout period,
+ the :meth:`handle_timeout` method is called and then the server resumes waiting for
+ requests.
+
There are various server methods that can be overridden by subclasses of base
server classes like :class:`TCPServer`; these methods aren't useful to external
users of the server object.
@@ -220,6 +227,13 @@ users of the server object.
method raises an exception. The default action is to print the traceback to
standard output and continue handling further requests.
+.. function:: handle_timeout()
+
+ This function is called when the :attr:`timeout` attribute has been set to a
+ value other than :const:`None` and the timeout period has passed with no
+ requests being received. The default action for forking servers is
+ to collect the status of any child processes that have exited, while
+ in threading servers this method does nothing.
.. function:: process_request(request, client_address)