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

Method close_socket

dependencies/httplib/httplib.h:5877–5894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5875}
5876
5877inline void ClientImpl::close_socket(Socket &socket) {
5878 // If there are requests in flight in another thread, usually closing
5879 // the socket will be fine and they will simply receive an error when
5880 // using the closed socket, but it is still a bug since rarely the OS
5881 // may reassign the socket id to be used for a new socket, and then
5882 // suddenly they will be operating on a live socket that is different
5883 // than the one they intended!
5884 assert(socket_requests_in_flight_ == 0 ||
5885 socket_requests_are_from_thread_ == std::this_thread::get_id());
5886
5887 // It is also a bug if this happens while SSL is still active
5888#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
5889 assert(socket.ssl == nullptr);
5890#endif
5891 if (socket.sock == INVALID_SOCKET) { return; }
5892 detail::close_socket(socket.sock);
5893 socket.sock = INVALID_SOCKET;
5894}
5895
5896inline bool ClientImpl::read_response_line(Stream &strm, const Request &req,
5897 Response &res) {

Callers

nothing calls this directly

Calls 1

close_socketFunction · 0.85

Tested by

no test coverage detected