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

Avoid disconnection warning if fin packet is received

This commit is contained in:
Nicolas Viennot 2019-10-05 04:11:32 -04:00
parent 9df2e6d6fb
commit 2bd232c982
3 changed files with 11 additions and 1 deletions

View File

@ -404,6 +404,7 @@ static void tmate_write_copy_mode(__unused struct tmate_session *session,
static void tmate_fin(__unused struct tmate_session *session,
__unused struct tmate_unpacker *uk)
{
session->fin_received = true;
request_server_termination();
}

View File

@ -342,8 +342,16 @@ static void on_websocket_encoder_write(void *userdata, struct evbuffer *buffer)
static void on_websocket_event_default(__unused struct tmate_session *session, short events)
{
if (events & BEV_EVENT_EOF)
if (events & BEV_EVENT_EOF) {
if (session->fin_received) {
/*
* This is expected. The websocket will close the
* connection upon receiving the fin message.
*/
exit(0);
}
tmate_fatal("Connection to websocket server closed");
}
if (events & BEV_EVENT_ERROR)
tmate_fatal("Connection to websocket server error: %s",

View File

@ -246,6 +246,7 @@ struct tmate_session {
const char *client_version;
int client_protocol_version;
struct event ev_notify_timer;
bool fin_received;
int websocket_fd;
struct bufferevent *bev_websocket;