mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-05-13 03:42:45 -04:00
Added resource reject signalling
This commit is contained in:
parent
a2878f1722
commit
e869b3cac9
2 changed files with 39 additions and 0 deletions
11
RNS/Link.py
11
RNS/Link.py
|
@ -962,6 +962,8 @@ class Link:
|
|||
resource_advertisement.link = self
|
||||
if self.callbacks.resource(resource_advertisement):
|
||||
RNS.Resource.accept(packet, self.callbacks.resource_concluded)
|
||||
else:
|
||||
RNS.Resource.reject(packet)
|
||||
except Exception as e:
|
||||
RNS.log("Error while executing resource accept callback from "+str(self)+". The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
elif self.resource_strategy == Link.ACCEPT_ALL:
|
||||
|
@ -1007,6 +1009,15 @@ class Link:
|
|||
if resource_hash == resource.hash:
|
||||
resource.cancel()
|
||||
|
||||
elif packet.context == RNS.Packet.RESOURCE_RCL:
|
||||
plaintext = self.decrypt(packet.data)
|
||||
if plaintext != None:
|
||||
self.__update_phy_stats(packet)
|
||||
resource_hash = plaintext[:RNS.Identity.HASHLENGTH//8]
|
||||
for resource in self.outgoing_resources:
|
||||
if resource_hash == resource.hash:
|
||||
resource._rejected()
|
||||
|
||||
elif packet.context == RNS.Packet.KEEPALIVE:
|
||||
if not self.initiator and packet.data == bytes([0xFF]):
|
||||
keepalive_packet = RNS.Packet(self, bytes([0xFE]), context=RNS.Packet.KEEPALIVE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue