()
| 4050 | finish = False |
| 4051 | |
| 4052 | def serve(): |
| 4053 | server.listen() |
| 4054 | started.set() |
| 4055 | conns = [] |
| 4056 | while not finish: |
| 4057 | r, w, e = select.select([server], [], [], 0.1) |
| 4058 | if server in r: |
| 4059 | # Let the socket hang around rather than having |
| 4060 | # it closed by garbage collection. |
| 4061 | conns.append(server.accept()[0]) |
| 4062 | for sock in conns: |
| 4063 | sock.close() |
| 4064 | |
| 4065 | t = threading.Thread(target=serve) |
| 4066 | t.start() |