refactor
This commit is contained in:
@@ -315,7 +315,11 @@ auto packet_client::send(std::string_view method, packet &request,
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto current_client = get_client();
|
auto current_client = get_client();
|
||||||
if (current_client) {
|
if (not current_client) {
|
||||||
|
retry_after_sleep();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto current_request = base_request;
|
auto current_request = base_request;
|
||||||
current_request.encode_top(current_client->nonce);
|
current_request.encode_top(current_client->nonce);
|
||||||
@@ -325,8 +329,7 @@ auto packet_client::send(std::string_view method, packet &request,
|
|||||||
|
|
||||||
write_all_with_deadline(
|
write_all_with_deadline(
|
||||||
io_context_, current_client->socket,
|
io_context_, current_client->socket,
|
||||||
boost::asio::buffer(¤t_request[0],
|
boost::asio::buffer(¤t_request[0], current_request.get_size()),
|
||||||
current_request.get_size()),
|
|
||||||
std::chrono::milliseconds(cfg_.send_timeout_ms));
|
std::chrono::milliseconds(cfg_.send_timeout_ms));
|
||||||
|
|
||||||
ret = read_packet(*current_client, response);
|
ret = read_packet(*current_client, response);
|
||||||
@@ -348,14 +351,10 @@ auto packet_client::send(std::string_view method, packet &request,
|
|||||||
close(*current_client);
|
close(*current_client);
|
||||||
retry_after_sleep();
|
retry_after_sleep();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
retry_after_sleep();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not allow_connections_) {
|
if (not allow_connections_) {
|
||||||
ret = utils::from_api_error(api_error::error);
|
ret = utils::from_api_error(api_error::error);
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CONVERT_STATUS_NOT_IMPLEMENTED(ret);
|
return CONVERT_STATUS_NOT_IMPLEMENTED(ret);
|
||||||
|
|||||||
Reference in New Issue
Block a user