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