diff options
author | elie <elie> | 2010-02-01 20:10:40 +0000 |
---|---|---|
committer | elie <elie> | 2010-02-01 20:10:40 +0000 |
commit | 87dc4aae2240517d2477fbe6d475f50839385b29 (patch) | |
tree | a8787cce9bbb1128906bf377db09c2b65fedcbf0 /pysnmp | |
parent | e511dd5b3e01bdb7d1e638a47bad8a90a7a3a4f2 (diff) | |
download | pysnmp-git-87dc4aae2240517d2477fbe6d475f50839385b29.tar.gz |
handle possibly missing IPv6 support
Diffstat (limited to 'pysnmp')
-rw-r--r-- | pysnmp/carrier/asyncore/base.py | 8 | ||||
-rw-r--r-- | pysnmp/carrier/asyncore/dgram/udp6.py | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pysnmp/carrier/asyncore/base.py b/pysnmp/carrier/asyncore/base.py index 144e9769..36e1008a 100644 --- a/pysnmp/carrier/asyncore/base.py +++ b/pysnmp/carrier/asyncore/base.py @@ -12,6 +12,14 @@ class AbstractSocketTransport(asyncore.dispatcher): retryCount = 0; retryInterval = 0 def __init__(self, sock=None, sockMap=None): if sock is None: + 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, why: diff --git a/pysnmp/carrier/asyncore/dgram/udp6.py b/pysnmp/carrier/asyncore/dgram/udp6.py index b0b3f9b6..e9b0315c 100644 --- a/pysnmp/carrier/asyncore/dgram/udp6.py +++ b/pysnmp/carrier/asyncore/dgram/udp6.py @@ -1,5 +1,8 @@ """Implements asyncore-based UDP6 transport domain""" -from socket import AF_INET6 +try: + from socket import AF_INET6 +except: + AF_INET6 = None from pysnmp.carrier.asynsock.dgram.base import DgramSocketTransport domainName = snmpUDP6Domain = (1, 3, 6, 1, 2, 1, 100, 1, 2) |