Added resource HMU/part request hash filter. Fixes #7.
This commit is contained in:
parent
0c96508cca
commit
40f7a6d359
@ -651,6 +651,10 @@ class Link:
|
|||||||
resource_hash = plaintext[1:RNS.Identity.HASHLENGTH//8+1]
|
resource_hash = plaintext[1:RNS.Identity.HASHLENGTH//8+1]
|
||||||
for resource in self.outgoing_resources:
|
for resource in self.outgoing_resources:
|
||||||
if resource.hash == resource_hash:
|
if resource.hash == resource_hash:
|
||||||
|
# We need to check that this request has not been
|
||||||
|
# received before in order to avoid sequencing errors.
|
||||||
|
if not packet.packet_hash in resource.req_hashlist:
|
||||||
|
resource.req_hashlist.append(packet.packet_hash)
|
||||||
resource.request(plaintext)
|
resource.request(plaintext)
|
||||||
|
|
||||||
elif packet.context == RNS.Packet.RESOURCE_HMU:
|
elif packet.context == RNS.Packet.RESOURCE_HMU:
|
||||||
|
@ -192,6 +192,7 @@ class Resource:
|
|||||||
self.request_id = request_id
|
self.request_id = request_id
|
||||||
self.is_response = is_response
|
self.is_response = is_response
|
||||||
|
|
||||||
|
self.req_hashlist = []
|
||||||
self.receiver_min_consecutive_height = 0
|
self.receiver_min_consecutive_height = 0
|
||||||
|
|
||||||
if timeout != None:
|
if timeout != None:
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = "0.2.3"
|
__version__ = "0.2.4"
|
Loading…
Reference in New Issue
Block a user