| 5875 | } |
| 5876 | |
| 5877 | inline 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 | |
| 5896 | inline bool ClientImpl::read_response_line(Stream &strm, const Request &req, |
| 5897 | Response &res) { |
nothing calls this directly
no test coverage detected