[Pkg-privacy-commits] [txtorcon] 15/49: add .is_built Deferred to Circuit
Ximin Luo
infinity0 at debian.org
Mon Oct 19 13:49:51 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 8926c5cd75c2ab9af355c92324028422b6774551
Author: meejah <meejah at meejah.ca>
Date: Sun May 31 14:42:38 2015 -0600
add .is_built Deferred to Circuit
---
docs/releases.rst | 1 +
txtorcon/circuit.py | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/docs/releases.rst b/docs/releases.rst
index bd5c1ba..d660359 100644
--- a/docs/releases.rst
+++ b/docs/releases.rst
@@ -13,6 +13,7 @@ unreleased
`git master <https://github.com/meejah/txtorcon>`_ *will likely become v0.14.0*
* :class:`txtorcon.interface.IStreamAttacher` handling was missing ``None`` and ``DO_NOT_ATTACH`` cases if a Deferred was returned.
+ * add ``.is_built`` Deferred to :class:`txtorcon.Circuit` that get `callback()`d when the circuit becomes BUILT
v0.13.0
diff --git a/txtorcon/circuit.py b/txtorcon/circuit.py
index 8f954f8..c9fb8b5 100644
--- a/txtorcon/circuit.py
+++ b/txtorcon/circuit.py
@@ -59,6 +59,9 @@ class Circuit(object):
:ivar id:
The ID of this circuit, a number (or None if unset).
+
+ :ivar is_built:
+ A Deferred that will callback() when this Circuit hits BUILT state.
"""
def __init__(self, routercontainer):
@@ -77,6 +80,9 @@ class Circuit(object):
self.build_flags = []
self.flags = {}
+ #: callback()d when this circuit hits BUILT
+ self.is_built = defer.Deferred()
+
# this is used to hold a Deferred that will callback() when
# this circuit is being CLOSED or FAILED.
self._closing_deferred = None
@@ -177,6 +183,8 @@ class Circuit(object):
if self.state == 'BUILT':
[x.circuit_built(self) for x in self.listeners]
+ if not self.is_built.called:
+ self.is_built.callback(self)
elif self.state == 'CLOSED':
if len(self.streams) > 0:
--
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