Handle closed connection properly on tor_resolve

svn:r2066
This commit is contained in:
Nick Mathewson 2004-07-20 21:05:05 +00:00
parent e57698cc6e
commit 6d53717215

View File

@ -97,7 +97,11 @@ def resolve(hostname, sockshost, socksport, socksver=4):
answer = s.recv(8)
result = parse(answer)
while result is None:
answer += s.recv(1)
more = s.recv(1)
if not more:
print "Connection closed; dying."
return None
answer += more
result = parse(answer)
print "Got answer",result
m = s.recv(1)