Compare commits

...
2 Commits
Author SHA1 Message Date
Morteza Bashsiz c02c9f20e4 Merge pull request #107 from MortezaBashsiz/morteza/unused
use boost::bind_executor in tcpconnection
2024-09-23 15:59:09 +02:00
Morteza Bashsiz 61429b9dde use boost::bind_executor in tcpconnection 2024-09-23 15:58:36 +02:00
2 changed files with 5 additions and 5 deletions

No files matched your search

+4 -4
View File
@@ -147,9 +147,9 @@ void TCPConnection::doWrite() {
resetTimeout();
boost::asio::async_write(socket_, writeBuffer_,
boost::asio::bind_executor(strand_,
boost::bind(&TCPConnection::handleWrite, shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
[self = shared_from_this()](const boost::system::error_code &error, std::size_t /*bytes_transferred*/) {
self->handleWrite(error);
}));
} catch (std::exception &error) {
log_->write(
std::string("[" + to_string(uuid_) + "] [TCPConnection doWrite] [catch] ") + error.what(),
@@ -158,7 +158,7 @@ void TCPConnection::doWrite() {
}
}
void TCPConnection::handleWrite(const boost::system::error_code &error, std::size_t bytes_transferred) {
void TCPConnection::handleWrite(const boost::system::error_code &error) {
cancelTimeout();
if (!error) {
doRead();
+1 -1
View File
@@ -40,7 +40,7 @@ public:
void handleRead(const boost::system::error_code &error,
size_t bytes_transferred);
void doWrite();
void handleWrite(const boost::system::error_code &error, std::size_t bytes_transferred);
void handleWrite(const boost::system::error_code &error);
void socketShutdown();
private: