()
| 3767 | finish = False |
| 3768 | |
| 3769 | def serve(): |
| 3770 | server.listen() |
| 3771 | started.set() |
| 3772 | conns = [] |
| 3773 | while not finish: |
| 3774 | r, w, e = select.select([server], [], [], 0.1) |
| 3775 | if server in r: |
| 3776 | # Let the socket hang around rather than having |
| 3777 | # it closed by garbage collection. |
| 3778 | conns.append(server.accept()[0]) |
| 3779 | for sock in conns: |
| 3780 | sock.close() |
| 3781 | |
| 3782 | t = threading.Thread(target=serve) |
| 3783 | t.start() |