Clarify that flow control works for datagrams, except on BSD.

This commit is contained in:
Guido van Rossum 2014-02-24 14:31:25 -08:00
parent 8920e915fa
commit 3e97585b3e
1 changed files with 11 additions and 2 deletions

View File

@ -376,8 +376,8 @@ The following callbacks are called on :class:`DatagramProtocol` instances.
Flow control callbacks Flow control callbacks
---------------------- ----------------------
These callbacks may be called on :class:`Protocol` and These callbacks may be called on :class:`Protocol`,
:class:`SubprocessProtocol` instances: :class:`DatagramProtocol` and :class:`SubprocessProtocol` instances:
.. method:: BaseProtocol.pause_writing() .. method:: BaseProtocol.pause_writing()
@ -402,6 +402,15 @@ buffer size reaches the low-water mark.
are important to ensure that things go as expected when either are important to ensure that things go as expected when either
mark is zero. mark is zero.
.. note::
On BSD systems (OS X, FreeBSD, etc.) flow control is not supported
for :class:`DatagramProtocol`, because send failures caused by
writing too many packets cannot be detected easily. The socket
always appears 'ready' and excess packets are dropped; an
:class:`OSError` with errno set to :const:`errno.ENOBUFS` may or
may not be raised; if it is raised, it will be reported to
:meth:`DatagramProtocol.error_received` but otherwise ignored.
Coroutines and protocols Coroutines and protocols
------------------------ ------------------------