Navigation Menu

Skip to content

Commit

Permalink
server.py: handle (throw away) ECONNREFUSED from the DNS server.
Browse files Browse the repository at this point in the history
This might happen occasionally on a flakey network.  Reported by Ed Maste.
  • Loading branch information
apenwarr committed Mar 20, 2011
1 parent 2e8381e commit cfb2592
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server.py
Expand Up @@ -119,7 +119,14 @@ def __init__(self, mux, chan, request):
self.sock.send(request)

def callback(self):
data = self.sock.recv(4096)
try:
data = self.sock.recv(4096)
except socket.error, e:
if e.args[0] == errno.ECONNREFUSED:
debug2('DNS response: ignoring ECONNREFUSED.\n')
return # might have been spurious; wait for a real answer
else:
raise
debug2('DNS response: %d bytes\n' % len(data))
self.mux.send(self.chan, ssnet.CMD_DNS_RESPONSE, data)
self.ok = False
Expand Down

0 comments on commit cfb2592

Please sign in to comment.