Skip to content
Snippets Groups Projects
Commit 5ea726f0 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

data in payload for c++

parent bda345b9
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ const uint8_t kMaxProcessingThreads = 32; ...@@ -14,6 +14,7 @@ const uint8_t kMaxProcessingThreads = 32;
struct RequestCallbackPayload { struct RequestCallbackPayload {
GenericRequestHeader original_header; GenericRequestHeader original_header;
FileData data;
std::string response; std::string response;
}; };
......
...@@ -23,6 +23,7 @@ bool RequestHandlerFilesystem::ProcessRequestUnlocked(GenericRequest* request, b ...@@ -23,6 +23,7 @@ bool RequestHandlerFilesystem::ProcessRequestUnlocked(GenericRequest* request, b
producer_request->data = io__->GetDataFromFile(producer_request->original_filepath, &producer_request->header.data_size, producer_request->data = io__->GetDataFromFile(producer_request->original_filepath, &producer_request->header.data_size,
&err); &err);
if (err) { if (err) {
producer_request->data = nullptr;
*retry = true; *retry = true;
return false; return false;
} }
...@@ -31,7 +32,7 @@ bool RequestHandlerFilesystem::ProcessRequestUnlocked(GenericRequest* request, b ...@@ -31,7 +32,7 @@ bool RequestHandlerFilesystem::ProcessRequestUnlocked(GenericRequest* request, b
err = io__->WriteDataToFile(destination_folder_, request->header.message, (uint8_t*)producer_request->data.get(), err = io__->WriteDataToFile(destination_folder_, request->header.message, (uint8_t*)producer_request->data.get(),
(size_t)request->header.data_size, true, true); (size_t)request->header.data_size, true, true);
if (producer_request->callback) { if (producer_request->callback) {
producer_request->callback(RequestCallbackPayload{request->header, ""}, std::move(err)); producer_request->callback(RequestCallbackPayload{request->header, std::move(producer_request->data),""}, std::move(err));
} }
*retry = false; *retry = false;
return true; return true;
......
...@@ -216,7 +216,7 @@ bool RequestHandlerTcp::ProcessErrorFromReceiver(const Error& error, ...@@ -216,7 +216,7 @@ bool RequestHandlerTcp::ProcessErrorFromReceiver(const Error& error,
void RequestHandlerTcp::ProcessRequestCallback(Error err, ProducerRequest* request, std::string response, bool* retry) { void RequestHandlerTcp::ProcessRequestCallback(Error err, ProducerRequest* request, std::string response, bool* retry) {
if (request->callback) { if (request->callback) {
request->callback(RequestCallbackPayload{request->header, std::move(response)}, std::move(err)); request->callback(RequestCallbackPayload{request->header, std::move(request->data),std::move(response)}, std::move(err));
} }
*retry = false; *retry = false;
} }
...@@ -266,7 +266,6 @@ bool RequestHandlerTcp::ProcessRequestUnlocked(GenericRequest* request, bool* re ...@@ -266,7 +266,6 @@ bool RequestHandlerTcp::ProcessRequestUnlocked(GenericRequest* request, bool* re
return false; return false;
} }
if (NeedRebalance()) { if (NeedRebalance()) {
CloseConnectionToPeformRebalance(); CloseConnectionToPeformRebalance();
} }
...@@ -304,7 +303,7 @@ void RequestHandlerTcp::ProcessRequestTimeout(GenericRequest* request) { ...@@ -304,7 +303,7 @@ void RequestHandlerTcp::ProcessRequestTimeout(GenericRequest* request) {
auto err = ProducerErrorTemplates::kTimeout.Generate(err_string); auto err = ProducerErrorTemplates::kTimeout.Generate(err_string);
if (producer_request->callback) { if (producer_request->callback) {
producer_request->callback(RequestCallbackPayload{request->header, ""}, std::move(err)); producer_request->callback(RequestCallbackPayload{request->header, std::move(producer_request->data),""}, std::move(err));
} }
} }
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment