Improve some debugging information to find the weird data problem.

Turns out list.pop() removes the *last* item, not the first one.  Oops.  It
all works great for queues of only one item... :)
This commit is contained in:
Avery Pennarun
2010-05-02 01:18:55 -04:00
parent 915a96b0ec
commit bfd506dcdc
3 changed files with 37 additions and 21 deletions

View File

@ -46,7 +46,8 @@ def _main(listener, listenport, use_server, remotename, subnets):
def onaccept():
sock,srcip = listener.accept()
dstip = original_dst(sock)
log('Incoming connection from %r to %r.\n' % (srcip,dstip))
log('Accept: %r:%r -> %r:%r.\n' % (srcip[0],srcip[1],
dstip[0],dstip[1]))
if dstip == sock.getsockname():
log("-- ignored: that's my address!\n")
sock.close()
@ -72,11 +73,10 @@ def _main(listener, listenport, use_server, remotename, subnets):
handlers = filter(lambda s: s.ok, handlers)
for s in handlers:
s.pre_select(r,w,x)
log('\n')
log('Waiting: %d[%d,%d,%d]...\n'
% (len(handlers), len(r), len(w), len(x)))
(r,w,x) = select.select(r,w,x)
log('r=%r w=%r x=%r\n' % (r,w,x))
#log('r=%r w=%r x=%r\n' % (r,w,x))
ready = set(r) | set(w) | set(x)
for s in handlers:
if s.socks & ready: