[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

(FWD) Subject: [or-cvs] r10132: Added support for the new functionality of ATTACHSTREAM, spe (torflow/trunk/TorCtl)



[Forwarding since I screwed up and didn't add renner to the
whitelist. -RD]

----- Forwarded message from owner-or-cvs@xxxxxxxxxxxxx -----

To: or-cvs@xxxxxxxxxxxxx
From: renner@xxxxxxxx
Subject: [or-cvs] r10132: Added support for the new functionality of ATTACHSTREAM, spe (torflow/trunk/TorCtl)
Date: Mon,  7 May 2007 09:36:23 -0400 (EDT)

Author: renner
Date: 2007-05-07 09:36:21 -0400 (Mon, 07 May 2007)
New Revision: 10132

Modified:
   torflow/trunk/TorCtl/TorCtl.py
Log:
Added support for the new functionality of ATTACHSTREAM, specifying a hop
in the circuit to be used as the exit node for the attached stream.


Modified: torflow/trunk/TorCtl/TorCtl.py
===================================================================
--- torflow/trunk/TorCtl/TorCtl.py	2007-05-07 13:13:58 UTC (rev 10131)
+++ torflow/trunk/TorCtl/TorCtl.py	2007-05-07 13:36:21 UTC (rev 10132)
@@ -662,10 +662,17 @@
     else:
       self.sendAndRecv("REDIRECTSTREAM %d %s\r\n"%(streamid, newaddr))
 
-  def attach_stream(self, streamid, circid):
-    """DOCDOC"""
-    plog("DEBUG", "Attaching stream: "+str(streamid)+" to "+str(circid))
-    self.sendAndRecv("ATTACHSTREAM %d %d\r\n"%(streamid, circid))
+  def attach_stream(self, streamid, circid, hop=None):
+    """Attach a stream to a circuit, specify both by IDs. 
+       If hop is given, try to use the specified hop in 
+       the circuit as the exit node for this stream.
+    """
+    if hop:
+      self.sendAndRecv("ATTACHSTREAM %d %d HOP=%d\r\n"%(streamid, circid, hop))
+      plog("DEBUG", "Attaching stream: "+str(streamid)+" to hop "+str(hop)+" of circuit "+str(circid))
+    else:
+      self.sendAndRecv("ATTACHSTREAM %d %d\r\n"%(streamid, circid))
+      plog("DEBUG", "Attaching stream: "+str(streamid)+" to circuit "+str(circid))
 
   def close_stream(self, streamid, reason=0, flags=()):
     """DOCDOC"""


----- End forwarded message -----