This commit is contained in:
2024-11-15 12:49:11 +03:00
parent 285f8de1f7
commit 221f595bcb
6 changed files with 23 additions and 16 deletions

View File

@@ -259,6 +259,8 @@ public:
timer->cancel();
}
srv->_socket.set_option(asio::socket_base::keep_alive(true));
self.complete(ec, std::move(*srv));
srv.reset();
@@ -574,7 +576,7 @@ public:
if (!ec) {
if (do_read) {
do_read = false;
// do_read = false;
if (_receiveQueue.size()) { // return message from queue
timer->cancel();
auto imsg = _receiveQueue.front();
@@ -593,6 +595,8 @@ public:
}
auto buff = _streamBuffer.prepare(n_avail ? n_avail : 1);
do_read = false;
if constexpr (isTLS) {
return asio::async_read(_sessSocket, std::move(buff), asio::transfer_at_least(1),
std::move(self));
@@ -638,8 +642,9 @@ public:
auto net_pack = this->search(std::span(start_ptr, _streamBuffer.size()));
if (net_pack.empty()) {
do_read = true;
asio::post(std::move(self)); // initiate consequence socket's read operation
return;
return _socket.async_wait(asio::ip::tcp::socket::wait_read, std::move(self));
// asio::post(std::move(self)); // initiate consequence socket's read operation
// return;
}
timer->cancel(); // there were no errors in the asynchronous read-operation, so stop timer