本文整理匯總了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)