summaryrefslogtreecommitdiff
path: root/pysnmp/carrier/twisted/dgram/unix.py
diff options
context:
space:
mode:
Diffstat (limited to 'pysnmp/carrier/twisted/dgram/unix.py')
-rw-r--r--pysnmp/carrier/twisted/dgram/unix.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/pysnmp/carrier/twisted/dgram/unix.py b/pysnmp/carrier/twisted/dgram/unix.py
index 6ce3cde2..2d5aa195 100644
--- a/pysnmp/carrier/twisted/dgram/unix.py
+++ b/pysnmp/carrier/twisted/dgram/unix.py
@@ -26,13 +26,16 @@ class UnixTwistedTransport(DgramTwistedTransport):
def openClientMode(self, iface=''):
try:
self._lport = reactor.connectUNIXDatagram(iface, self)
+
except Exception as exc:
raise error.CarrierError(exc)
+
return self
def openServerMode(self, iface):
try:
self._lport = reactor.listenUNIXDatagram(iface, self)
+
except Exception as exc:
raise error.CarrierError(exc)
@@ -40,9 +43,10 @@ class UnixTwistedTransport(DgramTwistedTransport):
def closeTransport(self):
if self._lport is not None:
- d = self._lport.stopListening()
- if d:
- d.addCallback(lambda x: None)
+ deferred = self._lport.stopListening()
+ if deferred:
+ deferred.addCallback(lambda x: None)
+
DgramTwistedTransport.closeTransport(self)