更新 src/Netra.cpp

This commit is contained in:
2025-10-15 12:36:07 +08:00
parent ce05d066ef
commit 502868ef44

View File

@@ -171,6 +171,20 @@ namespace QCL
return std::string(buffer, bytesReceived);
}
void TcpServer::removeClient(int clientSock)
{
std::lock_guard<std::mutex> lock(clientsMutex_);
for (auto it = clientSockets_.begin(); it != clientSockets_.end(); ++it)
{
if (*it == clientSock)
{
close(*it);
clientSockets_.erase(it);
break;
}
}
}
/**
* @brief 获取当前所有客户端Socket副本线程安全
* @return 包含所有客户端socket的vector副本