| 6303 | } |
| 6304 | |
| 6305 | inline void ClientImpl::close_socket(Socket &socket) { |
| 6306 | // If there are requests in flight in another thread, usually closing |
| 6307 | // the socket will be fine and they will simply receive an error when |
| 6308 | // using the closed socket, but it is still a bug since rarely the OS |
| 6309 | // may reassign the socket id to be used for a new socket, and then |
| 6310 | // suddenly they will be operating on a live socket that is different |
| 6311 | // than the one they intended! |
| 6312 | assert(socket_requests_in_flight_ == 0 || |
| 6313 | socket_requests_are_from_thread_ == std::this_thread::get_id()); |
| 6314 | |
| 6315 | // It is also a bug if this happens while SSL is still active |
| 6316 | #ifdef CPPHTTPLIB_OPENSSL_SUPPORT |
| 6317 | assert(socket.ssl == nullptr); |
| 6318 | #endif |
| 6319 | if (socket.sock == INVALID_SOCKET) { return; } |
| 6320 | detail::close_socket(socket.sock); |
| 6321 | socket.sock = INVALID_SOCKET; |
| 6322 | } |
| 6323 | |
| 6324 | inline bool ClientImpl::read_response_line(Stream &strm, const Request &req, |
| 6325 | Response &res) { |
nothing calls this directly
no test coverage detected