Browse Source

Using xlist to remove closed sockets

feature/balanceutils
klonfish 8 years ago committed by klonfish
parent
commit
7bb376d516
  1. 10
      wii-pair/daemon.py

10
wii-pair/daemon.py

@ -172,12 +172,15 @@ s.listen(1) @@ -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: @@ -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:

Loading…
Cancel
Save