Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Send DNS request back on same sock we received it on.

  • Loading branch information...
commit 4bfcd7091d5d7beffba2363ce1e45dd3d9248af0 1 parent bd489b3
@brianmay brianmay authored committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 client.py
View
8 client.py
@@ -291,22 +291,22 @@ def onaccept(listener_sock):
dnsreqs = {}
def dns_done(chan, data):
- peer,timeout = dnsreqs.get(chan) or (None,None)
+ peer,sock,timeout = dnsreqs.get(chan) or (None,None,None)
debug3('dns_done: channel=%r peer=%r\n' % (chan, peer))
if peer:
del dnsreqs[chan]
debug3('doing sendto %r\n' % (peer,))
- dnslistener.sendto(data, peer)
+ sock.sendto(data, peer)
def ondns(listener_sock):
pkt,peer = listener_sock.recvfrom(4096)
now = time.time()
if pkt:
debug1('DNS request from %r: %d bytes\n' % (peer, len(pkt)))
chan = mux.next_channel()
- dnsreqs[chan] = peer,now+30
+ dnsreqs[chan] = peer,listener_sock,now+30
mux.send(chan, ssnet.CMD_DNS_REQ, pkt)
mux.channels[chan] = lambda cmd,data: dns_done(chan,data)
- for chan,(peer,timeout) in dnsreqs.items():
+ for chan,(peer,sock,timeout) in dnsreqs.items():
if timeout < now:
del dnsreqs[chan]
debug3('Remaining DNS requests: %d\n' % len(dnsreqs))
Please sign in to comment.
Something went wrong with that request. Please try again.