MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / StopServer

Method StopServer

NetworkServer.cpp:334–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void NetworkServer::StopServer()
335{
336 int curr_socket;
337 server_online = false;
338
339 ServerClientsMutex.lock();
340
341 for(unsigned int client_idx = 0; client_idx < ServerClients.size(); client_idx++)
342 {
343 delete ServerClients[client_idx];
344 }
345
346 ServerClients.clear();
347
348 for(curr_socket = 0; curr_socket < socket_count; curr_socket++)
349 {
350 shutdown(server_sock[curr_socket], SD_RECEIVE);
351 closesocket(server_sock[curr_socket]);
352 }
353
354 ServerClientsMutex.unlock();
355
356 for(curr_socket = 0; curr_socket < socket_count; curr_socket++)
357 {
358 if(ConnectionThread[curr_socket])
359 {
360 delete ConnectionThread[curr_socket];
361 ConnectionThread[curr_socket] = nullptr;
362 }
363 }
364
365 socket_count = 0;
366
367 /*-------------------------------------------------*\
368 | Client info has changed, call the callbacks |
369 \*-------------------------------------------------*/
370 ClientInfoChanged();
371}
372
373void NetworkServer::ConnectionThreadFunction(int socket_idx)
374{

Callers 1

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected