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:
parent
9df2e6d6fb
commit
2bd232c982
@ -404,6 +404,7 @@ static void tmate_write_copy_mode(__unused struct tmate_session *session,
|
|||||||
static void tmate_fin(__unused struct tmate_session *session,
|
static void tmate_fin(__unused struct tmate_session *session,
|
||||||
__unused struct tmate_unpacker *uk)
|
__unused struct tmate_unpacker *uk)
|
||||||
{
|
{
|
||||||
|
session->fin_received = true;
|
||||||
request_server_termination();
|
request_server_termination();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
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");
|
tmate_fatal("Connection to websocket server closed");
|
||||||
|
}
|
||||||
|
|
||||||
if (events & BEV_EVENT_ERROR)
|
if (events & BEV_EVENT_ERROR)
|
||||||
tmate_fatal("Connection to websocket server error: %s",
|
tmate_fatal("Connection to websocket server error: %s",
|
||||||
|
1
tmate.h
1
tmate.h
@ -246,6 +246,7 @@ struct tmate_session {
|
|||||||
const char *client_version;
|
const char *client_version;
|
||||||
int client_protocol_version;
|
int client_protocol_version;
|
||||||
struct event ev_notify_timer;
|
struct event ev_notify_timer;
|
||||||
|
bool fin_received;
|
||||||
|
|
||||||
int websocket_fd;
|
int websocket_fd;
|
||||||
struct bufferevent *bev_websocket;
|
struct bufferevent *bev_websocket;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user