Moved pubSub to rdpRdp
This commit is contained in:
parent
72fcbc59d8
commit
d0ae1c8160
@ -191,7 +191,7 @@ static UINT freerdp_drdynvc_on_channel_connected(DrdynvcClientContext* context,
|
||||
void* pInterface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
ChannelConnectedEventArgs e;
|
||||
ChannelConnectedEventArgs e = { 0 };
|
||||
rdpChannels* channels = (rdpChannels*)context->custom;
|
||||
freerdp* instance = channels->instance;
|
||||
EventArgsInit(&e, "freerdp");
|
||||
@ -210,7 +210,7 @@ static UINT freerdp_drdynvc_on_channel_disconnected(DrdynvcClientContext* contex
|
||||
void* pInterface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
ChannelDisconnectedEventArgs e;
|
||||
ChannelDisconnectedEventArgs e = { 0 };
|
||||
rdpChannels* channels = (rdpChannels*)context->custom;
|
||||
freerdp* instance = channels->instance;
|
||||
EventArgsInit(&e, "freerdp");
|
||||
@ -224,7 +224,7 @@ static UINT freerdp_drdynvc_on_channel_attached(DrdynvcClientContext* context, c
|
||||
void* pInterface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
ChannelAttachedEventArgs e;
|
||||
ChannelAttachedEventArgs e = { 0 };
|
||||
rdpChannels* channels = (rdpChannels*)context->custom;
|
||||
freerdp* instance = channels->instance;
|
||||
EventArgsInit(&e, "freerdp");
|
||||
@ -238,7 +238,7 @@ static UINT freerdp_drdynvc_on_channel_detached(DrdynvcClientContext* context, c
|
||||
void* pInterface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
ChannelDetachedEventArgs e;
|
||||
ChannelDetachedEventArgs e = { 0 };
|
||||
rdpChannels* channels = (rdpChannels*)context->custom;
|
||||
freerdp* instance = channels->instance;
|
||||
EventArgsInit(&e, "freerdp");
|
||||
|
@ -1191,7 +1191,7 @@ int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
|
||||
EventArgsInit(&activatedEvent, "libfreerdp");
|
||||
activatedEvent.firstActivation =
|
||||
!rdp_finalize_is_flag_set(rdp, FINALIZE_DEACTIVATE_REACTIVATE);
|
||||
PubSub_OnActivated(context->pubSub, context, &activatedEvent);
|
||||
PubSub_OnActivated(rdp->pubSub, context, &activatedEvent);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1206,7 +1206,7 @@ int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
|
||||
EventArgsInit(&stateEvent, "libfreerdp");
|
||||
stateEvent.state = rdp_get_state(rdp);
|
||||
stateEvent.active = rdp_get_state(rdp) == CONNECTION_STATE_ACTIVE;
|
||||
PubSub_OnConnectionStateChange(context->pubSub, context, &stateEvent);
|
||||
PubSub_OnConnectionStateChange(rdp->pubSub, context, &stateEvent);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -239,7 +239,7 @@ BOOL freerdp_connect(freerdp* instance)
|
||||
freerdp_connect_finally:
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.result = status ? 0 : -1;
|
||||
PubSub_OnConnectionResult(instance->context->pubSub, instance->context, &e);
|
||||
PubSub_OnConnectionResult(rdp->pubSub, instance->context, &e);
|
||||
|
||||
if (!status)
|
||||
freerdp_disconnect(instance);
|
||||
@ -305,7 +305,7 @@ BOOL freerdp_check_fds(freerdp* instance)
|
||||
WLog_DBG(TAG, "rdp_check_fds() - %i", status);
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.code = 0;
|
||||
PubSub_OnTerminate(context->pubSub, context, &e);
|
||||
PubSub_OnTerminate(rdp->pubSub, context, &e);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -675,12 +675,7 @@ BOOL freerdp_context_new_ex(freerdp* instance, rdpSettings* settings)
|
||||
context->instance = instance;
|
||||
context->ServerMode = FALSE;
|
||||
context->disconnectUltimatum = 0;
|
||||
context->pubSub = PubSub_New(TRUE);
|
||||
|
||||
if (!context->pubSub)
|
||||
goto fail;
|
||||
|
||||
PubSub_AddEventTypes(context->pubSub, FreeRDP_Events, ARRAYSIZE(FreeRDP_Events));
|
||||
context->metrics = metrics_new(context);
|
||||
|
||||
if (!context->metrics)
|
||||
@ -692,6 +687,13 @@ BOOL freerdp_context_new_ex(freerdp* instance, rdpSettings* settings)
|
||||
goto fail;
|
||||
|
||||
context->rdp = rdp;
|
||||
context->pubSub = rdp->pubSub;
|
||||
|
||||
if (!context->pubSub)
|
||||
goto fail;
|
||||
|
||||
PubSub_AddEventTypes(rdp->pubSub, FreeRDP_Events, ARRAYSIZE(FreeRDP_Events));
|
||||
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
instance->input = rdp->input;
|
||||
instance->update = rdp->update;
|
||||
@ -769,9 +771,6 @@ void freerdp_context_free(freerdp* instance)
|
||||
graphics_free(ctx->graphics);
|
||||
ctx->graphics = NULL;
|
||||
|
||||
PubSub_Free(ctx->pubSub);
|
||||
ctx->pubSub = NULL;
|
||||
|
||||
metrics_free(ctx->metrics);
|
||||
ctx->metrics = NULL;
|
||||
|
||||
|
@ -365,7 +365,7 @@ static int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment)
|
||||
tsg_set_state(tsg, TSG_STATE_TUNNEL_CLOSE_PENDING);
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.code = 0;
|
||||
PubSub_OnTerminate(context->pubSub, context, &e);
|
||||
PubSub_OnTerminate(context->rdp->pubSub, context, &e);
|
||||
rc = 0;
|
||||
goto success;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ BOOL rdp_set_error_info(rdpRdp* rdp, UINT32 errorInfo)
|
||||
|
||||
if (context->pubSub)
|
||||
{
|
||||
ErrorInfoEventArgs e;
|
||||
ErrorInfoEventArgs e = { 0 };
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.code = rdp->errorInfo;
|
||||
PubSub_OnErrorInfo(context->pubSub, context, &e);
|
||||
@ -507,7 +507,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
|
||||
if (MCSPDU == DomainMCSPDU_DisconnectProviderUltimatum)
|
||||
{
|
||||
int reason = 0;
|
||||
TerminateEventArgs e;
|
||||
TerminateEventArgs e = { 0 };
|
||||
rdpContext* context;
|
||||
|
||||
if (!mcs_recv_disconnect_provider_ultimatum(rdp->mcs, s, &reason))
|
||||
@ -535,7 +535,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
|
||||
utils_abort_connect(rdp);
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.code = 0;
|
||||
PubSub_OnTerminate(context->pubSub, context, &e);
|
||||
PubSub_OnTerminate(rdp->pubSub, context, &e);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1981,6 +1981,10 @@ rdpRdp* rdp_new(rdpContext* context)
|
||||
if (!rdp->bulk)
|
||||
goto fail;
|
||||
|
||||
rdp->pubSub = PubSub_New(TRUE);
|
||||
if (!rdp->pubSub)
|
||||
goto fail;
|
||||
|
||||
rdp->abortEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if (!rdp->abortEvent)
|
||||
goto fail;
|
||||
@ -2110,6 +2114,7 @@ void rdp_free(rdpRdp* rdp)
|
||||
multitransport_free(rdp->multitransport);
|
||||
bulk_free(rdp->bulk);
|
||||
free(rdp->io);
|
||||
PubSub_Free(rdp->pubSub);
|
||||
if (rdp->abortEvent)
|
||||
CloseHandle(rdp->abortEvent);
|
||||
free(rdp);
|
||||
|
@ -201,6 +201,7 @@ struct rdp_rdp
|
||||
rdpTransportIo* io;
|
||||
void* ioContext;
|
||||
HANDLE abortEvent;
|
||||
wPubSub* pubSub;
|
||||
};
|
||||
|
||||
FREERDP_LOCAL BOOL rdp_read_security_header(wStream* s, UINT16* flags, UINT16* length);
|
||||
|
Loading…
Reference in New Issue
Block a user