@@ -895,11 +895,13 @@ msgid ""
895895" data. Sophisticated protocol implementations can significantly reduce the "
896896"number of buffer allocations."
897897msgstr ""
898+ "``BufferedProtocol`` 实现允许显式手动分配和控制接收缓冲区。 随后事件循环可以使用协议提供的缓冲区来避免不必要的数据复制。 "
899+ "这对于接收大量数据的协议来说会有明显的性能提升。 复杂的协议实现能显著地减少缓冲区分配的数量。"
898900
899901#: ../../library/asyncio-protocol.rst:602
900902msgid ""
901903"The following callbacks are called on :class:`BufferedProtocol` instances:"
902- msgstr ""
904+ msgstr "以下回调是在 :class:`BufferedProtocol` 实例上被调用的: "
903905
904906#: ../../library/asyncio-protocol.rst:607
905907msgid "Called to allocate a new receive buffer."
@@ -912,26 +914,28 @@ msgid ""
912914"suggests. When set to -1, the buffer size can be arbitrary. It is an error "
913915"to return a buffer with a zero size."
914916msgstr ""
917+ "*sizehint* 是推荐的返回缓冲区最小尺寸。 返回小于或大于 *sizehint* 推荐尺寸的缓冲区也是可接受的。 当设为 -1 "
918+ "时,缓冲区尺寸可以是任意的。 返回尺寸为零的缓冲区则是错误的。"
915919
916920#: ../../library/asyncio-protocol.rst:614
917921msgid ""
918922"``get_buffer()`` must return an object implementing the :ref:`buffer "
919923"protocol <bufferobjects>`."
920- msgstr ""
924+ msgstr "``get_buffer()`` 必须返回一个实现了 :ref:`缓冲区协议 <bufferobjects>` 的对象。 "
921925
922926#: ../../library/asyncio-protocol.rst:619
923927msgid "Called when the buffer was updated with the received data."
924928msgstr "用接收的数据更新缓冲区时被调用。"
925929
926930#: ../../library/asyncio-protocol.rst:621
927931msgid "*nbytes* is the total number of bytes that were written to the buffer."
928- msgstr ""
932+ msgstr "*nbytes* 是被写入到缓冲区的字节总数。 "
929933
930934#: ../../library/asyncio-protocol.rst:625
931935msgid ""
932936"See the documentation of the :meth:`protocol.eof_received() "
933937"<Protocol.eof_received>` method."
934- msgstr ""
938+ msgstr "请查看 :meth:`protocol.eof_received() <Protocol.eof_received>` 方法的文档。 "
935939
936940#: ../../library/asyncio-protocol.rst:629
937941msgid ""
@@ -941,6 +945,10 @@ msgid ""
941945":meth:`~BufferedProtocol.get_buffer` and "
942946":meth:`~BufferedProtocol.buffer_updated` won't be called after it."
943947msgstr ""
948+ "在连接期间 :meth:`~BufferedProtocol.get_buffer` 可以被调用任意次数。 "
949+ "但是,:meth:`protocol.eof_received() <Protocol.eof_received>` "
950+ "最多只能被调用一次,如果被调用,则在此之后 :meth:`~BufferedProtocol.get_buffer` 和 "
951+ ":meth:`~BufferedProtocol.buffer_updated` 不能再被调用。"
944952
945953#: ../../library/asyncio-protocol.rst:648
946954msgid "Datagram Protocols"
@@ -950,34 +958,34 @@ msgstr "数据报协议"
950958msgid ""
951959"Datagram Protocol instances should be constructed by protocol factories "
952960"passed to the :meth:`loop.create_datagram_endpoint` method."
953- msgstr ""
961+ msgstr "数据报协议实例应当由传递给 :meth:`loop.create_datagram_endpoint` 方法的协议工厂来构造。 "
954962
955963#: ../../library/asyncio-protocol.rst:655
956964msgid ""
957965"Called when a datagram is received. *data* is a bytes object containing the"
958966" incoming data. *addr* is the address of the peer sending the data; the "
959967"exact format depends on the transport."
960- msgstr ""
968+ msgstr "当接收到数据报时被调用。 *data* 是包含传入数据的字节串对象。 *addr* 是发送数据的对等端地址;实际的格式取决于具体传输。 "
961969
962970#: ../../library/asyncio-protocol.rst:661
963971msgid ""
964972"Called when a previous send or receive operation raises an :class:`OSError`."
965973" *exc* is the :class:`OSError` instance."
966- msgstr ""
974+ msgstr "当前一个发送或接收操作引发 :class:`OSError` 时被调用。 *exc* 是 :class:`OSError` 的实例。 "
967975
968976#: ../../library/asyncio-protocol.rst:664
969977msgid ""
970978"This method is called in rare conditions, when the transport (e.g. UDP) "
971979"detects that a datagram could not be delivered to its recipient. In many "
972980"conditions though, undeliverable datagrams will be silently dropped."
973- msgstr ""
981+ msgstr "此方法会在当传输(例如UDP)检测到无法将数据报传给接收方等极少数情况下被调用。 而在大多数情况下,无法送达的数据报将被静默地丢弃。 "
974982
975983#: ../../library/asyncio-protocol.rst:671
976984msgid ""
977985"On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for "
978986"datagram protocols, because there is no reliable way to detect send failures"
979987" caused by writing too many packets."
980- msgstr ""
988+ msgstr "在 BSD 系统(macOS, FreeBSD 等等)上,数据报协议不支持流控制,因为没有可靠的方式来检测因写入多过包所导致的发送失败。 "
981989
982990#: ../../library/asyncio-protocol.rst:675
983991msgid ""
0 commit comments