From 035a44e34d527b3791e68af84752e37dcc83ab4f Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 28 Aug 2024 21:21:09 +0200 Subject: [PATCH] Fixed invalid resource progress reported in some cases --- RNS/Resource.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RNS/Resource.py b/RNS/Resource.py index 9422537..24244cd 100644 --- a/RNS/Resource.py +++ b/RNS/Resource.py @@ -923,7 +923,9 @@ class Resource: """ :returns: The current progress of the resource transfer as a *float* between 0.0 and 1.0. """ - if self.initiator: + if self.status == RNS.Resource.COMPLETE and self.segment_index == self.total_segments: + return 1.0 + elif self.initiator: self.processed_parts = (self.segment_index-1)*math.ceil(Resource.MAX_EFFICIENT_SIZE/Resource.SDU) self.processed_parts += self.sent_parts self.progress_total_parts = float(self.grand_total_parts)