Makes this server start accepting connections on the given sockets. The ``sockets`` parameter is a list of socket objects such as those returned by `~tornado.netutil.bind_sockets`. `add_sockets` is typically used in combination with that method and `tornado.process.f
(self, sockets: Iterable[socket.socket])
| 191 | self.add_sockets(sockets) |
| 192 | |
| 193 | def add_sockets(self, sockets: Iterable[socket.socket]) -> None: |
| 194 | """Makes this server start accepting connections on the given sockets. |
| 195 | |
| 196 | The ``sockets`` parameter is a list of socket objects such as |
| 197 | those returned by `~tornado.netutil.bind_sockets`. |
| 198 | `add_sockets` is typically used in combination with that |
| 199 | method and `tornado.process.fork_processes` to provide greater |
| 200 | control over the initialization of a multi-process server. |
| 201 | """ |
| 202 | for sock in sockets: |
| 203 | self._sockets[sock.fileno()] = sock |
| 204 | self._handlers[sock.fileno()] = add_accept_handler( |
| 205 | sock, self._handle_connection |
| 206 | ) |
| 207 | |
| 208 | def add_socket(self, socket: socket.socket) -> None: |
| 209 | """Singular version of `add_sockets`. Takes a single socket object.""" |