mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 01:34:38 +00:00
don't check the timeout if we're sending/receiving
(fixes bug #10530: Ping timeout and multiplayer scenario interaction.)
This commit is contained in:
parent
8b01a311d2
commit
b5c00cc185
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user