Fixed missing state machine rerun trigger

When changing the peer state return 1 to indicate a rerun is
required.
This commit is contained in:
Armin Novak 2022-11-09 16:08:01 +01:00 committed by Martin Fleisz
parent 12f0e996c0
commit 98cf410144

View File

@ -322,7 +322,7 @@ static BOOL freerdp_peer_check_fds(freerdp_peer* peer)
return TRUE; return TRUE;
} }
static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 totalLength) static int peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 totalLength)
{ {
BYTE type; BYTE type;
UINT16 length; UINT16 length;
@ -342,7 +342,7 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 totalLen
if (!rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type, if (!rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type,
&compressed_len)) &compressed_len))
return FALSE; return -1;
#ifdef WITH_DEBUG_RDP #ifdef WITH_DEBUG_RDP
WLog_DBG(TAG, "recv %s Data PDU (0x%02" PRIX8 "), length: %" PRIu16 "", WLog_DBG(TAG, "recv %s Data PDU (0x%02" PRIX8 "), length: %" PRIu16 "",
@ -353,40 +353,40 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 totalLen
{ {
case DATA_PDU_TYPE_SYNCHRONIZE: case DATA_PDU_TYPE_SYNCHRONIZE:
if (!rdp_recv_client_synchronize_pdu(client->context->rdp, s)) if (!rdp_recv_client_synchronize_pdu(client->context->rdp, s))
return FALSE; return -1;
break; break;
case DATA_PDU_TYPE_CONTROL: case DATA_PDU_TYPE_CONTROL:
if (!rdp_server_accept_client_control_pdu(client->context->rdp, s)) if (!rdp_server_accept_client_control_pdu(client->context->rdp, s))
return FALSE; return -1;
break; break;
case DATA_PDU_TYPE_INPUT: case DATA_PDU_TYPE_INPUT:
if (!input_recv(client->context->rdp->input, s)) if (!input_recv(client->context->rdp->input, s))
return FALSE; return -1;
break; break;
case DATA_PDU_TYPE_BITMAP_CACHE_PERSISTENT_LIST: case DATA_PDU_TYPE_BITMAP_CACHE_PERSISTENT_LIST:
if (!rdp_server_accept_client_persistent_key_list_pdu(client->context->rdp, s)) if (!rdp_server_accept_client_persistent_key_list_pdu(client->context->rdp, s))
return FALSE; return -1;
break; break;
case DATA_PDU_TYPE_FONT_LIST: case DATA_PDU_TYPE_FONT_LIST:
if (!rdp_server_accept_client_font_list_pdu(client->context->rdp, s)) if (!rdp_server_accept_client_font_list_pdu(client->context->rdp, s))
return FALSE; return -1;
break; return 1; // State changed, trigger rerun
case DATA_PDU_TYPE_SHUTDOWN_REQUEST: case DATA_PDU_TYPE_SHUTDOWN_REQUEST:
mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs); mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs);
return FALSE; return -1;
case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE: case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE:
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4)) if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
return FALSE; return -1;
Stream_Read_UINT32(s, client->ack_frame_id); Stream_Read_UINT32(s, client->ack_frame_id);
IFCALL(update->SurfaceFrameAcknowledge, update->context, client->ack_frame_id); IFCALL(update->SurfaceFrameAcknowledge, update->context, client->ack_frame_id);
@ -394,13 +394,13 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 totalLen
case DATA_PDU_TYPE_REFRESH_RECT: case DATA_PDU_TYPE_REFRESH_RECT:
if (!update_read_refresh_rect(update, s)) if (!update_read_refresh_rect(update, s))
return FALSE; return -1;
break; break;
case DATA_PDU_TYPE_SUPPRESS_OUTPUT: case DATA_PDU_TYPE_SUPPRESS_OUTPUT:
if (!update_read_suppress_output(update, s)) if (!update_read_suppress_output(update, s))
return FALSE; return -1;
break; break;
@ -409,7 +409,7 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 totalLen
break; break;
} }
return TRUE; return 0;
} }
static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s) static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
@ -472,10 +472,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
switch (pduType) switch (pduType)
{ {
case PDU_TYPE_DATA: case PDU_TYPE_DATA:
if (!peer_recv_data_pdu(client, s, pduLength)) return peer_recv_data_pdu(client, s, pduLength);
return -1;
break;
case PDU_TYPE_CONFIRM_ACTIVE: case PDU_TYPE_CONFIRM_ACTIVE:
if (!rdp_server_accept_confirm_active(rdp, s, pduLength)) if (!rdp_server_accept_confirm_active(rdp, s, pduLength))