本文整理汇总了Python中pysnmp.carrier.base.AbstractTransportDispatcher类的典型用法代码示例。如果您正苦于以下问题:Python AbstractTransportDispatcher类的具体用法?Python AbstractTransportDispatcher怎么用?Python AbstractTransportDispatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractTransportDispatcher类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerTransport
def registerTransport(self, tDomain, transport):
if self.loopingcall is None and self.getTimerResolution() > 0:
self.loopingcall = asyncio.async(self.handle_timeout())
AbstractTransportDispatcher.registerTransport(
self, tDomain, transport
)
self.__transportCount += 1
示例2: registerTransport
def registerTransport(self, tDomain, transport):
if not self.loopingcall.running and self.getTimerResolution() > 0:
self.loopingcall.start(self.getTimerResolution(), now = False)
AbstractTransportDispatcher.registerTransport(
self, tDomain, transport
)
self.__transportCount = self.__transportCount + 1
示例3: registerTransport
def registerTransport(self, tDomain, transport):
if not self.loopingcall.running and self.timeout > 0:
self.loopingcall.start(self.timeout, now = False)
AbstractTransportDispatcher.registerTransport(
self, tDomain, transport
)
self.__transportCount = self.__transportCount + 1
示例4: __init__
def __init__(self, *args, **kwargs):
AbstractTransportDispatcher.__init__(self)
self.__transportCount = 0
if 'timeout' in kwargs:
self.setTimerResolution(kwargs['timeout'])
self.loopingcall = task.LoopingCall(
lambda self=self: self.handleTimerTick(time.time())
)
示例5: __init__
def __init__(self, *args, **kwargs):
AbstractTransportDispatcher.__init__(self)
self.__transportCount = 0
if 'timeout' in kwargs:
self.setTimerResolution(kwargs['timeout'])
else:
self.setTimerResolution(1.0)
self.loopingcall = task.LoopingCall(self.handleTimeout)
示例6: __init__
def __init__(self, io_loop=None):
AbstractTransportDispatcher.__init__(self)
self.io_loop = io_loop or IOLoop.current()
self.timer = PeriodicCallback(self.on_timer,
self.getTimerResolution()*1000, io_loop=self.io_loop)
self.timer.start()
示例7: unregisterTransport
def unregisterTransport(self, tDomain):
t = AbstractTransportDispatcher.getTransport(self, tDomain)
if t is not None:
AbstractTransportDispatcher.unregisterTransport(self, tDomain)
self.__transportCount = self.__transportCount - 1
# The last transport has been removed, stop the timeout
if self.__transportCount == 0 and self.loopingcall.running:
self.loopingcall.stop()
示例8: unregisterTransport
def unregisterTransport(self, tDomain):
t = AbstractTransportDispatcher.getTransport(self, tDomain)
if t is not None:
AbstractTransportDispatcher.unregisterTransport(self, tDomain)
self.__transportCount -= 1
# The last transport has been removed, stop the timeout
if self.__transportCount == 0 and not self.loopingcall.done():
self.loopingcall.cancel()
self.loopingcall = None
示例9: __init__
def __init__(self, *args, **kwargs):
AbstractTransportDispatcher.__init__(self)
self.__transportCount = 0
if 'timeout' in kwargs:
self.setTimerResolution(kwargs['timeout'])
self.loopingcall = None
self.loop = kwargs.pop('loop', asyncio.get_event_loop())
示例10: registerTransport
def registerTransport(self, tDomain, transport):
if self.loopingcall is None and self.getTimerResolution() > 0:
# Avoid deprecation warning for asyncio.async()
if IS_PYTHON_344_PLUS:
self.loopingcall = asyncio.ensure_future(self.handle_timeout())
else:
self.loopingcall = getattr(asyncio, 'async')(self.handle_timeout())
AbstractTransportDispatcher.registerTransport(
self, tDomain, transport
)
self.__transportCount += 1
示例11: __init__
def __init__(self, *args, **kwargs):
AbstractTransportDispatcher.__init__(self)
self.__transportCount = 0
self.timeout = kwargs.get('timeout', 1.0)
self.loopingcall = task.LoopingCall(self.handleTimeout)
示例12: __init__
def __init__(self):
self.__sockMap = {} # use own map for MT safety
self.timeout = 0.5
AbstractTransportDispatcher.__init__(self)