[tor-commits] [stem/master] Raising get_streams to the top of the category

atagar at torproject.org atagar at torproject.org
Sat Jan 5 03:17:46 UTC 2013


commit 40a8d3da7505c3b62c8d1a2c353b17d3635bcab8
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jan 4 09:31:28 2013 -0800

    Raising get_streams to the top of the category
    
    This might be yet another "Damian's conventions are weird" thing that I'll come
    to regret, but I placed the getters above the modification funtions for
    circuits, so doing the same for streams.
---
 stem/control.py |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 8bb3a10..39b00b9 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -50,8 +50,8 @@ providing its own for interacting at a higher level.
     |- repurpose_circuit - change a circuit's purpose
     |- close_circuit - close a circuit
     |
-    |- attach_stream - attach a stream to a circuit
     |- get_streams - provides a list of active streams
+    |- attach_stream - attach a stream to a circuit
     |- close_stream - close a stream
     |
     |- signal - sends a signal to the tor client
@@ -1688,6 +1688,25 @@ class Controller(BaseController):
       else:
         raise stem.ProtocolError("CLOSECIRCUIT returned unexpected response code: %s" % response.code)
   
+  def get_streams(self):
+    """
+    Provides the list of streams tor is currently handling.
+    
+    :returns: list of :class:`stem.events.StreamEvent` objects
+    
+    :raises: :class:`stem.ControllerError` if the call fails
+    """
+    
+    streams = []
+    response = self.get_info("stream-status")
+    
+    for stream in response.splitlines():
+      message = stem.socket.recv_message(StringIO.StringIO("650 STREAM " + stream + "\r\n"))
+      stem.response.convert("EVENT", message, arrived_at = 0)
+      streams.append(message)
+    
+    return streams
+  
   def attach_stream(self, stream_id, circuit_id, exiting_hop = None):
     """
     Attaches a stream to a circuit.
@@ -1717,25 +1736,6 @@ class Controller(BaseController):
       else:
         raise stem.ProtocolError("ATTACHSTREAM returned unexpected response code: %s" % response.code)
   
-  def get_streams(self):
-    """
-    Provides the list of streams tor is currently handling.
-    
-    :returns: list of :class:`stem.events.StreamEvent` objects
-    
-    :raises: :class:`stem.ControllerError` if the call fails
-    """
-    
-    streams = []
-    response = self.get_info("stream-status")
-    
-    for stream in response.splitlines():
-      message = stem.socket.recv_message(StringIO.StringIO("650 STREAM " + stream + "\r\n"))
-      stem.response.convert("EVENT", message, arrived_at = 0)
-      streams.append(message)
-    
-    return streams
-  
   def close_stream(self, stream_id, reason = stem.RelayEndReason.MISC, flag = ''):
     """
     Closes the specified stream.





More information about the tor-commits mailing list