all client ready

This commit is contained in:
ackimixs
2024-05-15 11:51:09 +02:00
parent 4b00c345b2
commit cdb6a86850
2 changed files with 20 additions and 0 deletions

View File

@@ -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) {

View File

@@ -110,6 +110,8 @@ public:
void handleEmergency();
void checkIfAllClientsReady();
void toggleBras();
void togglePince(int pince);