MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / ~TCPServer

Method ~TCPServer

OpenHD/ohd_common/src/openhd_tcp.cpp:43–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43openhd::TCPServer::~TCPServer() {
44 // debug_if("TCPEndpoint::~TCPEndpoint() begin");
45 // First we make sure we don't accept any new connections anymore
46 m_keep_accept_thread_alive = false;
47 shutdown(server_fd, SHUT_RDWR); // This will break out of select
48 m_accept_thread->join();
49 m_accept_thread = nullptr;
50 server_fd = 0;
51 // Then we make sure to clean up any connected client(s) (If there are any)
52 for (const auto& client : m_clients_list) {
53 client->marked_to_be_removed = true;
54 client->keep_rx_looping = false;
55 shutdown(client->sock_fd, SHUT_RDWR);
56 client->rx_loop_thread->join();
57 client->rx_loop_thread = nullptr;
58 }
59 m_console->debug("TCPEndpoint::~TCPEndpoint() end");
60}
61
62void openhd::TCPServer::loop_accept() {
63 struct sockaddr_in sockaddr {};

Callers

nothing calls this directly

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected