Fixed inadverdent AutoInterface multi-IF deque hit for resource transfer retries
This commit is contained in:
parent
95dec00c76
commit
9889b479d1
@ -51,7 +51,8 @@ class AutoInterface(Interface):
|
|||||||
|
|
||||||
BITRATE_GUESS = 10*1000*1000
|
BITRATE_GUESS = 10*1000*1000
|
||||||
|
|
||||||
MULTI_IF_DEQUE_LEN = 64
|
MULTI_IF_DEQUE_LEN = 48
|
||||||
|
MULTI_IF_DEQUE_TTL = 0.75
|
||||||
|
|
||||||
def handler_factory(self, callback):
|
def handler_factory(self, callback):
|
||||||
def create_handler(*args, **keys):
|
def create_handler(*args, **keys):
|
||||||
@ -93,6 +94,7 @@ class AutoInterface(Interface):
|
|||||||
self.multicast_echoes = {}
|
self.multicast_echoes = {}
|
||||||
self.timed_out_interfaces = {}
|
self.timed_out_interfaces = {}
|
||||||
self.mif_deque = deque(maxlen=AutoInterface.MULTI_IF_DEQUE_LEN)
|
self.mif_deque = deque(maxlen=AutoInterface.MULTI_IF_DEQUE_LEN)
|
||||||
|
self.mif_deque_times = deque(maxlen=AutoInterface.MULTI_IF_DEQUE_LEN)
|
||||||
self.carrier_changed = False
|
self.carrier_changed = False
|
||||||
|
|
||||||
self.outbound_udp_socket = None
|
self.outbound_udp_socket = None
|
||||||
@ -396,8 +398,16 @@ class AutoInterface(Interface):
|
|||||||
|
|
||||||
def processIncoming(self, data):
|
def processIncoming(self, data):
|
||||||
data_hash = RNS.Identity.full_hash(data)
|
data_hash = RNS.Identity.full_hash(data)
|
||||||
if not data_hash in self.mif_deque:
|
deque_hit = False
|
||||||
|
if data_hash in self.mif_deque:
|
||||||
|
for te in self.mif_deque_times:
|
||||||
|
if te[0] == data_hash and time.time() < te[1]+AutoInterface.MULTI_IF_DEQUE_TTL:
|
||||||
|
deque_hit = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if not deque_hit:
|
||||||
self.mif_deque.append(data_hash)
|
self.mif_deque.append(data_hash)
|
||||||
|
self.mif_deque_times.append([data_hash, time.time()])
|
||||||
self.rxb += len(data)
|
self.rxb += len(data)
|
||||||
self.owner.inbound(data, self)
|
self.owner.inbound(data, self)
|
||||||
|
|
||||||
|
@ -662,6 +662,7 @@ class Resource:
|
|||||||
for map_hash in self.hashmap[self.consecutive_completed_height:self.consecutive_completed_height+self.window]:
|
for map_hash in self.hashmap[self.consecutive_completed_height:self.consecutive_completed_height+self.window]:
|
||||||
if map_hash == part_hash:
|
if map_hash == part_hash:
|
||||||
if self.parts[i] == None:
|
if self.parts[i] == None:
|
||||||
|
|
||||||
# Insert data into parts list
|
# Insert data into parts list
|
||||||
self.parts[i] = part_data
|
self.parts[i] = part_data
|
||||||
self.rtt_rxd_bytes += len(part_data)
|
self.rtt_rxd_bytes += len(part_data)
|
||||||
@ -761,6 +762,7 @@ class Resource:
|
|||||||
self.req_sent = self.last_activity
|
self.req_sent = self.last_activity
|
||||||
self.req_sent_bytes = len(request_packet.raw)
|
self.req_sent_bytes = len(request_packet.raw)
|
||||||
self.req_resp = None
|
self.req_resp = None
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Could not send resource request packet, cancelling resource", RNS.LOG_DEBUG)
|
RNS.log("Could not send resource request packet, cancelling resource", RNS.LOG_DEBUG)
|
||||||
RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
|
RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
|
||||||
|
@ -1494,7 +1494,7 @@ class Transport:
|
|||||||
RNS.log("Error while processing external announce callback.", RNS.LOG_ERROR)
|
RNS.log("Error while processing external announce callback.", RNS.LOG_ERROR)
|
||||||
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
|
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
# Handling for linkrequests to local destinations
|
# Handling for link requests to local destinations
|
||||||
elif packet.packet_type == RNS.Packet.LINKREQUEST:
|
elif packet.packet_type == RNS.Packet.LINKREQUEST:
|
||||||
if packet.transport_id == None or packet.transport_id == Transport.identity.hash:
|
if packet.transport_id == None or packet.transport_id == Transport.identity.hash:
|
||||||
for destination in Transport.destinations:
|
for destination in Transport.destinations:
|
||||||
|
Loading…
Reference in New Issue
Block a user