(self)
| 227 | self._run() |
| 228 | |
| 229 | def _run(self): |
| 230 | while self._active: |
| 231 | if self._clients >= self._max_clients: |
| 232 | return |
| 233 | |
| 234 | r, w, x = select.select( |
| 235 | [self._sock, self._s1], [], [], self._timeout) |
| 236 | |
| 237 | if self._s1 in r: |
| 238 | return |
| 239 | |
| 240 | if self._sock in r: |
| 241 | try: |
| 242 | conn, addr = self._sock.accept() |
| 243 | except BlockingIOError: |
| 244 | continue |
| 245 | except TimeoutError: |
| 246 | if not self._active: |
| 247 | return |
| 248 | else: |
| 249 | raise |
| 250 | else: |
| 251 | self._clients += 1 |
| 252 | conn.settimeout(self._timeout) |
| 253 | try: |
| 254 | with conn: |
| 255 | self._handle_client(conn) |
| 256 | except Exception as ex: |
| 257 | self._active = False |
| 258 | try: |
| 259 | raise |
| 260 | finally: |
| 261 | self._test._abort_socket_test(ex) |
| 262 | |
| 263 | def _handle_client(self, sock): |
| 264 | self._prog(TestSocketWrapper(sock)) |
no test coverage detected