Example #1
0
 def connection(self, handler=None):
     """Deprecated: use connection_to_host() instead
     """
     impl = _chandler(handler, self.on_error_delegate())
     result = Connection.wrap(pn_reactor_connection(self._impl, impl))
     if impl: pn_decref(impl)
     return result
Example #2
0
 def connection(self, handler=None):
     """Deprecated: use connection_to_host() instead
     """
     impl = _chandler(handler, self.on_error)
     result = Connection.wrap(pn_reactor_connection(self._impl, impl))
     if impl: pn_decref(impl)
     return result
Example #3
0
 def selectable(self, handler=None):
     impl = _chandler(handler, self.on_error)
     result = Selectable.wrap(pn_reactor_selectable(self._impl))
     if impl:
         record = pn_selectable_attachments(result._impl)
         pn_record_set_handler(record, impl)
         pn_decref(impl)
     return result
Example #4
0
 def acceptor(self, host, port, handler=None):
     impl = _chandler(handler, self.on_error)
     aimpl = pn_reactor_acceptor(self._impl, unicode2utf8(host), str(port), impl)
     pn_decref(impl)
     if aimpl:
         return Acceptor(aimpl)
     else:
         raise IOError("%s (%s:%s)" % (pn_error_text(pn_io_error(pn_reactor_io(self._impl))), host, port))
Example #5
0
def unwrap_handler(delegate):
    if delegate is not None:
        if isinstance(delegate, BaseHandler):
            return delegate
        else:
            return _chandler(delegate)
    else:
        return None
Example #6
0
 def _set_global(self, handler):
     impl = _chandler(handler, self.on_error)
     pn_reactor_set_global_handler(self._impl, impl)
     pn_decref(impl)
Example #7
0
 def connection(self, handler=None):
     impl = _chandler(handler, self.on_error)
     result = Connection.wrap(pn_reactor_connection(self._impl, impl))
     pn_decref(impl)
     return result
Example #8
0
 def schedule(self, delay, task):
     impl = _chandler(task, self.on_error)
     task = Task.wrap(pn_reactor_schedule(self._impl, secs2millis(delay), impl))
     pn_decref(impl)
     return task
Example #9
0
 def _set_handler(self, handler):
     impl = _chandler(handler, self.on_error_delegate())
     pn_reactor_set_handler(self._impl, impl)
     pn_decref(impl)