fix:修正未出初始化的变量。

This commit is contained in:
taynpg 2025-05-13 19:29:42 +08:00
parent d0d1c2b36a
commit 4ca6ded5b6
4 changed files with 12 additions and 5 deletions

View File

@ -38,6 +38,7 @@ bool ClientCore::Connect(const wxString& host, uint16_t port)
if (recvThread_.joinable()) { if (recvThread_.joinable()) {
recvThread_.join(); recvThread_.join();
} }
thRun_ = true;
recvThread_ = std::thread(&ClientCore::Recv, this); recvThread_ = std::thread(&ClientCore::Recv, this);
return true; return true;
} }
@ -119,6 +120,7 @@ void ClientCore::UseFrame(FrameBuffer* buf)
InfoClientVec vec; InfoClientVec vec;
ZeroCopyInput input(buf->dataMut, buf->len); ZeroCopyInput input(buf->dataMut, buf->len);
input.archive() >> vec; input.archive() >> vec;
logCall_(wxString::Format(_("Online clients: %d."), static_cast<int>(vec.vec.size())));
if (onlineCallback_) { if (onlineCallback_) {
onlineCallback_(vec); onlineCallback_(vec);
} }

View File

@ -6,7 +6,8 @@
#include <cereal/types/vector.hpp> #include <cereal/types/vector.hpp>
#include <cstdint> #include <cstdint>
constexpr int GBUFFER_SIZE = 256; //constexpr int GBUFFER_SIZE = 256;
constexpr int GBUFFER_SIZE = 1024 * 1024;
struct InfoCommunicate { struct InfoCommunicate {
std::string UUID; std::string UUID;

View File

@ -131,7 +131,7 @@ void RelayServer::thClientThread(const std::shared_ptr<wxSocketBase>& wxSock, co
} }
} }
bool RelayServer::Forword(const sockPtr& wxSock, FrameBuffer* buf) bool RelayServer::Forword(const sockPtr& wxSock, FrameBuffer* buf)
{ {
std::shared_ptr<TranClient> fcl = nullptr; std::shared_ptr<TranClient> fcl = nullptr;
std::shared_ptr<TranClient> tcl = nullptr; std::shared_ptr<TranClient> tcl = nullptr;
@ -163,8 +163,8 @@ void RelayServer::ReplyRequest(const sockPtr& wxSock, FrameBuffer* frame)
{ {
switch (frame->dataType) { switch (frame->dataType) {
case FBT_SER_MSG_ASKCLIENTS: { case FBT_SER_MSG_ASKCLIENTS: {
RpyOnline(wxSock, frame); bool r = RpyOnline(wxSock, frame);
wxLogMessage(wxT("Reply clients to %s clients list."), frame->fid); wxLogMessage(wxT("Reply clients to %s clients list, ret = %d."), frame->fid, r);
break; break;
} }
default: default:
@ -222,7 +222,8 @@ bool RelayServer::Send(const sockPtr& wxSock, FrameBuffer* buf)
} }
wxSock->Write(od, odLen); wxSock->Write(od, odLen);
if (wxSock->Error()) { auto sendCnt = wxSock->LastCount();
if (sendCnt != odLen) {
delete[] od; delete[] od;
wxLogError(wxT("Send error: %s"), wxSock->LastError()); wxLogError(wxT("Send error: %s"), wxSock->LastError());
return false; return false;

View File

@ -34,6 +34,9 @@ void test1()
cereal::BinaryInputArchive inputArchive(inputSs); cereal::BinaryInputArchive inputArchive(inputSs);
inputArchive(info2); inputArchive(info2);
} }
std::cout << "info2.lastModifyTime: " << info2.lastModifyTime << "\n";
std::cout << "info2.permission: " << info2.permission << "\n";
} }
void test2() void test2()