Skip to content

Commit

Permalink
UDP Socket dict address fix
Browse files Browse the repository at this point in the history
- fixes #1008
  • Loading branch information
PeterSurda committed Jun 11, 2017
1 parent cba7490 commit a3a55e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/network/connectionpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def addConnection(self, connection):

def removeConnection(self, connection):
if isinstance(connection, network.udp.UDPSocket):
del self.udpSockets[connection.destination.host]
del self.udpSockets[connection.listening.host]
if isinstance(connection, network.tcp.TCPServer):
del self.listeningSockets[state.Peer(connection.destination.host, connection.destination.port)]
elif connection.isOutbound:
Expand Down Expand Up @@ -109,7 +109,7 @@ def startUDPSocket(self, bind=None):
udpSocket = network.udp.UDPSocket(host=host)
else:
udpSocket = network.udp.UDPSocket(host=bind)
self.udpSockets[udpSocket.destination.host] = udpSocket
self.udpSockets[udpSocket.listening.host] = udpSocket

def loop(self):
# defaults to empty loop if outbound connections are maxed
Expand Down
1 change: 1 addition & 0 deletions src/network/udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(self, host=None, sock=None):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except AttributeError:
pass
self.listening = state.Peer(self.socket.getsockname()[0], self.socket.getsockname()[1])
self.destination = state.Peer(self.socket.getsockname()[0], self.socket.getsockname()[1])
ObjectTracker.__init__(self)
self.connecting = False
Expand Down

0 comments on commit a3a55e5

Please sign in to comment.