| 5973 | } |
| 5974 | |
| 5975 | inline void ClientImpl::close_socket(Socket& socket) { |
| 5976 | // If there are requests in flight in another thread, usually closing |
| 5977 | // the socket will be fine and they will simply receive an error when |
| 5978 | // using the closed socket, but it is still a bug since rarely the OS |
| 5979 | // may reassign the socket id to be used for a new socket, and then |
| 5980 | // suddenly they will be operating on a live socket that is different |
| 5981 | // than the one they intended! |
| 5982 | assert(socket_requests_in_flight_ == 0 || |
| 5983 | socket_requests_are_from_thread_ == std::this_thread::get_id()); |
| 5984 | |
| 5985 | // It is also a bug if this happens while SSL is still active |
| 5986 | #ifdef CPPHTTPLIB_OPENSSL_SUPPORT |
| 5987 | assert(socket.ssl == nullptr); |
| 5988 | #endif |
| 5989 | if (socket.sock == INVALID_SOCKET) { return; } |
| 5990 | detail::close_socket(socket.sock); |
| 5991 | socket.sock = INVALID_SOCKET; |
| 5992 | } |
| 5993 | |
| 5994 | inline bool ClientImpl::read_response_line(Stream& strm, const Request& req, |
| 5995 | Response& res) { |
nothing calls this directly
no test coverage detected