Stops listening for new connections. Requests currently in progress may still continue after the server is stopped.
(self)
| 308 | self.add_sockets(sockets) |
| 309 | |
| 310 | def stop(self) -> None: |
| 311 | """Stops listening for new connections. |
| 312 | |
| 313 | Requests currently in progress may still continue after the |
| 314 | server is stopped. |
| 315 | """ |
| 316 | if self._stopped: |
| 317 | return |
| 318 | self._stopped = True |
| 319 | for fd, sock in self._sockets.items(): |
| 320 | assert sock.fileno() == fd |
| 321 | # Unregister socket from IOLoop |
| 322 | self._handlers.pop(fd)() |
| 323 | sock.close() |
| 324 | |
| 325 | def handle_stream( |
| 326 | self, stream: IOStream, address: tuple |