diff --git a/RNS/Link.py b/RNS/Link.py index fcb1357..49fab6e 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -183,6 +183,7 @@ class Link: self.establishment_rate = None self.callbacks = LinkCallbacks() self.resource_strategy = Link.ACCEPT_NONE + self.last_resource_window = None self.outgoing_resources = [] self.incoming_resources = [] self.pending_requests = [] @@ -1136,6 +1137,7 @@ class Link: def resource_concluded(self, resource): if resource in self.incoming_resources: + self.last_resource_window = resource.window self.incoming_resources.remove(resource) if resource in self.outgoing_resources: self.outgoing_resources.remove(resource) @@ -1165,6 +1167,9 @@ class Link: return False + def get_last_resource_window(self): + return self.last_resource_window + def cancel_outgoing_resource(self, resource): if resource in self.outgoing_resources: self.outgoing_resources.remove(resource) diff --git a/RNS/Resource.py b/RNS/Resource.py index 724dd9c..a05e1b3 100644 --- a/RNS/Resource.py +++ b/RNS/Resource.py @@ -186,6 +186,10 @@ class Resource: resource.waiting_for_hmu = False resource.receiving_part = False resource.consecutive_completed_height = -1 + + previous_window = resource.link.get_last_resource_window() + if previous_window: + resource.window = previous_window if not resource.link.has_incoming_resource(resource): resource.link.register_incoming_resource(resource)