summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-07-20 21:05:05 +0000
committerNick Mathewson <nickm@torproject.org>2004-07-20 21:05:05 +0000
commit6d53717215bb6c47b277a46060fb52e92d297a45 (patch)
treea120fef52c651cc89566ade9af1d0a3d1de4180b /contrib
parente57698cc6e3a675702f8c91c669b56f14f478edd (diff)
downloadtor-6d53717215bb6c47b277a46060fb52e92d297a45.tar.gz
tor-6d53717215bb6c47b277a46060fb52e92d297a45.zip
Handle closed connection properly on tor_resolve
svn:r2066
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/tor_resolve6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/tor_resolve b/contrib/tor_resolve
index 8242916df4..31b44af9d4 100755
--- a/contrib/tor_resolve
+++ b/contrib/tor_resolve
@@ -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)