mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
connection: PopenTransferManager: Reset last_sample when we start a new transfer
last_sample is initialized in the PopenTransferManager constructor. However, there is only one PopenTransferManager instance, which is initialized during the construction of AdbConnection. Afterwards, the transfer manager is reused for every file transfer, without going through __init__(). Therefore, after pushing/pulling a big file, the next file transfer has compares the current size to the last sample of the previous file transfer. This makes it believe that the transfer is inactive. Reinitialize last_sample every time we start a new transfer to avoid this.
This commit is contained in:
parent
e7bafd6e5b
commit
9f55ae7603
@ -466,6 +466,7 @@ class PopenTransferManager(TransferManagerBase):
|
||||
if self.transfer:
|
||||
self.transfer.cancel()
|
||||
self.transfer = None
|
||||
self.last_sample = None
|
||||
|
||||
def isactive(self):
|
||||
size_fn = self._push_dest_size if self.direction == 'push' else self._pull_dest_size
|
||||
@ -477,6 +478,7 @@ class PopenTransferManager(TransferManagerBase):
|
||||
|
||||
def set_transfer_and_wait(self, popen_bg_cmd):
|
||||
self.transfer = popen_bg_cmd
|
||||
self.last_sample = None
|
||||
ret = self.transfer.wait()
|
||||
|
||||
if ret and not self.transfer_aborted.is_set():
|
||||
|
Loading…
x
Reference in New Issue
Block a user