Merge pull request #784 from fred-a-kemp/tor-control-spec-compliance
TorManager.send(): read until repsonse terminator.
This commit is contained in:
commit
f529c7f2a2
1 changed files with 3 additions and 1 deletions
|
@ -239,10 +239,12 @@ class TorManager:
|
||||||
if not conn:
|
if not conn:
|
||||||
conn = self.conn
|
conn = self.conn
|
||||||
self.log.debug("> %s" % cmd)
|
self.log.debug("> %s" % cmd)
|
||||||
|
back = ""
|
||||||
for retry in range(2):
|
for retry in range(2):
|
||||||
try:
|
try:
|
||||||
conn.sendall("%s\r\n" % cmd)
|
conn.sendall("%s\r\n" % cmd)
|
||||||
back = conn.recv(1024 * 64).decode("utf8", "ignore")
|
while not back.endswith("250 OK\r\n"):
|
||||||
|
back += conn.recv(1024 * 64).decode("utf8", "ignore")
|
||||||
break
|
break
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
self.log.error("Tor send error: %s, reconnecting..." % err)
|
self.log.error("Tor send error: %s, reconnecting..." % err)
|
||||||
|
|
Loading…
Reference in a new issue