From 466e99e57a6e892b5f34d8d559e4b5e2b32472b0 Mon Sep 17 00:00:00 2001 From: rkados Date: Fri, 17 Mar 2023 12:58:24 +0100 Subject: [PATCH 1/3] fix bug uploading files --- dataplicity/_version.py | 2 +- dataplicity/m2m/packets.py | 1 + dataplicity/remote_directory.py | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dataplicity/_version.py b/dataplicity/_version.py index 72c840d..d68c7c9 100644 --- a/dataplicity/_version.py +++ b/dataplicity/_version.py @@ -1,4 +1,4 @@ -__version__ = "0.5.9" +__version__ = "0.5.10" if __name__ == "__main__": # The build script uses this to extract the current version diff --git a/dataplicity/m2m/packets.py b/dataplicity/m2m/packets.py index 360ef5b..a44ecba 100644 --- a/dataplicity/m2m/packets.py +++ b/dataplicity/m2m/packets.py @@ -512,6 +512,7 @@ class WriteRemoteFileResult(M2MPacket): attributes = [ ("id", bytes), ("position", int), + ("chunk_size", int), ("device_path", bytes), ("fail", int), ("fail_reason", bytes), diff --git a/dataplicity/remote_directory.py b/dataplicity/remote_directory.py index 139350b..964e862 100644 --- a/dataplicity/remote_directory.py +++ b/dataplicity/remote_directory.py @@ -315,6 +315,8 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina client.send( PacketType.write_remote_file_result, id, + offset, + len(data), device_path, 1, str(error).encode("utf-8", "replace"), @@ -337,6 +339,7 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina PacketType.write_remote_file_result, id, offset, + len(data), device_path, 2, str(error).encode("utf-8", "replace"), @@ -357,6 +360,7 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina PacketType.write_remote_file_result, id, offset, + len(data), device_path, 3, str(error).encode("utf-8", "replace"), @@ -368,6 +372,7 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina PacketType.write_remote_file_result, id, offset + len(data), + len(data), device_path, 0, b"", From 930acd61469469ae62ae248165a8e151a15b7573 Mon Sep 17 00:00:00 2001 From: rkados Date: Fri, 17 Mar 2023 13:11:53 +0100 Subject: [PATCH 2/3] increase max clock discrepancy --- dataplicity/clockcheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataplicity/clockcheck.py b/dataplicity/clockcheck.py index 5326d73..0d5a6f3 100644 --- a/dataplicity/clockcheck.py +++ b/dataplicity/clockcheck.py @@ -16,7 +16,7 @@ CHECK_PERIOD = 1.0 -MAX_CLOCK_DISCREPENCY = 10.0 +MAX_CLOCK_DISCREPENCY = 180.0 class ClockCheckThread(Thread): From 96128f940438701c09f0877cea6dd5729262bd78 Mon Sep 17 00:00:00 2001 From: rkados Date: Mon, 8 May 2023 10:56:24 +0200 Subject: [PATCH 3/3] fix typo --- dataplicity/clockcheck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dataplicity/clockcheck.py b/dataplicity/clockcheck.py index 0d5a6f3..8ccd7f1 100644 --- a/dataplicity/clockcheck.py +++ b/dataplicity/clockcheck.py @@ -16,7 +16,7 @@ CHECK_PERIOD = 1.0 -MAX_CLOCK_DISCREPENCY = 180.0 +MAX_CLOCK_DISCREPANCY = 180.0 class ClockCheckThread(Thread): @@ -34,7 +34,7 @@ def run(self): sleep(CHECK_PERIOD) elapsed = time() - start - if elapsed > MAX_CLOCK_DISCREPENCY: + if elapsed > MAX_CLOCK_DISCREPANCY: self.on_fail() def on_fail(self):