A few log message changes.

This commit is contained in:
Karchnu 2020-10-21 23:24:53 +02:00
parent bfa43f2667
commit edc7cdb6f3
2 changed files with 4 additions and 8 deletions

View File

@ -85,7 +85,6 @@ class FileStorage::Client < IPC::Client
def get_chunks(dl_response : FileStorage::Response::Download, path : String = ".")
file_path = "#{path}/#{dl_response.file_info.name}"
Baguette::Log.debug "Getting #{file_path}"
digest = dl_response.file_info.digest
buffer_size = FileStorage.message_buffer_size
@ -94,12 +93,10 @@ class FileStorage::Client < IPC::Client
size = 0
while counter < dl_response.file_info.nb_chunks
Baguette::Log.debug "Getting #{file_path}: chunk #{counter+1}/#{dl_response.file_info.nb_chunks}"
Baguette::Log.debug "getting #{file_path}: chunk #{counter+1}/#{dl_response.file_info.nb_chunks}"
get_chunk_message = FileStorage::Request::GetChunk.new digest, counter
send_now @server_fd.not_nil!, get_chunk_message
response = parse_message [ FileStorage::Response::GetChunk ], read
# TODO: write the file
pp! response
case response
when FileStorage::Response::GetChunk
@ -120,7 +117,8 @@ class FileStorage::Client < IPC::Client
data : Bytes
)
pp! file_path, chunk_size, offset, data.size
# pp! file_path, chunk_size, offset, data.size
Baguette::Log.debug "writing on #{file_path}"
# Create the file if non existant.
File.open(file_path, "a+") do |file|

View File

@ -126,8 +126,6 @@ def put(client : FileStorage::Client)
end
def get(client : FileStorage::Client)
Baguette::Log.warning "get command not complete, yet"
files = Context.args
files.each do |filedigest|
response = client.download filedigest
@ -136,7 +134,7 @@ def get(client : FileStorage::Client)
Baguette::Log.info "downloading file #{filedigest} with #{response.file_info.nb_chunks} chunks"
client.get_chunks response, Context.path
else
Baguette::Log.error ">> #{response.class.name}"
Baguette::Log.error "#{response.class.name}"
next
end
end