From 4ca6ded5b6299741de9e2a3a9cd94f680491fbd2 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 13 May 2025 19:29:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3=E6=9C=AA?= =?UTF-8?q?=E5=87=BA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClientCore/ClientCore.cxx | 2 ++ Information/InfoCommunicate.hpp | 3 ++- RelayServer/RelayServer.cxx | 9 +++++---- Test/main.cxx | 3 +++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ClientCore/ClientCore.cxx b/ClientCore/ClientCore.cxx index 35efb6e..4c0824e 100644 --- a/ClientCore/ClientCore.cxx +++ b/ClientCore/ClientCore.cxx @@ -38,6 +38,7 @@ bool ClientCore::Connect(const wxString& host, uint16_t port) if (recvThread_.joinable()) { recvThread_.join(); } + thRun_ = true; recvThread_ = std::thread(&ClientCore::Recv, this); return true; } @@ -119,6 +120,7 @@ void ClientCore::UseFrame(FrameBuffer* buf) InfoClientVec vec; ZeroCopyInput input(buf->dataMut, buf->len); input.archive() >> vec; + logCall_(wxString::Format(_("Online clients: %d."), static_cast(vec.vec.size()))); if (onlineCallback_) { onlineCallback_(vec); } diff --git a/Information/InfoCommunicate.hpp b/Information/InfoCommunicate.hpp index 81a7dc8..3b4c993 100644 --- a/Information/InfoCommunicate.hpp +++ b/Information/InfoCommunicate.hpp @@ -6,7 +6,8 @@ #include #include -constexpr int GBUFFER_SIZE = 256; +//constexpr int GBUFFER_SIZE = 256; +constexpr int GBUFFER_SIZE = 1024 * 1024; struct InfoCommunicate { std::string UUID; diff --git a/RelayServer/RelayServer.cxx b/RelayServer/RelayServer.cxx index 8487ca4..4b67ba0 100644 --- a/RelayServer/RelayServer.cxx +++ b/RelayServer/RelayServer.cxx @@ -131,7 +131,7 @@ void RelayServer::thClientThread(const std::shared_ptr& wxSock, co } } -bool RelayServer::Forword(const sockPtr& wxSock, FrameBuffer* buf) +bool RelayServer::Forword(const sockPtr& wxSock, FrameBuffer* buf) { std::shared_ptr fcl = nullptr; std::shared_ptr tcl = nullptr; @@ -163,8 +163,8 @@ void RelayServer::ReplyRequest(const sockPtr& wxSock, FrameBuffer* frame) { switch (frame->dataType) { case FBT_SER_MSG_ASKCLIENTS: { - RpyOnline(wxSock, frame); - wxLogMessage(wxT("Reply clients to %s clients list."), frame->fid); + bool r = RpyOnline(wxSock, frame); + wxLogMessage(wxT("Reply clients to %s clients list, ret = %d."), frame->fid, r); break; } default: @@ -222,7 +222,8 @@ bool RelayServer::Send(const sockPtr& wxSock, FrameBuffer* buf) } wxSock->Write(od, odLen); - if (wxSock->Error()) { + auto sendCnt = wxSock->LastCount(); + if (sendCnt != odLen) { delete[] od; wxLogError(wxT("Send error: %s"), wxSock->LastError()); return false; diff --git a/Test/main.cxx b/Test/main.cxx index 4c89cba..0906a87 100644 --- a/Test/main.cxx +++ b/Test/main.cxx @@ -34,6 +34,9 @@ void test1() cereal::BinaryInputArchive inputArchive(inputSs); inputArchive(info2); } + + std::cout << "info2.lastModifyTime: " << info2.lastModifyTime << "\n"; + std::cout << "info2.permission: " << info2.permission << "\n"; } void test2()