1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Try to fix an rare infinite loop

This commit is contained in:
Nicolas Viennot 2016-03-27 13:08:05 -04:00
parent 5d830993d7
commit 55c8c19f67

View File

@ -214,6 +214,18 @@ server_loop(void)
server_client_loop(); server_client_loop();
#ifdef TMATE_SLAVE #ifdef TMATE_SLAVE
if (!ssh_is_connected(tmate_session->ssh_client.session) &&
!tmate_server_request_exit) {
/*
* Sometimes, the ssh socket gets closed for some unknown reason,
* and we don't detect it. This in turn make the event loop poll()
* return POLLNVAL, which is not handled by libevent.
* This causes an infinite loop.
* The following check is a workaround to avoid the infinite loop.
*/
tmate_fatal("SSH socket not connected, but socket close wasn't detected");
}
if (!tmate_server_request_exit) if (!tmate_server_request_exit)
return 0; return 0;
#else #else