Merge pull request #784 from fred-a-kemp/tor-control-spec-compliance

TorManager.send(): read until repsonse terminator.
This commit is contained in:
ZeroNet 2017-01-20 20:51:02 +01:00 committed by GitHub
commit f529c7f2a2

View file

@ -239,10 +239,12 @@ class TorManager:
if not conn:
conn = self.conn
self.log.debug("> %s" % cmd)
back = ""
for retry in range(2):
try:
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
except Exception, err:
self.log.error("Tor send error: %s, reconnecting..." % err)