MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / UniqueSocket

Class UniqueSocket

app/server/http.cpp:102–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 if (rc != 0) {
101 throw std::runtime_error("WSAStartup failed: " + std::to_string(rc));
102 }
103#endif
104 }
105
106 ~SocketRuntime() {
107#ifdef _WIN32
108 WSACleanup();
109#endif
110 }
111};
112
113void close_socket(SocketHandle socket) {
114 if (socket == kInvalidSocket) {
115 return;
116 }
117#ifdef _WIN32
118 closesocket(socket);
119#else
120 close(socket);
121#endif
122}
123
124class UniqueSocket {
125public:
126 UniqueSocket() = default;
127 explicit UniqueSocket(SocketHandle socket)
128 : socket_(socket) {}
129 UniqueSocket(const UniqueSocket &) = delete;
130 UniqueSocket & operator=(const UniqueSocket &) = delete;

Callers

nothing calls this directly

Calls 1

close_socketFunction · 0.85

Tested by

no test coverage detected