Override to handle a new `.IOStream` from an incoming connection. This method may be a coroutine; if so any exceptions it raises asynchronously will be logged. Accepting of incoming connections will not be blocked by this coroutine. If this `TCPServer` is configured
(
self, stream: IOStream, address: tuple
)
| 319 | sock.close() |
| 320 | |
| 321 | def handle_stream( |
| 322 | self, stream: IOStream, address: tuple |
| 323 | ) -> Optional[Awaitable[None]]: |
| 324 | """Override to handle a new `.IOStream` from an incoming connection. |
| 325 | |
| 326 | This method may be a coroutine; if so any exceptions it raises |
| 327 | asynchronously will be logged. Accepting of incoming connections |
| 328 | will not be blocked by this coroutine. |
| 329 | |
| 330 | If this `TCPServer` is configured for SSL, ``handle_stream`` |
| 331 | may be called before the SSL handshake has completed. Use |
| 332 | `.SSLIOStream.wait_for_handshake` if you need to verify the client's |
| 333 | certificate or use NPN/ALPN. |
| 334 | |
| 335 | .. versionchanged:: 4.2 |
| 336 | Added the option for this method to be a coroutine. |
| 337 | """ |
| 338 | raise NotImplementedError() |
| 339 | |
| 340 | def _handle_connection(self, connection: socket.socket, address: Any) -> None: |
| 341 | if self.ssl_options is not None: |