[core,server] add state STATE_RUN_QUIT_SESSION

If a session is terminated indicate this by STATE_RUN_QUIT_SESSION
instead of setting STATE_RUN_FAILED which would imply some failure
This commit is contained in:
akallabeth 2023-01-26 14:51:09 +01:00 committed by Martin Fleisz
parent b03f9cc8b8
commit 1a87ba8fc2
3 changed files with 18 additions and 2 deletions

View File

@ -385,7 +385,8 @@ static state_run_t peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 t
case DATA_PDU_TYPE_SHUTDOWN_REQUEST:
mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs);
return STATE_RUN_FAILED;
WLog_WARN(TAG, "disconnect provider ultimatum sent to peer, closing connection");
return STATE_RUN_QUIT_SESSION;
case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE:
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
@ -759,6 +760,7 @@ static state_run_t rdp_peer_handle_state_active(freerdp_peer* client)
}
if (!client->connected)
{
WLog_ERR(TAG, "PostConnect for peer %p failed", client);
ret = STATE_RUN_FAILED;
}
else if (!client->activated)
@ -772,7 +774,10 @@ static state_run_t rdp_peer_handle_state_active(freerdp_peer* client)
IFCALLRET(client->Activate, activated, client);
if (!activated)
{
WLog_ERR(TAG, "Activate for peer %p failed", client);
ret = STATE_RUN_FAILED;
}
else
ret = STATE_RUN_SUCCESS;
}

View File

@ -25,7 +25,14 @@
BOOL state_run_failed(state_run_t status)
{
return status == STATE_RUN_FAILED;
switch (status)
{
case STATE_RUN_FAILED:
case STATE_RUN_QUIT_SESSION:
return TRUE;
default:
return FALSE;
}
}
BOOL state_run_success(state_run_t status)
@ -53,6 +60,9 @@ const char* state_run_result_string(state_run_t status, char* buffer, size_t buf
case STATE_RUN_FAILED:
name = "STATE_RUN_FAILED";
break;
case STATE_RUN_QUIT_SESSION:
name = "STATE_RUN_QUIT_SESSION";
break;
case STATE_RUN_TRY_AGAIN:
name = "STATE_RUN_TRY_AGAIN";
break;

View File

@ -31,6 +31,7 @@ typedef enum
STATE_RUN_REDIRECT = 1,
STATE_RUN_SUCCESS = 0,
STATE_RUN_FAILED = -1,
STATE_RUN_QUIT_SESSION = -2,
STATE_RUN_TRY_AGAIN = -23,
STATE_RUN_CONTINUE = -24
} state_run_t;