* Check the connection's state, i.e. is the connection still up? */
| 38 | * Check the connection's state, i.e. is the connection still up? |
| 39 | */ |
| 40 | bool QueryNetworkGameSocketHandler::CheckConnection() |
| 41 | { |
| 42 | std::chrono::steady_clock::duration lag = std::chrono::steady_clock::now() - this->last_packet; |
| 43 | |
| 44 | /* If there was no response in 5 seconds, terminate the query. */ |
| 45 | if (lag > std::chrono::seconds(5)) { |
| 46 | Debug(net, 0, "Timeout while waiting for response from {}", this->connection_string); |
| 47 | this->CloseConnection(NETWORK_RECV_STATUS_CONNECTION_LOST); |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Check whether we received/can send some data from/to the server and |
no test coverage detected