Skip to content

Commit da9796c

Browse files
committed
JSON output: check for server acceptor stop request at start of loop.
This prevents clients from infinitely stalling the acceptor thread by continuously opening new connections.
1 parent 2f7c94f commit da9796c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/plugins/output/json/src/Server.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Server::thread_accept(void *context)
184184

185185
IPX_CTX_INFO(acc->ctx, "(Server output) Waiting for connections...", '\0');
186186

187-
while(1) {
187+
while(!acc->stop) {
188188
struct sockaddr_storage client_addr;
189189
socklen_t sin_size = sizeof(client_addr);
190190
int new_fd;
@@ -209,10 +209,6 @@ Server::thread_accept(void *context)
209209

210210
if (!FD_ISSET(acc->socket_fd, &rfds)) {
211211
// Timeout
212-
if (acc->stop) {
213-
// End thread
214-
break;
215-
}
216212
continue;
217213
}
218214

0 commit comments

Comments
 (0)