don't check the timeout if we're sending/receiving

(fixes bug #10530: Ping timeout and multiplayer scenario interaction.)
This commit is contained in:
Gunter Labes 2008-01-07 18:19:41 +00:00
parent 8b01a311d2
commit b5c00cc185
3 changed files with 12 additions and 2 deletions

View File

@ -665,9 +665,12 @@ connection receive_data(config& cfg, connection connection_num)
}
TCPsocket sock = connection_num == 0 ? 0 : get_socket(connection_num);
TCPsocket s = sock;
sock = network_worker_pool::get_received_data(sock,cfg);
if(sock == NULL) {
if(last_ping != 0 && ping_timeout != 0 && !is_server() ) {
if (last_ping != 0 && ping_timeout != 0 && !is_server()
&& !network_worker_pool::is_locked(s))
{
check_timeout();
}
return 0;

View File

@ -633,6 +633,13 @@ static void remove_buffers(TCPsocket sock)
} // anonymous namespace
bool is_locked(const TCPsocket sock) {
const threading::lock lock(*global_mutex);
const socket_state_map::iterator lock_it = sockets_locked.find(sock);
if (lock_it == sockets_locked.end()) return false;
return (lock_it->second == SOCKET_LOCKED);
}
bool close_socket(TCPsocket sock, bool force)
{
const threading::lock lock(*global_mutex);

View File

@ -42,7 +42,7 @@ void receive_data(TCPsocket sock);
TCPsocket get_received_data(TCPsocket sock, config& cfg);
void queue_data(TCPsocket sock, const config& buf, const bool gzipped);
bool socket_locked(TCPsocket sock);
bool is_locked(const TCPsocket sock);
bool close_socket(TCPsocket sock, bool force=false);
std::pair<unsigned int,size_t> thread_state();
TCPsocket detect_error();