Fixed rdp_reset error handling

This commit is contained in:
Armin Novak 2021-09-07 10:03:36 +02:00 committed by akallabeth
parent 680dc81bad
commit 56648a98f2
3 changed files with 17 additions and 8 deletions

View File

@ -391,7 +391,9 @@ BOOL rdp_client_disconnect(rdpRdp* rdp)
if (!nego_disconnect(rdp->nego)) if (!nego_disconnect(rdp->nego))
return FALSE; return FALSE;
rdp_reset(rdp); if (!rdp_reset(rdp))
return FALSE;
rdp_client_transition_to_state(rdp, CONNECTION_STATE_INITIAL); rdp_client_transition_to_state(rdp, CONNECTION_STATE_INITIAL);
if (freerdp_channels_disconnect(context->channels, context->instance) != CHANNEL_RC_OK) if (freerdp_channels_disconnect(context->channels, context->instance) != CHANNEL_RC_OK)

View File

@ -1894,7 +1894,7 @@ fail:
return NULL; return NULL;
} }
void rdp_reset(rdpRdp* rdp) BOOL rdp_reset(rdpRdp* rdp)
{ {
rdpContext* context; rdpContext* context;
rdpSettings* settings; rdpSettings* settings;
@ -1950,17 +1950,24 @@ void rdp_reset(rdpRdp* rdp)
license_free(rdp->license); license_free(rdp->license);
transport_free(rdp->transport); transport_free(rdp->transport);
fastpath_free(rdp->fastpath); fastpath_free(rdp->fastpath);
rdp->transport = transport_new(context); rdp->transport = transport_new(context);
if (rdp->io && rdp->transport) if (rdp->transport)
transport_set_io_callbacks(rdp->transport, rdp->io); {
if (rdp->io)
transport_set_io_callbacks(rdp->transport, rdp->io);
rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport);
transport_set_layer(rdp->transport, TRANSPORT_LAYER_TCP);
}
rdp->license = license_new(rdp); rdp->license = license_new(rdp);
rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport);
rdp->fastpath = fastpath_new(rdp); rdp->fastpath = fastpath_new(rdp);
transport_set_layer(rdp->transport, TRANSPORT_LAYER_TCP);
rdp->errorInfo = 0; rdp->errorInfo = 0;
rdp->deactivation_reactivation = 0; rdp->deactivation_reactivation = 0;
rdp->finalize_sc_pdus = 0; rdp->finalize_sc_pdus = 0;
return rdp->transport && rdp->nego && rdp->mcs && rdp->fastpath && rdp->license;
} }
/** /**

View File

@ -224,7 +224,7 @@ FREERDP_LOCAL int rdp_recv_callback(rdpTransport* transport, wStream* s, void* e
FREERDP_LOCAL int rdp_check_fds(rdpRdp* rdp); FREERDP_LOCAL int rdp_check_fds(rdpRdp* rdp);
FREERDP_LOCAL rdpRdp* rdp_new(rdpContext* context); FREERDP_LOCAL rdpRdp* rdp_new(rdpContext* context);
FREERDP_LOCAL void rdp_reset(rdpRdp* rdp); FREERDP_LOCAL BOOL rdp_reset(rdpRdp* rdp);
FREERDP_LOCAL void rdp_free(rdpRdp* rdp); FREERDP_LOCAL void rdp_free(rdpRdp* rdp);
FREERDP_LOCAL const rdpTransportIo* rdp_get_io_callbacks(rdpRdp* rdp); FREERDP_LOCAL const rdpTransportIo* rdp_get_io_callbacks(rdpRdp* rdp);