summaryrefslogtreecommitdiff
path: root/contrib/TorControl.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-03-31 07:05:29 +0000
committerNick Mathewson <nickm@torproject.org>2005-03-31 07:05:29 +0000
commit83ad64365a738d05ae6f8d07299ac33ee09172ff (patch)
tree965c3675b1c545f4b0f7bb5ba19e9fc54f28e437 /contrib/TorControl.py
parentd90b02d318ade2c3fb128399e0854622ac7bd7f1 (diff)
downloadtor-83ad64365a738d05ae6f8d07299ac33ee09172ff.tar.gz
tor-83ad64365a738d05ae6f8d07299ac33ee09172ff.zip
Add close_foo functions to TorControl
svn:r3929
Diffstat (limited to 'contrib/TorControl.py')
-rwxr-xr-xcontrib/TorControl.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/TorControl.py b/contrib/TorControl.py
index 815ceecc83..b7ccbfc5e7 100755
--- a/contrib/TorControl.py
+++ b/contrib/TorControl.py
@@ -314,6 +314,16 @@ def attach_stream(s, streamid, circid):
send_message(s,MSG_TYPE.ATTACHSTREAM,msg)
tp,body = receive_reply(s,[MSG_TYPE.DONE])
+def close_stream(s, streamid, reason=0, flags=0):
+ msg = struct.pack("!LBB",streamid,reason,flags)
+ send_message(s,MSG_TYPE.CLOSESTREAM,msg)
+ tp,body = receive_reply(s,[MSG_TYPE.DONE])
+
+def close_circuit(s, circid, flags=0):
+ msg = struct.pack("!LB",circid,flags)
+ send_message(s,MSG_TYPE.CLOSECIRCUIT,msg)
+ tp,body = receive_reply(s,[MSG_TYPE.DONE])
+
def _unterminate(s):
if s[-1] == '\0':
return s[:-1]