Repository: qpid-proton
Updated Branches:
  refs/heads/master 4d1116aea -> 5efd45d1f


exposed start/stop/process to python


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5efd45d1
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5efd45d1
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5efd45d1

Branch: refs/heads/master
Commit: 5efd45d1fdcb12f25fe900e9cd8d8350f40dd063
Parents: 4d1116a
Author: Rafael Schloming <[email protected]>
Authored: Tue Feb 3 05:33:26 2015 -0500
Committer: Rafael Schloming <[email protected]>
Committed: Tue Feb 3 05:33:26 2015 -0500

----------------------------------------------------------------------
 proton-c/bindings/python/proton/reactors.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5efd45d1/proton-c/bindings/python/proton/reactors.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactors.py 
b/proton-c/bindings/python/proton/reactors.py
index 463bf2d..4de2d5c 100644
--- a/proton-c/bindings/python/proton/reactors.py
+++ b/proton-c/bindings/python/proton/reactors.py
@@ -941,15 +941,23 @@ class Reactor(Wrapper):
         return _wrap_handler(self, pn_reactor_handler(self._impl))
 
     def run(self):
+        self.start()
+        while self.process(3.14159265359): pass
+        self.stop()
+
+    def start(self):
         pn_reactor_start(self._impl)
-        while pn_reactor_work(self._impl, 3142):
-            if self.errors:
-                break
+
+    def process(self, timeout=0):
+        result = pn_reactor_work(self._impl, secs2millis(timeout))
         if self.errors:
             for exc, value, tb in self.errors[:-1]:
                 traceback.print_exception(exc, value, tb)
             exc, value, tb = self.errors[-1]
             raise exc, value, tb
+        return result
+
+    def stop(self):
         pn_reactor_stop(self._impl)
 
     def schedule(self, delay, task):


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to