call shutdown before close
This commit is contained in:
parent
a788563db6
commit
26897c256b
@ -49,6 +49,8 @@ packet_client::~packet_client() {
|
||||
|
||||
void packet_client::close(client &cli) {
|
||||
try {
|
||||
cli.socket.shutdown(boost::asio::socket_base::shutdown_both);
|
||||
|
||||
boost::system::error_code err;
|
||||
cli.socket.close(err);
|
||||
} catch (...) {
|
||||
@ -110,8 +112,8 @@ void packet_client::put_client(std::shared_ptr<client> &cli) {
|
||||
}
|
||||
}
|
||||
|
||||
auto packet_client::read_packet(client &cli, packet &response)
|
||||
-> packet::error_type {
|
||||
auto packet_client::read_packet(client &cli,
|
||||
packet &response) -> packet::error_type {
|
||||
data_buffer buffer(sizeof(std::uint32_t));
|
||||
const auto read_buffer = [&]() {
|
||||
std::uint32_t offset{};
|
||||
@ -152,8 +154,8 @@ void packet_client::resolve() {
|
||||
.resolve(cfg_.host_name_or_ip, std::to_string(cfg_.api_port));
|
||||
}
|
||||
|
||||
auto packet_client::send(std::string_view method, std::uint32_t &service_flags)
|
||||
-> packet::error_type {
|
||||
auto packet_client::send(std::string_view method,
|
||||
std::uint32_t &service_flags) -> packet::error_type {
|
||||
packet request;
|
||||
return send(method, request, service_flags);
|
||||
}
|
||||
@ -165,8 +167,8 @@ auto packet_client::send(std::string_view method, packet &request,
|
||||
}
|
||||
|
||||
auto packet_client::send(std::string_view method, packet &request,
|
||||
packet &response, std::uint32_t &service_flags)
|
||||
-> packet::error_type {
|
||||
packet &response,
|
||||
std::uint32_t &service_flags) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto success = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user