rpc: fixed missing read blocks (#1581)

* rpc: fixed missing read blocks
* rpc: storage: restored old behavior
* rpc: allocating 0 bytes for empty read

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger 2022-08-11 17:51:31 +03:00 committed by GitHub
parent a39111ade2
commit 874eb46c93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -320,16 +320,21 @@ static void rpc_system_storage_read_process(const PB_Main* request, void* contex
response->has_next = fs_operation_success && (size_left > 0);
} else {
response->content.storage_read_response.has_file = false;
response->content.storage_read_response.file.data =
malloc(PB_BYTES_ARRAY_T_ALLOCSIZE(0));
response->content.storage_read_response.file.data->size = 0;
response->content.storage_read_response.has_file = true;
response->has_next = false;
fs_operation_success = true;
}
if(fs_operation_success) {
rpc_send_and_release(session, response);
}
} while((size_left != 0) && fs_operation_success);
}
if(fs_operation_success) {
rpc_send_and_release(session, response);
} else {
if(!fs_operation_success) {
rpc_send_and_release_empty(
session, request->command_id, rpc_system_storage_get_file_error(file));
}