Skip to content

Commit

Permalink
Added rotating message identifier for when messages > 65535 per peer
Browse files Browse the repository at this point in the history
  • Loading branch information
qstokkink committed Oct 4, 2017
1 parent b28d34f commit cdb7438
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions ipv8/deprecated/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, destination_address, source_lan_address, source_wan_address,
self._source_wan_address = source_wan_address
self._advice = advice
self._connection_type = connection_type
self._identifier = identifier
self._identifier = identifier % 65536
if sync:
self._time_low, self._time_high, self._modulo, self._offset, self._bloom_filter = sync
else:
Expand Down Expand Up @@ -231,7 +231,7 @@ def __init__(self, destination_address, source_lan_address, source_wan_address,
self._wan_introduction_address = wan_introduction_address
self._connection_type = connection_type
self._tunnel = tunnel
self._identifier = identifier
self._identifier = identifier % 65536

def to_pack_list(self):
encoded_connection_type = encode_connection_type(self._connection_type)
Expand Down Expand Up @@ -319,7 +319,7 @@ def __init__(self, lan_walker_address, wan_walker_address, identifier):
super(PunctureRequestPayload, self).__init__()
self._lan_walker_address = lan_walker_address
self._wan_walker_address = wan_walker_address
self._identifier = identifier
self._identifier = identifier % 65536

def to_pack_list(self):
data = [('4SH', inet_aton(self._lan_walker_address[0]), self._lan_walker_address[1]),
Expand Down Expand Up @@ -369,7 +369,7 @@ def __init__(self, source_lan_address, source_wan_address, identifier):
super(PuncturePayload, self).__init__()
self._source_lan_address = source_lan_address
self._source_wan_address = source_wan_address
self._identifier = identifier
self._identifier = identifier % 65536

def to_pack_list(self):
data = [('4SH', inet_aton(self._source_lan_address[0]), self._source_lan_address[1]),
Expand Down
6 changes: 3 additions & 3 deletions ipv8/peerdiscovery/deprecated/discovery_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SimilarityRequestPayload(Payload):

def __init__(self, identifier, lan_address, wan_address, connection_type, preference_list):
super(SimilarityRequestPayload, self).__init__()
self._identifier = identifier
self._identifier = identifier % 65536
self._preference_list = preference_list
self._lan_address = lan_address
self._wan_address = wan_address
Expand Down Expand Up @@ -64,7 +64,7 @@ class SimilarityResponsePayload(Payload):

def __init__(self, identifier, preference_list, tb_overlap):
super(SimilarityResponsePayload, self).__init__()
self._identifier = identifier
self._identifier = identifier % 65536
self._preference_list = preference_list
self._tb_overlap = tb_overlap

Expand Down Expand Up @@ -103,7 +103,7 @@ class PingPayload(Payload):

def __init__(self, identifier):
super(PingPayload, self).__init__()
self._identifier = identifier
self._identifier = identifier % 65536

def to_pack_list(self):
data = [('H', self._identifier), ]
Expand Down

0 comments on commit cdb7438

Please sign in to comment.