server.py: handle (throw away) ECONNREFUSED from the DNS server.

This might happen occasionally on a flakey network.  Reported by Ed Maste.
This commit is contained in:
Avery Pennarun 2011-03-19 22:48:15 -07:00
parent 2e8381ecda
commit cfb2592346

View File

@ -119,7 +119,14 @@ class DnsProxy(Handler):
self.sock.send(request)
def callback(self):
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