Add file_digest in Response::Transfer.

dev
Karchnu 2020-05-20 09:49:16 +02:00
parent 31604fe857
commit b72d54f19d
2 changed files with 4 additions and 2 deletions

View File

@ -56,8 +56,9 @@ end
class FileStorage::Response
JSONIPC.request Transfer, 40 do
property mid : String
property file_digest : String
property n : Int32 # chunk number
def initialize(@mid, @n)
def initialize(@mid, @file_digest, @n)
end
end
end

View File

@ -82,7 +82,8 @@ class FileStorage::Storage
# TODO: verify the digest, if no more chunks.
FileStorage::Response::Transfer.new mid, chunk_number
digest = transfer_info.file_info.digest
FileStorage::Response::Transfer.new mid, digest, chunk_number
rescue e
puts "Error handling transfer: #{e.message}"
FileStorage::Response::Error.new mid.not_nil!, "Unexpected error: #{e.message}"