diff options
Diffstat (limited to 'examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py')
-rw-r--r-- | examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py b/examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py index 39b15c57..6e831582 100644 --- a/examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py +++ b/examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py @@ -24,7 +24,7 @@ from pysnmp.hlapi.v3arch.twisted import * @defer.inlineCallbacks def sendtrap(reactor, snmpEngine, hostname): - yield sendNotification( + deferred = sendNotification( snmpEngine, CommunityData('public', mpModel=0), UdpTransportTarget((hostname, 162)), @@ -39,8 +39,10 @@ def sendtrap(reactor, snmpEngine, hostname): ) ) + yield deferred + + # Preserve SnmpEngine instance across [potentially] multiple calls to safe on initialization snmpEngine = SnmpEngine() react(sendtrap, [snmpEngine, 'demo.snmplabs.com']) - |