Skip to content

Commit

Permalink
receivedhashes_to_acks contains receiver_address
Browse files Browse the repository at this point in the history
  • Loading branch information
LefterisJP committed Aug 31, 2017
1 parent 02534e3 commit cf275b0
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions raiden/network/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,16 +582,15 @@ def maybe_send_ack(self, receiver_address, ack_message):
)

messagedata = ack_message.encode()
host_port = self.get_host_port(receiver_address)
self.receivedhashes_to_acks[ack_message.echo] = (host_port, messagedata)

self.receivedhashes_to_acks[ack_message.echo] = (receiver_address, messagedata)
self._maybe_send_ack(*self.receivedhashes_to_acks[ack_message.echo])

def _maybe_send_ack(self, host_port, messagedata):
def _maybe_send_ack(self, receiver_address, messagedata):
""" ACK must not go into the queue, otherwise nodes will deadlock
waiting for the confirmation.
"""
if self.transport.server.started:
host_port = self.get_host_port(receiver_address)
self.transport.send(
self.raiden,
host_port,
Expand Down Expand Up @@ -646,15 +645,11 @@ def receive(self, data):
return

# Repeat the ACK if the message has been handled before
message = decode(data)
echohash = sha3(data + self.raiden.address)
if echohash in self.receivedhashes_to_acks:
# Check if host_post is still current for the ACK repeat
current_host_port = self.get_host_port(message.sender)
host_port, messagedata = self.receivedhashes_to_acks[echohash]
if host_port != current_host_port:
self.receivedhashes_to_acks[echohash] = (current_host_port, messagedata)
return self._maybe_send_ack(current_host_port, messagedata)
return self._maybe_send_ack(*self.receivedhashes_to_acks[echohash])

message = decode(data)

if isinstance(message, Ack):
waitack = self.senthashes_to_states.get(message.echo)
Expand Down

0 comments on commit cf275b0

Please sign in to comment.