(self)
| 1862 | self._run() |
| 1863 | |
| 1864 | def _run(self): |
| 1865 | while self._active: |
| 1866 | if self._clients >= self._max_clients: |
| 1867 | return |
| 1868 | |
| 1869 | r, w, x = select.select( |
| 1870 | [self._sock, self._s1], [], [], self._timeout) |
| 1871 | |
| 1872 | if self._s1 in r: |
| 1873 | return |
| 1874 | |
| 1875 | if self._sock in r: |
| 1876 | try: |
| 1877 | conn, addr = self._sock.accept() |
| 1878 | except BlockingIOError: |
| 1879 | continue |
| 1880 | except socket.timeout: |
| 1881 | if not self._active: |
| 1882 | return |
| 1883 | else: |
| 1884 | raise |
| 1885 | else: |
| 1886 | self._clients += 1 |
| 1887 | conn.settimeout(self._timeout) |
| 1888 | try: |
| 1889 | with conn: |
| 1890 | self._handle_client(conn) |
| 1891 | except (KeyboardInterrupt, SystemExit): |
| 1892 | raise |
| 1893 | except BaseException as ex: |
| 1894 | self._active = False |
| 1895 | try: |
| 1896 | raise |
| 1897 | finally: |
| 1898 | self._test._abort_socket_test(ex) |
| 1899 | |
| 1900 | def _handle_client(self, sock): |
| 1901 | self._prog(TestSocketWrapper(sock)) |
no test coverage detected