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