From d1c6702872f758077b42531458df988a952a4192 Mon Sep 17 00:00:00 2001 From: PioLing <964472638@qq.com> Date: Thu, 4 Jul 2024 10:30:26 +0800 Subject: [PATCH] Correct the compilation warning messages. --- src/Network/TcpClient.cpp | 2 +- src/Network/TcpServer.cpp | 2 +- tests/test_pingpong.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Network/TcpClient.cpp b/src/Network/TcpClient.cpp index b2d292fca..6a98eb996 100644 --- a/src/Network/TcpClient.cpp +++ b/src/Network/TcpClient.cpp @@ -109,7 +109,7 @@ void TcpClient::onSockConnect(const SockException &ex) { return true; }); - sock_ptr->setOnRead([weak_self, sock_ptr](const Buffer::Ptr &pBuf, struct sockaddr *, int) { + sock_ptr->setOnRead([weak_self, sock_ptr](Buffer::Ptr &pBuf, struct sockaddr *, int) { auto strong_self = weak_self.lock(); if (!strong_self) { return; diff --git a/src/Network/TcpServer.cpp b/src/Network/TcpServer.cpp index 3d9147438..621321652 100644 --- a/src/Network/TcpServer.cpp +++ b/src/Network/TcpServer.cpp @@ -123,7 +123,7 @@ Session::Ptr TcpServer::onAcceptConnection(const Socket::Ptr &sock) { weak_ptr weak_session = session; //会话接收数据事件 - sock->setOnRead([weak_session](const Buffer::Ptr &buf, struct sockaddr *, int) { + sock->setOnRead([weak_session](Buffer::Ptr &buf, struct sockaddr *, int) { //获取会话强应用 auto strong_session = weak_session.lock(); if (!strong_session) { diff --git a/tests/test_pingpong.cpp b/tests/test_pingpong.cpp index df24d71c0..118bc4d7a 100644 --- a/tests/test_pingpong.cpp +++ b/tests/test_pingpong.cpp @@ -128,7 +128,7 @@ int main(int argc,char *argv[]){ socket->setOnErr([](const SockException &err){ WarnL << err.what(); }); - socket->setOnRead([interval,socket](const Buffer::Ptr &buffer, struct sockaddr *addr , int addr_len){ + socket->setOnRead([interval,socket](Buffer::Ptr &buffer, struct sockaddr *addr , int addr_len){ if(!interval){ socket->send(buffer); }