|
@@ -125,6 +125,9 @@ class CommunicationProcessor():
|
|
|
msgs, msg_id = [], 0
|
|
|
# keep track of previous request to find connections
|
|
|
prev_reqs = {}
|
|
|
+ # used to determine whether a request has been seen yet, so that replies before the first request are skipped and do not throw an error by
|
|
|
+ # accessing the empty dict prev_reqs (this is not a perfect solution, but it works most of the time)
|
|
|
+ req_seen = False
|
|
|
local_init_ids = self.local_init_ids
|
|
|
external_init_ids = set()
|
|
|
|
|
@@ -154,9 +157,10 @@ class CommunicationProcessor():
|
|
|
msgs.append(msg)
|
|
|
prev_reqs[msg_str] = msg_id
|
|
|
msg_id += 1
|
|
|
+ req_seen = True
|
|
|
|
|
|
# process a reply
|
|
|
- elif msg_type in {MessageType.SALITY_HELLO_REPLY, MessageType.SALITY_NL_REPLY}:
|
|
|
+ elif msg_type in {MessageType.SALITY_HELLO_REPLY, MessageType.SALITY_NL_REPLY} and req_seen:
|
|
|
if not self.nat and id_src in local_init_ids and id_dst not in local_init_ids:
|
|
|
# process ID's role
|
|
|
external_init_ids.add(id_dst)
|