MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / Stop

Function Stop

src/platform/linux/http_server.cpp:669–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

667}
668
669void Stop() {
670 g_running = false;
671 if (g_listenFd >= 0) {
672 shutdown(g_listenFd, SHUT_RDWR);
673 close(g_listenFd);
674 g_listenFd = -1;
675 }
676 if (g_serverThread.joinable())
677 g_serverThread.join();
678 {
679 std::lock_guard<std::mutex> lock(g_clientFdMutex);
680 for (int fd : g_clientFds) {
681 shutdown(fd, SHUT_RDWR);
682 }
683 }
684 {
685 std::lock_guard<std::mutex> lock(g_clientMutex);
686 for (auto& client : g_clientThreads) {
687 if (client.thread.joinable()) client.thread.join();
688 }
689 g_clientThreads.clear();
690 }
691 g_port = 0;
692}
693
694uint16_t GetPort() {
695 return g_port;

Callers 1

OnUnloadFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected