#include "activation.h"
#include "display.h"
+#define TAG FREERDP_TAG("core.activation")
+
/*
static const char* const CTRLACTION_STRINGS[] =
{
BOOL rdp_recv_deactivate_all(rdpRdp* rdp, wStream* s)
{
UINT16 lengthSourceDescriptor;
+ UINT32 timeout;
if (rdp->state == CONNECTION_STATE_ACTIVE)
rdp->deactivation_reactivation = TRUE;
rdp_client_transition_to_state(rdp, CONNECTION_STATE_CAPABILITIES_EXCHANGE);
- while (rdp->state != CONNECTION_STATE_ACTIVE)
+ for (timeout = 0; timeout < rdp->settings->TcpAckTimeout; timeout += 100)
{
if (rdp_check_fds(rdp) < 0)
return FALSE;
if (freerdp_shall_disconnect(rdp->instance))
- break;
+ return TRUE;
- SwitchToThread();
+ if (rdp->state == CONNECTION_STATE_ACTIVE)
+ return TRUE;
+
+ Sleep(100);
}
- return TRUE;
+ WLog_ERR(TAG, "Timeout waiting for activation");
+ return FALSE;
}
BOOL rdp_send_deactivate_all(rdpRdp* rdp)
/* make sure SSL is initialize for earlier enough for crypto, by taking advantage of winpr SSL
* FIPS flag for openssl initialization */
DWORD flags = WINPR_SSL_INIT_DEFAULT;
+ UINT32 timeout;
if (!rdp_client_reset_codecs(rdp->context))
return FALSE;
return FALSE;
}
- while (rdp->state != CONNECTION_STATE_ACTIVE)
+ for (timeout = 0; timeout < settings->TcpAckTimeout; timeout += 100)
{
if (rdp_check_fds(rdp) < 0)
{
freerdp_set_last_error_if_not(rdp->context, FREERDP_ERROR_CONNECT_TRANSPORT_FAILED);
-
return FALSE;
}
- SwitchToThread();
+
+ if (rdp->state == CONNECTION_STATE_ACTIVE)
+ return TRUE;
+
+ Sleep(100);
}
- return TRUE;
+ WLog_ERR(TAG, "Timeout waiting for activation");
+ return FALSE;
}
BOOL rdp_client_disconnect(rdpRdp* rdp)