Added enum for client connection state.

This commit is contained in:
Armin Novak 2018-06-19 17:28:22 +02:00
parent 9a47ce3f76
commit 35cd438eca
3 changed files with 14 additions and 5 deletions

View File

@ -424,7 +424,7 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
status = rdp_client_connect(rdp);
if (status && (context->instance->ConnectionCallbackState == 2))
if (status && (context->instance->ConnectionCallbackState == CLIENT_STATE_POSTCONNECT_PASSED))
status = (freerdp_channels_post_connect(context->channels, context->instance) == CHANNEL_RC_OK);
return status;
@ -447,7 +447,7 @@ BOOL rdp_client_reconnect(rdpRdp* rdp)
status = rdp_client_connect(rdp);
if (status && (context->instance->ConnectionCallbackState == 2))
if (status && (context->instance->ConnectionCallbackState == CLIENT_STATE_POSTCONNECT_PASSED))
status = (freerdp_channels_post_connect(channels, context->instance) == CHANNEL_RC_OK);
return status;

View File

@ -49,6 +49,14 @@ enum CONNECTION_STATE
CONNECTION_STATE_ACTIVE
};
enum CLIENT_CONNECTION_STATE
{
CLIENT_STATE_INITIAL,
CLIENT_STATE_PRECONNECT_PASSED,
CLIENT_STATE_POSTCONNECT_PASSED,
CLIENT_STATE_POSTDISCONNECT_PASSED
};
FREERDP_LOCAL BOOL rdp_client_connect(rdpRdp* rdp);
FREERDP_LOCAL BOOL rdp_client_disconnect(rdpRdp* rdp);
FREERDP_LOCAL BOOL rdp_client_disconnect_and_clear(rdpRdp* rdp);

View File

@ -157,6 +157,7 @@ BOOL freerdp_connect(freerdp* instance)
return FALSE;
/* We always set the return code to 0 before we start the connect sequence*/
instance->ConnectionCallbackState = CLIENT_STATE_INITIAL;
connectErrorCode = 0;
instance->context->LastError = FREERDP_ERROR_SUCCESS;
clearChannelError(instance->context);
@ -165,7 +166,7 @@ BOOL freerdp_connect(freerdp* instance)
settings = instance->settings;
instance->context->codecs = codecs_new(instance->context);
IFCALLRET(instance->PreConnect, status, instance);
instance->ConnectionCallbackState++;
instance->ConnectionCallbackState = CLIENT_STATE_PRECONNECT_PASSED;
if (status)
status2 = freerdp_channels_pre_connect(instance->context->channels,
@ -213,7 +214,7 @@ BOOL freerdp_connect(freerdp* instance)
}
IFCALLRET(instance->PostConnect, status, instance);
instance->ConnectionCallbackState++;
instance->ConnectionCallbackState = CLIENT_STATE_POSTCONNECT_PASSED;
if (status)
status2 = freerdp_channels_post_connect(instance->context->channels, instance);
@ -503,7 +504,7 @@ BOOL freerdp_disconnect(freerdp* instance)
}
IFCALL(instance->PostDisconnect, instance);
instance->ConnectionCallbackState++;
instance->ConnectionCallbackState = CLIENT_STATE_POSTDISCONNECT_PASSED;
if (instance->update->pcap_rfx)
{