mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 23:40:18 +00:00
Improved link request/response handling.
This commit is contained in:
parent
ecf0c55fd6
commit
58d48c18f4
@ -245,7 +245,7 @@ class Link:
|
|||||||
RNS.log("Link "+str(self)+" established with "+str(self.destination)+", RTT is "+str(self.rtt), RNS.LOG_VERBOSE)
|
RNS.log("Link "+str(self)+" established with "+str(self.destination)+", RTT is "+str(self.rtt), RNS.LOG_VERBOSE)
|
||||||
rtt_data = umsgpack.packb(self.rtt)
|
rtt_data = umsgpack.packb(self.rtt)
|
||||||
rtt_packet = RNS.Packet(self, rtt_data, context=RNS.Packet.LRRTT)
|
rtt_packet = RNS.Packet(self, rtt_data, context=RNS.Packet.LRRTT)
|
||||||
rtt_packet.send()
|
#rtt_packet.send()
|
||||||
self.had_outbound()
|
self.had_outbound()
|
||||||
|
|
||||||
self.status = Link.ACTIVE
|
self.status = Link.ACTIVE
|
||||||
@ -491,6 +491,7 @@ class Link:
|
|||||||
self.had_outbound()
|
self.had_outbound()
|
||||||
|
|
||||||
def handle_request(self, request_id, unpacked_request):
|
def handle_request(self, request_id, unpacked_request):
|
||||||
|
if self.status == Link.ACTIVE:
|
||||||
requested_at = unpacked_request[0]
|
requested_at = unpacked_request[0]
|
||||||
path_hash = unpacked_request[1]
|
path_hash = unpacked_request[1]
|
||||||
request_data = unpacked_request[2]
|
request_data = unpacked_request[2]
|
||||||
@ -525,6 +526,7 @@ class Link:
|
|||||||
RNS.log("Request "+RNS.prettyhexrep(request_id)+" from "+identity_string+" not allowed for: "+str(path), RNS.LOG_DEBUG)
|
RNS.log("Request "+RNS.prettyhexrep(request_id)+" from "+identity_string+" not allowed for: "+str(path), RNS.LOG_DEBUG)
|
||||||
|
|
||||||
def handle_response(self, request_id, response_data):
|
def handle_response(self, request_id, response_data):
|
||||||
|
if self.status == Link.ACTIVE:
|
||||||
remove = None
|
remove = None
|
||||||
for pending_request in self.pending_requests:
|
for pending_request in self.pending_requests:
|
||||||
if pending_request.request_id == request_id:
|
if pending_request.request_id == request_id:
|
||||||
|
@ -46,8 +46,6 @@ class Resource:
|
|||||||
# bz2 before sending.
|
# bz2 before sending.
|
||||||
AUTO_COMPRESS_MAX_SIZE = MAX_EFFICIENT_SIZE
|
AUTO_COMPRESS_MAX_SIZE = MAX_EFFICIENT_SIZE
|
||||||
|
|
||||||
# TODO: Should be allocated more
|
|
||||||
# intelligently
|
|
||||||
PART_TIMEOUT_FACTOR = 3
|
PART_TIMEOUT_FACTOR = 3
|
||||||
MAX_RETRIES = 5
|
MAX_RETRIES = 5
|
||||||
SENDER_GRACE_TIME = 10
|
SENDER_GRACE_TIME = 10
|
||||||
|
Loading…
Reference in New Issue
Block a user