[tor-commits] [stem/master] Add enumeration of RELAY_END reasons

atagar at torproject.org atagar at torproject.org
Mon Dec 10 15:49:01 UTC 2012


commit 69a2c8193fd613ce057b6d0adb466a21437ef5ff
Author: Sean Robinson <seankrobinson at gmail.com>
Date:   Sat Dec 8 19:20:38 2012 -0700

    Add enumeration of RELAY_END reasons
    
    This is for the reason to be given with the CLOSESTREAM command.
    NONE is a filler to make the remaining reasons start at offset one
    and will be rejected by the server, so it is not listed in the pydoc.
    
    Signed-off-by: Sean Robinson <seankrobinson at gmail.com>
---
 stem/__init__.py |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/stem/__init__.py b/stem/__init__.py
index cddf033..5eb6737 100644
--- a/stem/__init__.py
+++ b/stem/__init__.py
@@ -159,6 +159,29 @@ Library for working with the tor process.
   **HSSR_JOINED**               connected to the rendezvous-point
   ============================= ===========
 
+.. data:: RelayEndReason (enum)
+  
+  Enumeration for possible reasons to close a stream.
+  
+  =================== ===========
+  RelayEndReason      Description
+  =================== ===========
+  **MISC**            catch-all for unlisted reasons
+  **RESOLVEFAILED**   couldn't look up hostname
+  **CONNECTREFUSED**  remote host refused connection
+  **EXITPOLICY**      OR refuses to connect to host or port
+  **DESTROY**         Circuit is being destroyed
+  **DONE**            Anonymized TCP connection was closed
+  **TIMEOUT**         Connection timed out, or OR timed out while connecting
+  **NOROUTE**         Routing error while attempting to contact destination
+  **HIBERNATING**     OR is temporarily hibernating
+  **INTERNAL**        Internal error at the OR
+  **RESOURCELIMIT**   OR has no resources to fulfill request
+  **CONNRESET**       Connection was unexpectedly reset
+  **TORPROTOCOL**     Sent when closing connection because of Tor protocol violations.
+  **NOTDIRECTORY**    Client sent RELAY_BEGIN_DIR to a non-directory relay.
+  =================== ===========
+
 .. data:: StreamStatus (enum)
   
   State that a stream going through tor can have. Tor may provide states not in
@@ -521,6 +544,24 @@ HiddenServiceState = stem.util.enum.UppercaseEnum(
   "HSSR_JOINED",
 )
 
+RelayEndReason = stem.util.enum.UppercaseEnum(
+  "NONE",
+  "MISC",
+  "RESOLVEFAILED",
+  "CONNECTREFUSED",
+  "EXITPOLICY",
+  "DESTROY",
+  "DONE",
+  "TIMEOUT",
+  "NOROUTE",
+  "HIBERNATING",
+  "INTERNAL",
+  "RESOURCELIMIT",
+  "CONNRESET",
+  "TORPROTOCOL",
+  "NOTDIRECTORY",
+)
+
 StreamStatus = stem.util.enum.UppercaseEnum(
   "NEW",
   "NEWRESOLVE",





More information about the tor-commits mailing list