Removed rdp disconnect, using unified abortEvent instead.

This commit is contained in:
Armin Novak 2015-09-05 14:57:30 +02:00
parent 893e7a35a8
commit 188fe4ed2b
8 changed files with 16 additions and 22 deletions

View File

@ -318,7 +318,7 @@ BOOL rdp_recv_deactivate_all(rdpRdp* rdp, wStream* s)
if (rdp_check_fds(rdp) < 0) if (rdp_check_fds(rdp) < 0)
return FALSE; return FALSE;
if (rdp->disconnect) if (freerdp_shall_disconnect(rdp->instance))
break; break;
} }

View File

@ -3540,7 +3540,7 @@ BOOL rdp_recv_get_active_header(rdpRdp* rdp, wStream* s, UINT16* pChannelId)
if (!rdp_read_header(rdp, s, &length, pChannelId)) if (!rdp_read_header(rdp, s, &length, pChannelId))
return FALSE; return FALSE;
if (rdp->disconnect) if (freerdp_shall_disconnect(rdp->instance))
return TRUE; return TRUE;
if (rdp->settings->UseRdpSecurityLayer) if (rdp->settings->UseRdpSecurityLayer)
@ -3585,7 +3585,7 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s)
if (!rdp_recv_get_active_header(rdp, s, &channelId)) if (!rdp_recv_get_active_header(rdp, s, &channelId))
return FALSE; return FALSE;
if (rdp->disconnect) if (freerdp_shall_disconnect(rdp->instance))
return TRUE; return TRUE;
if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource))

View File

@ -188,6 +188,8 @@ BOOL rdp_client_connect(rdpRdp* rdp)
if (!rdp->settingsCopy) if (!rdp->settingsCopy)
return FALSE; return FALSE;
ResetEvent(rdp->context->abortEvent);
nego_init(rdp->nego); nego_init(rdp->nego);
nego_set_target(rdp->nego, settings->ServerHostname, settings->ServerPort); nego_set_target(rdp->nego, settings->ServerHostname, settings->ServerPort);
@ -832,7 +834,7 @@ int rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s)
return rdp_recv_out_of_sequence_pdu(rdp, s); return rdp_recv_out_of_sequence_pdu(rdp, s);
} }
if (rdp->disconnect) if (freerdp_shall_disconnect(rdp->instance))
return 0; return 0;
if (!rdp_send_confirm_active(rdp)) if (!rdp_send_confirm_active(rdp))

View File

@ -74,11 +74,6 @@ BOOL freerdp_connect(freerdp* instance)
rdp = instance->context->rdp; rdp = instance->context->rdp;
settings = instance->settings; settings = instance->settings;
if (rdp)
rdp->disconnect = FALSE;
ResetEvent(instance->context->abortEvent);
instance->context->codecs = codecs_new(instance->context); instance->context->codecs = codecs_new(instance->context);
IFCALLRET(instance->PreConnect, status, instance); IFCALLRET(instance->PreConnect, status, instance);
@ -192,9 +187,6 @@ BOOL freerdp_abort_connect(freerdp* instance)
if (!instance || !instance->context) if (!instance || !instance->context)
return FALSE; return FALSE;
if (instance->context->rdp)
instance->context->rdp->disconnect = TRUE;
return SetEvent(instance->context->abortEvent); return SetEvent(instance->context->abortEvent);
} }
@ -392,9 +384,11 @@ BOOL freerdp_reconnect(freerdp* instance)
BOOL freerdp_shall_disconnect(freerdp* instance) BOOL freerdp_shall_disconnect(freerdp* instance)
{ {
if (!instance || !instance->context || !instance->context->rdp) if (!instance || !instance->context)
return FALSE; return FALSE;
return instance->context->rdp->disconnect; if (WaitForSingleObject(instance->context->abortEvent, 0) != WAIT_OBJECT_0)
return FALSE;
return TRUE;
} }
FREERDP_API BOOL freerdp_focus_required(freerdp* instance) FREERDP_API BOOL freerdp_focus_required(freerdp* instance)

View File

@ -340,7 +340,7 @@ int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment)
rpc->result = *((UINT32*) &buffer[StubOffset]); rpc->result = *((UINT32*) &buffer[StubOffset]);
rpc->context->rdp->disconnect = TRUE; freerdp_abort_connect(rpc->context->instance);
rpc->transport->tsg->state = TSG_STATE_TUNNEL_CLOSE_PENDING; rpc->transport->tsg->state = TSG_STATE_TUNNEL_CLOSE_PENDING;
EventArgsInit(&e, "freerdp"); EventArgsInit(&e, "freerdp");
e.code = 0; e.code = 0;

View File

@ -356,7 +356,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
return -1; return -1;
} }
if (rdp->disconnect) if (freerdp_shall_disconnect(rdp->instance))
return 0; return 0;
if (rdp->settings->UseRdpSecurityLayer) if (rdp->settings->UseRdpSecurityLayer)

View File

@ -307,7 +307,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
{ {
if (code == X224_TPDU_DISCONNECT_REQUEST) if (code == X224_TPDU_DISCONNECT_REQUEST)
{ {
rdp->disconnect = TRUE; freerdp_abort_connect(rdp->instance);
return TRUE; return TRUE;
} }
@ -341,7 +341,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
if (!rdp->instance) if (!rdp->instance)
{ {
rdp->disconnect = TRUE; freerdp_abort_connect(rdp->instance);
return FALSE; return FALSE;
} }
@ -364,7 +364,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
} }
WLog_ERR(TAG, "DisconnectProviderUltimatum: reason: %d", reason); WLog_ERR(TAG, "DisconnectProviderUltimatum: reason: %d", reason);
rdp->disconnect = TRUE; freerdp_abort_connect(rdp->instance);
EventArgsInit(&e, "freerdp"); EventArgsInit(&e, "freerdp");
e.code = 0; e.code = 0;
@ -1117,7 +1117,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
return -1; return -1;
} }
if (rdp->disconnect) if (freerdp_shall_disconnect(rdp->instance))
return 0; return 0;
if (rdp->autodetect->bandwidthMeasureStarted) if (rdp->autodetect->bandwidthMeasureStarted)
@ -1647,7 +1647,6 @@ void rdp_reset(rdpRdp* rdp)
rdp->nego = nego_new(rdp->transport); rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport); rdp->mcs = mcs_new(rdp->transport);
rdp->transport->layer = TRANSPORT_LAYER_TCP; rdp->transport->layer = TRANSPORT_LAYER_TCP;
rdp->disconnect = FALSE;
rdp->errorInfo = 0; rdp->errorInfo = 0;
rdp->deactivation_reactivation = 0; rdp->deactivation_reactivation = 0;
rdp->finalize_sc_pdus = 0; rdp->finalize_sc_pdus = 0;

View File

@ -171,7 +171,6 @@ struct rdp_rdp
BYTE fips_decrypt_key[24]; BYTE fips_decrypt_key[24];
UINT32 errorInfo; UINT32 errorInfo;
UINT32 finalize_sc_pdus; UINT32 finalize_sc_pdus;
BOOL disconnect;
BOOL resendFocus; BOOL resendFocus;
BOOL deactivation_reactivation; BOOL deactivation_reactivation;
BOOL AwaitCapabilities; BOOL AwaitCapabilities;