(self, loop, sock, protocol, waiter=None,
extra=None, server=None, context=None)
| 940 | _sendfile_compatible = constants._SendfileMode.TRY_NATIVE |
| 941 | |
| 942 | def __init__(self, loop, sock, protocol, waiter=None, |
| 943 | extra=None, server=None, context=None): |
| 944 | self._read_ready_cb = None |
| 945 | super().__init__(loop, sock, protocol, extra, server, context) |
| 946 | self._eof = False |
| 947 | self._empty_waiter = None |
| 948 | if _HAS_SENDMSG: |
| 949 | self._write_ready = self._write_sendmsg |
| 950 | else: |
| 951 | self._write_ready = self._write_send |
| 952 | # Disable the Nagle algorithm -- small writes will be |
| 953 | # sent without waiting for the TCP ACK. This generally |
| 954 | # decreases the latency (in some cases significantly.) |
| 955 | base_events._set_nodelay(self._sock) |
| 956 | |
| 957 | self._call_soon(self._protocol.connection_made, self) |
| 958 | # only start reading when connection_made() has been called |
| 959 | self._call_soon(self._add_reader, self._sock_fd, self._read_ready) |
| 960 | if waiter is not None: |
| 961 | # only wake up the waiter when connection_made() has been called |
| 962 | self._call_soon(futures._set_result_unless_cancelled, waiter, None) |
| 963 | |
| 964 | def set_protocol(self, protocol): |
| 965 | if isinstance(protocol, protocols.BufferedProtocol): |
nothing calls this directly
no test coverage detected