Wrap the accepted socket in a stream, optionally with direct TLS.
(self, ssl_context=None)
| 173 | return True |
| 174 | |
| 175 | async def use_client_stream(self, ssl_context=None): |
| 176 | """Wrap the accepted socket in a stream, optionally with direct TLS.""" |
| 177 | self.client_reader = asyncio.StreamReader() |
| 178 | protocol = asyncio.StreamReaderProtocol(self.client_reader) |
| 179 | transport, _ = await self.loop.connect_accepted_socket( |
| 180 | lambda: protocol, self.client_sock, ssl=ssl_context) |
| 181 | self.client_writer = asyncio.StreamWriter( |
| 182 | transport, protocol, self.client_reader, self.loop) |
| 183 | |
| 184 | async def start_tls(self, ssl_context): |
| 185 | writer = self.client_writer |