mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Replace bad continue statement with goto in monitor socket iteration
This commit is contained in:
parent
811c9d4d5c
commit
d5409ed3f1
@ -87,8 +87,10 @@ static bool transmit(std::list<SOCKET>::iterator& it, char *buff, int len) {
|
|||||||
void Monitor::tick(CNServer *serv, time_t delta) {
|
void Monitor::tick(CNServer *serv, time_t delta) {
|
||||||
std::lock_guard<std::mutex> lock(sockLock);
|
std::lock_guard<std::mutex> lock(sockLock);
|
||||||
char buff[256];
|
char buff[256];
|
||||||
|
int n;
|
||||||
|
|
||||||
auto it = sockets.begin();
|
auto it = sockets.begin();
|
||||||
|
outer:
|
||||||
while (it != sockets.end()) {
|
while (it != sockets.end()) {
|
||||||
if (!transmit(it, (char*)"begin\n", 6))
|
if (!transmit(it, (char*)"begin\n", 6))
|
||||||
continue;
|
continue;
|
||||||
@ -97,12 +99,12 @@ void Monitor::tick(CNServer *serv, time_t delta) {
|
|||||||
if (pair.second->hidden)
|
if (pair.second->hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int n = std::snprintf(buff, sizeof(buff), "player %d %d %s\n",
|
n = std::snprintf(buff, sizeof(buff), "player %d %d %s\n",
|
||||||
pair.second->x, pair.second->y,
|
pair.second->x, pair.second->y,
|
||||||
PlayerManager::getPlayerName(pair.second, false).c_str());
|
PlayerManager::getPlayerName(pair.second, false).c_str());
|
||||||
|
|
||||||
if (!transmit(it, buff, n))
|
if (!transmit(it, buff, n))
|
||||||
continue;
|
goto outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transmit(it, (char*)"end\n", 4))
|
if (!transmit(it, (char*)"end\n", 4))
|
||||||
|
Loading…
Reference in New Issue
Block a user