diff options
author | elie <elie> | 2014-01-08 20:18:00 +0000 |
---|---|---|
committer | elie <elie> | 2014-01-08 20:18:00 +0000 |
commit | 485dd54310b797877cafc2fd0769b799e956d043 (patch) | |
tree | e85a999619df5fcbc8797140fd3ccb17b99f130f /pysnmp/carrier/asyncore | |
parent | cce1c98c0a0ac4b161a7f2864c13fc766294583a (diff) | |
download | pysnmp-git-485dd54310b797877cafc2fd0769b799e956d043.tar.gz |
new public DgramSocketTransport.getLocalAddress() returns local endpoint
address underlying BSD socket is currently bound to
Diffstat (limited to 'pysnmp/carrier/asyncore')
-rw-r--r-- | pysnmp/carrier/asyncore/dgram/base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pysnmp/carrier/asyncore/dgram/base.py b/pysnmp/carrier/asyncore/dgram/base.py index 5f20f4eb..5c3970d1 100644 --- a/pysnmp/carrier/asyncore/dgram/base.py +++ b/pysnmp/carrier/asyncore/dgram/base.py @@ -55,7 +55,7 @@ class DgramSocketTransport(AbstractSocketTransport): def normalizeAddress(self, transportAddress): return transportAddress - def __getsockname(self): + def getLocalAddress(self): # one evil OS does not seem to support getsockname() for DGRAM sockets try: return self.socket.getsockname() @@ -67,7 +67,7 @@ class DgramSocketTransport(AbstractSocketTransport): def writable(self): return self.__outQueue def handle_write(self): outgoingMessage, transportAddress = self.__outQueue.pop(0) - debug.logger & debug.flagIO and debug.logger('handle_write: transportAddress %r -> %r outgoingMessage (%d octets) %s' % (self.__getsockname(), transportAddress, len(outgoingMessage), debug.hexdump(outgoingMessage))) + debug.logger & debug.flagIO and debug.logger('handle_write: transportAddress %r -> %r outgoingMessage (%d octets) %s' % (self.getLocalAddress(), transportAddress, len(outgoingMessage), debug.hexdump(outgoingMessage))) if not transportAddress: debug.logger & debug.flagIO and debug.logger('handle_write: missing dst address, loosing outgoing msg') return @@ -84,7 +84,7 @@ class DgramSocketTransport(AbstractSocketTransport): try: incomingMessage, transportAddress = self.socket.recvfrom(65535) transportAddress = self.normalizeAddress(transportAddress) - debug.logger & debug.flagIO and debug.logger('handle_read: transportAddress %r -> %r incomingMessage (%d octets) %s' % (transportAddress, self.__getsockname(), len(incomingMessage), debug.hexdump(incomingMessage))) + debug.logger & debug.flagIO and debug.logger('handle_read: transportAddress %r -> %r incomingMessage (%d octets) %s' % (transportAddress, self.getLocalAddress(), len(incomingMessage), debug.hexdump(incomingMessage))) if not incomingMessage: self.handle_close() return |