diff --git a/wii-pair/daemon.py b/wii-pair/daemon.py index 7bcba47..f53481b 100755 --- a/wii-pair/daemon.py +++ b/wii-pair/daemon.py @@ -172,12 +172,15 @@ s.listen(1) try: conns = [] while True: - rlist, wlist, xlist = select.select([s]+conns, [], []) + rlist, wlist, xlist = select.select([s]+conns, [], conns) if s in rlist: conn, addr = s.accept() conns.append(conn) rlist.remove(s) + for sock in xlist: + conns.remove(sock) + for sock in rlist: try: m = sock.recv(1) @@ -185,11 +188,6 @@ try: conns.remove(sock) continue - if len(m) == 0: - conn.close() - conns.remove(sock) - continue - r = b'' for w in wiis: if w.pos_x is None: