gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)

Also include the UDP packet header sizes (8 bytes per packet)
in the buffer size reported to the flow control subsystem.
This commit is contained in:
Jamie Phan 2024-02-17 13:38:07 +11:00 committed by GitHub
parent 8db8d7118e
commit 73e8637002
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 50 additions and 16 deletions

View file

@ -362,6 +362,11 @@ Datagram Transports
This method does not block; it buffers the data and arranges
for it to be sent out asynchronously.
.. versionchanged:: 3.13
This method can be called with an empty bytes object to send a
zero-length datagram. The buffer size calculation used for flow
control is also updated to account for the datagram header.
.. method:: DatagramTransport.abort()
Close the transport immediately, without waiting for pending

View file

@ -218,6 +218,12 @@ asyncio
the Unix socket when the server is closed.
(Contributed by Pierre Ossman in :gh:`111246`.)
* :meth:`asyncio.DatagramTransport.sendto` will now send zero-length
datagrams if called with an empty bytes object. The transport flow
control also now accounts for the datagram header when calculating
the buffer size.
(Contributed by Jamie Phan in :gh:`115199`.)
copy
----