End CLI session upon connection closure (#2917)

This commit is contained in:
sauwming 2021-12-15 17:52:28 +08:00 committed by GitHub
parent c6e238d2a3
commit fbfad9fd22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1492,6 +1492,13 @@ static pj_bool_t telnet_sess_on_data_read(pj_activesock_t *asock,
if (tfe->is_quitting)
return PJ_FALSE;
if (status == PJ_EEOF) {
TRACE_((THIS_FILE, "Connection closed"));
if (sess)
pj_cli_sess_end_session(&(sess->base));
return PJ_FALSE;
}
if (status != PJ_SUCCESS && status != PJ_EPENDING) {
TRACE_((THIS_FILE, "Error on data read %d", status));
return PJ_FALSE;