From 31604fe8579c210214dd6bf2e17ab56bd6393d8b Mon Sep 17 00:00:00 2001 From: Karchnu Date: Wed, 20 May 2020 09:28:06 +0200 Subject: [PATCH] Add chunk number to Response::Transfer. --- src/common/requests/transfer.cr | 3 ++- src/server/storage.cr | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/requests/transfer.cr b/src/common/requests/transfer.cr index 46a7fbf..aee7669 100644 --- a/src/common/requests/transfer.cr +++ b/src/common/requests/transfer.cr @@ -56,7 +56,8 @@ end class FileStorage::Response JSONIPC.request Transfer, 40 do property mid : String - def initialize(@mid) + property n : Int32 # chunk number + def initialize(@mid, @n) end end end diff --git a/src/server/storage.cr b/src/server/storage.cr index 626a5e4..9e8e448 100644 --- a/src/server/storage.cr +++ b/src/server/storage.cr @@ -82,7 +82,7 @@ class FileStorage::Storage # TODO: verify the digest, if no more chunks. - FileStorage::Response::Transfer.new mid + FileStorage::Response::Transfer.new mid, chunk_number rescue e puts "Error handling transfer: #{e.message}" FileStorage::Response::Error.new mid.not_nil!, "Unexpected error: #{e.message}"