Skip to content

Commit

Permalink
Try to fix an rare infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Mar 27, 2016
1 parent 5d83099 commit 55c8c19
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server.c
Expand Up @@ -214,6 +214,18 @@ server_loop(void)
server_client_loop();

#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)
return 0;
#else
Expand Down

0 comments on commit 55c8c19

Please sign in to comment.