mirror of
https://github.com/modelec/TCPSocketServer.git
synced 2026-01-19 00:47:36 +01:00
all client ready
This commit is contained in:
@@ -151,6 +151,7 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket)
|
||||
break;
|
||||
}
|
||||
}
|
||||
checkIfAllClientsReady();
|
||||
}
|
||||
else if (tokens[0] == "gc") {
|
||||
if (tokens[2] == "axis") {
|
||||
@@ -341,6 +342,23 @@ void TCPServer::start()
|
||||
std::thread([this]() { acceptConnections(); }).detach();
|
||||
}
|
||||
|
||||
void TCPServer::checkIfAllClientsReady() {
|
||||
bool allReady = true;
|
||||
for (auto&[name, socket, isReady] : clients)
|
||||
{
|
||||
if (!isReady)
|
||||
{
|
||||
// std::cout << name << " is not ready" << std::endl;
|
||||
allReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (allReady)
|
||||
{
|
||||
this->broadcastMessage("strat;all;ready;1\n");
|
||||
}
|
||||
}
|
||||
|
||||
void TCPServer::toggleBras() {
|
||||
brasBaisser = !brasBaisser;
|
||||
if (brasBaisser) {
|
||||
|
||||
@@ -110,6 +110,8 @@ public:
|
||||
|
||||
void handleEmergency();
|
||||
|
||||
void checkIfAllClientsReady();
|
||||
|
||||
void toggleBras();
|
||||
|
||||
void togglePince(int pince);
|
||||
|
||||
Reference in New Issue
Block a user