From d5409ed3f103f7f11f4c8f13fd21d80475146846 Mon Sep 17 00:00:00 2001 From: Gent S Date: Tue, 8 Dec 2020 14:05:34 -0500 Subject: [PATCH] Replace bad continue statement with goto in monitor socket iteration --- src/Monitor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Monitor.cpp b/src/Monitor.cpp index 941fc7a..0be3fe4 100644 --- a/src/Monitor.cpp +++ b/src/Monitor.cpp @@ -87,8 +87,10 @@ static bool transmit(std::list::iterator& it, char *buff, int len) { void Monitor::tick(CNServer *serv, time_t delta) { std::lock_guard lock(sockLock); char buff[256]; + int n; auto it = sockets.begin(); + outer: while (it != sockets.end()) { if (!transmit(it, (char*)"begin\n", 6)) continue; @@ -97,12 +99,12 @@ void Monitor::tick(CNServer *serv, time_t delta) { if (pair.second->hidden) 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, PlayerManager::getPlayerName(pair.second, false).c_str()); if (!transmit(it, buff, n)) - continue; + goto outer; } if (!transmit(it, (char*)"end\n", 4))