summaryrefslogtreecommitdiff
path: root/pysnmp/carrier/asyncore/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'pysnmp/carrier/asyncore/base.py')
-rw-r--r--pysnmp/carrier/asyncore/base.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pysnmp/carrier/asyncore/base.py b/pysnmp/carrier/asyncore/base.py
index da68774d..04044775 100644
--- a/pysnmp/carrier/asyncore/base.py
+++ b/pysnmp/carrier/asyncore/base.py
@@ -4,13 +4,15 @@
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
-import socket, sys
+import socket
+import sys
import asyncore
from pysnmp.carrier import error
from pysnmp.carrier.base import AbstractTransport
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher
from pysnmp import debug
+
class AbstractSocketTransport(asyncore.dispatcher, AbstractTransport):
protoTransportDispatcher = AsyncoreDispatcher
sockFamily = sockType = None
@@ -25,11 +27,11 @@ class AbstractSocketTransport(asyncore.dispatcher, AbstractTransport):
if self.sockFamily is None:
raise error.CarrierError(
'Address family %s not supported' % self.__class__.__name__
- )
+ )
if self.sockType is None:
raise error.CarrierError(
'Socket type %s not supported' % self.__class__.__name__
- )
+ )
try:
sock = socket.socket(self.sockFamily, self.sockType)
except socket.error:
@@ -42,7 +44,7 @@ class AbstractSocketTransport(asyncore.dispatcher, AbstractTransport):
sock.setsockopt(socket.SOL_SOCKET, b, self.bufferSize)
debug.logger & debug.flagIO and debug.logger('%s: socket %d buffer size increased from %d to %d for buffer %d' % (self.__class__.__name__, sock.fileno(), bsize, self.bufferSize, b))
except Exception:
- debug.logger & debug.flagIO and debug.logger('%s: socket buffer size option mangling failure for buffer %d: %s' % (self.__class__.__name__, b, sys.exc_info()[1]))
+ debug.logger & debug.flagIO and debug.logger('%s: socket buffer size option mangling failure for buffer: %s' % (self.__class__.__name__, sys.exc_info()[1]))
# The socket map is managed by the AsyncoreDispatcher on
# which this transport is registered. Here we just prepare