[client] fix connection active checks
* use freerdp_is_active_state for session active checks * fix state transitions
This commit is contained in:
parent
a14c75a3a2
commit
917e392f1e
@ -270,7 +270,7 @@ static BOOL rdp_client_wait_for_activation(rdpRdp* rdp)
|
||||
break;
|
||||
}
|
||||
|
||||
if (rdp_get_state(rdp) > CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE)
|
||||
if (rdp_is_active_state(rdp))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1213,6 +1213,7 @@ state_run_t rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s)
|
||||
|
||||
state_run_t rdp_client_connect_finalize(rdpRdp* rdp)
|
||||
{
|
||||
WINPR_ASSERT(rdp);
|
||||
/**
|
||||
* [MS-RDPBCGR] 1.3.1.1 - 8.
|
||||
* The client-to-server PDUs sent during this phase have no dependencies on any of the
|
||||
@ -1281,7 +1282,7 @@ BOOL rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case CONNECTION_STATE_ACTIVE:
|
||||
case CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE:
|
||||
{
|
||||
ActivatedEventArgs activatedEvent = { 0 };
|
||||
rdpContext* context = rdp->context;
|
||||
@ -1302,7 +1303,7 @@ BOOL rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
|
||||
rdpContext* context = rdp->context;
|
||||
EventArgsInit(&stateEvent, "libfreerdp");
|
||||
stateEvent.state = rdp_get_state(rdp);
|
||||
stateEvent.active = rdp_get_state(rdp) == CONNECTION_STATE_ACTIVE;
|
||||
stateEvent.active = rdp_is_active_state(rdp);
|
||||
PubSub_OnConnectionStateChange(rdp->pubSub, context, &stateEvent);
|
||||
}
|
||||
|
||||
@ -1477,9 +1478,6 @@ BOOL rdp_server_accept_mcs_erect_domain_request(rdpRdp* rdp, wStream* s)
|
||||
|
||||
BOOL rdp_server_accept_mcs_attach_user_request(rdpRdp* rdp, wStream* s)
|
||||
{
|
||||
if (!rdp_server_transition_to_state(rdp, CONNECTION_STATE_MCS_ATTACH_USER))
|
||||
return FALSE;
|
||||
|
||||
if (!mcs_recv_attach_user_request(rdp->mcs, s))
|
||||
return FALSE;
|
||||
|
||||
@ -1664,7 +1662,7 @@ BOOL rdp_server_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
|
||||
if (cstate >= CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT)
|
||||
client = rdp->context->peer;
|
||||
|
||||
if (cstate < CONNECTION_STATE_ACTIVE)
|
||||
if (!rdp_is_active_peer_state(cstate))
|
||||
{
|
||||
if (client)
|
||||
client->activated = FALSE;
|
||||
|
@ -385,7 +385,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
|
||||
|
||||
case FASTPATH_UPDATETYPE_PTR_NULL:
|
||||
{
|
||||
POINTER_SYSTEM_UPDATE pointer_system;
|
||||
POINTER_SYSTEM_UPDATE pointer_system = { 0 };
|
||||
pointer_system.type = SYSPTR_NULL;
|
||||
rc = IFCALLRESULT(defaultReturn, pointer->PointerSystem, context, &pointer_system);
|
||||
}
|
||||
@ -393,7 +393,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
|
||||
|
||||
case FASTPATH_UPDATETYPE_PTR_DEFAULT:
|
||||
{
|
||||
POINTER_SYSTEM_UPDATE pointer_system;
|
||||
POINTER_SYSTEM_UPDATE pointer_system = { 0 };
|
||||
pointer_system.type = SYSPTR_DEFAULT;
|
||||
rc = IFCALLRESULT(defaultReturn, pointer->PointerSystem, context, &pointer_system);
|
||||
}
|
||||
@ -938,7 +938,7 @@ BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, size_t
|
||||
WINPR_ASSERT(rdp);
|
||||
|
||||
state = rdp_get_state(rdp);
|
||||
if (state != CONNECTION_STATE_ACTIVE)
|
||||
if (!rdp_is_active_state(rdp))
|
||||
{
|
||||
WLog_WARN(TAG, "[%s] called before activation [%s]", __FUNCTION__, rdp_state_string(state));
|
||||
goto fail;
|
||||
|
@ -1632,8 +1632,7 @@ static state_run_t rdp_handle_sc_flags(rdpRdp* rdp, wStream* s, UINT32 flag,
|
||||
if (!rdp_client_transition_to_state(rdp, nextState))
|
||||
status = STATE_RUN_FAILED;
|
||||
else
|
||||
status = (rdp_get_state(rdp) == CONNECTION_STATE_ACTIVE) ? STATE_RUN_ACTIVE
|
||||
: STATE_RUN_SUCCESS;
|
||||
status = STATE_RUN_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,14 +105,6 @@ typedef enum
|
||||
FINALIZE_DEACTIVATE_REACTIVATE = 0x200
|
||||
} rdpFinalizePduType;
|
||||
|
||||
#define FINALIZE_SC_COMPLETE \
|
||||
(FINALIZE_SC_SYNCHRONIZE_PDU | FINALIZE_SC_CONTROL_COOPERATE_PDU | \
|
||||
FINALIZE_SC_CONTROL_GRANTED_PDU | FINALIZE_SC_FONT_MAP_PDU)
|
||||
#define FINALIZE_CS_COMPLETE \
|
||||
(FINALIZE_CS_SYNCHRONIZE_PDU | FINALIZE_CS_CONTROL_COOPERATE_PDU | \
|
||||
FINALIZE_CS_CONTROL_REQUEST_PDU | FINALIZE_CS_PERSISTENT_KEY_LIST_PDU | \
|
||||
FINALIZE_CS_FONT_LIST_PDU)
|
||||
|
||||
/* Data PDU Types */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ static BOOL pf_server_check_and_sync_input_state(pClientContext* pc)
|
||||
{
|
||||
WINPR_ASSERT(pc);
|
||||
|
||||
if (freerdp_get_state(&pc->context) < CONNECTION_STATE_ACTIVE)
|
||||
if (!freerdp_is_active_state(&pc->context))
|
||||
return FALSE;
|
||||
if (pc->input_state_sync_pending)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user