[Pkg-privacy-commits] [txtorcon] 08/49: a Deferred from attach_stream that returns None handled correctly

Ximin Luo infinity0 at debian.org
Mon Oct 19 13:49:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository txtorcon.

commit 9523319cecbc1d0aa8fdb4d6874f0debc22d0432
Author: meejah <meejah at meejah.ca>
Date:   Tue May 19 23:52:22 2015 -0600

    a Deferred from attach_stream that returns None handled correctly
    
    If we ultimately return None from a Deferred-returning attach_stream,
    that should mean we want Tor to attach it.
    
    Needs a unit-test.
---
 txtorcon/torstate.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/txtorcon/torstate.py b/txtorcon/torstate.py
index c53fa2f..c8679e4 100644
--- a/txtorcon/torstate.py
+++ b/txtorcon/torstate.py
@@ -622,10 +622,13 @@ class TorState(object):
                             self.state = state
 
                         def __call__(self, arg):
-                            circid = arg.id
-                            self.state.protocol.queue_command(
-                                "ATTACHSTREAM %d %d" % (self.stream_id, circid)
-                            )
+                            if arg is None:
+                                return self.state.protocol.queue_command("ATTACHSTREAM %d 0" % stream.id)
+                            else:
+                                circid = arg.id
+                                return self.state.protocol.queue_command(
+                                    "ATTACHSTREAM %d %d" % (self.stream_id, circid)
+                                )
 
                     circ.addCallback(IssueStreamAttach(self, stream.id))
                     circ.addErrback(log.err)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git



More information about the Pkg-privacy-commits mailing list