AudinALSADevice* alsa = (AudinALSADevice*) arg;
DWORD status;
DEBUG_DVC("in");
- freerdp_channel_init_thread_context(alsa->rdpcontext);
+
rbytes_per_frame = alsa->actual_channels * alsa->bytes_per_channel;
tbytes_per_frame = alsa->target_channels * alsa->bytes_per_channel;
buffer = (BYTE*) calloc(1, rbytes_per_frame * alsa->frames_per_packet);
goto err_out;
}
- freerdp_channel_init_thread_context(oss->rdpcontext);
-
if (oss->dev_unit != -1)
{
sprintf_s(dev_name, (PATH_MAX - 1), "/dev/dsp%i", oss->dev_unit);
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
- freerdp_channel_init_thread_context(audin->context.rdpcontext);
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualEventHandle, &buffer,
&BytesReturned) == TRUE)
wMessage message;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(cliprdr->context->rdpcontext);
while (1)
{
CliprdrServerContext* context = (CliprdrServerContext*) arg;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
UINT error;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
ChannelEvent = context->GetEventHandle(context);
nCount = 0;
events[nCount++] = cliprdr->StopEvent;
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
s = Stream_New(NULL, 4096);
if (!s)
wMessage message;
DRIVE_DEVICE* drive = (DRIVE_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(drive->rdpcontext);
while (1)
{
echo_server* echo = (echo_server*) arg;
UINT error;
DWORD status;
- freerdp_channel_init_thread_context(echo->context.rdpcontext);
if ((error = echo_server_open_channel(echo)))
{
wMessage message;
encomspPlugin* encomsp = (encomspPlugin*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(encomsp->rdpcontext);
+
encomsp_process_connect(encomsp);
while (1)
UINT error = CHANNEL_RC_OK;
DWORD status;
context = (EncomspServerContext*) arg;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
wMessage message;
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(parallel->rdpcontext);
while (1)
{
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) arg;
HANDLE obj[] = {printer_dev->event, printer_dev->stopEvent};
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(printer_dev->rdpcontext);
while (1)
{
wMessage message;
railPlugin* rail = (railPlugin*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(rail->rdpcontext);
while (1)
{
UINT error = 0;
DWORD status;
rdpdr = (rdpdrPlugin*) arg;
- freerdp_channel_init_thread_context(rdpdr->rdpcontext);
if (!(rdpdr->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
return NULL;
}
- freerdp_channel_init_thread_context(rdpdr->rdpcontext);
-
if ((error = rdpdr_process_connect(rdpdr)))
{
WLog_ERR(TAG, "rdpdr_process_connect failed with error %lu!", error);
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
s = Stream_New(NULL, 4096);
if (!s)
RdpeiClientContext* context = (RdpeiClientContext*) rdpei->iface.pInterface;
HANDLE hdl[] = {rdpei->event, rdpei->stopEvent};
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(rdpei->rdpcontext);
if (!rdpei)
{
buffer = NULL;
BytesReturned = 0;
nCount = 0;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
events[nCount++] = priv->stopEvent;
events[nCount++] = priv->channelEvent;
HANDLE events[2];
UINT error = CHANNEL_RC_OK;
DWORD status;
- freerdp_channel_init_thread_context(rdpsnd->rdpcontext);
+
events[0] = MessageQueue_Event(rdpsnd->MsgPipe->Out);
events[1] = rdpsnd->stopEvent;
wMessage message;
rdpsndPlugin* rdpsnd = (rdpsndPlugin*) arg;
UINT error;
- freerdp_channel_init_thread_context(rdpsnd->rdpcontext);
if ((error = rdpsnd_process_connect(rdpsnd)))
{
RdpsndServerContext* context;
UINT error = CHANNEL_RC_OK;
context = (RdpsndServerContext*)arg;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
nCount = 0;
events[nCount++] = context->priv->channelEvent;
events[nCount++] = context->priv->StopEvent;
wMessage message;
remdeskPlugin* remdesk = (remdeskPlugin*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(remdesk->rdpcontext);
+
remdesk_process_connect(remdesk);
while (1)
RemdeskServerContext* context;
UINT error;
context = (RemdeskServerContext*) arg;
- freerdp_channel_init_thread_context(context->rdpcontext);
+
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
{
IRP_THREAD_DATA* data = (IRP_THREAD_DATA*)arg;
UINT error;
- freerdp_channel_init_thread_context(data->serial->rdpcontext);
/* blocks until the end of the request */
if ((error = serial_process_irp(data->serial, data->irp)))
wMessage message;
SERIAL_DEVICE* serial = (SERIAL_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(serial->rdpcontext);
while (1)
{
SMARTCARD_OPERATION* operation;
UINT error = CHANNEL_RC_OK;
smartcard = pContext->smartcard;
- freerdp_channel_init_thread_context(smartcard->rdpcontext);
+
nCount = 0;
hEvents[nCount++] = MessageQueue_Event(pContext->IrpQueue);
wMessage message;
SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
- freerdp_channel_init_thread_context(smartcard->rdpcontext);
+
nCount = 0;
hEvents[nCount++] = MessageQueue_Event(smartcard->IrpQueue);
hEvents[nCount++] = Queue_Event(smartcard->CompletedIrpQueue);
TSMF_STREAM* stream = (TSMF_STREAM*) arg;
UINT error = CHANNEL_RC_OK;
DEBUG_TSMF("in %d", stream->stream_id);
- freerdp_channel_init_thread_context(stream->rdpcontext);
+
hdl[0] = stream->stopEvent;
hdl[1] = Queue_Event(stream->sample_ack_list);
UINT error = CHANNEL_RC_OK;
DWORD status;
DEBUG_TSMF("in %d", stream->stream_id);
- freerdp_channel_init_thread_context(stream->rdpcontext);
if (stream->major_type == TSMF_MAJOR_TYPE_AUDIO &&
stream->sample_rate && stream->channels && stream->bits_per_sample)
FREERDP_API BOOL freerdp_disconnect(freerdp* instance);
FREERDP_API BOOL freerdp_reconnect(freerdp* instance);
-FREERDP_API void freerdp_channel_init_thread_context(rdpContext* context);
-FREERDP_API freerdp* freerdp_channel_get_instance(void);
-FREERDP_API rdpContext* freerdp_channel_get_context(void);
-
FREERDP_API UINT freerdp_channel_add_init_handle_data(rdpChannelHandles* handles, void* pInitHandle, void* pUserData);
FREERDP_API void* freerdp_channel_get_init_handle_data(rdpChannelHandles* handles, void* pInitHandle);
FREERDP_API void freerdp_channel_remove_init_handle_data(rdpChannelHandles* handles, void* pInitHandle);
/* connectErrorCode is 'extern' in error.h. See comment there.*/
-/* Thread local storage variables.
- * They need to be initialized in every thread that
- * has to use them. */
-static WINPR_TLS rdpContext* s_TLSContext = NULL;
-
-void freerdp_channel_init_thread_context(rdpContext* context)
-{
- s_TLSContext = context;
-}
-
-freerdp* freerdp_channel_get_instance(void)
-{
- if (!s_TLSContext)
- {
- WLog_ERR(TAG,
- "Funcion was called from thread that did not call freerdp_channel_init_thread_context");
- winpr_log_backtrace(TAG, WLOG_ERROR, 20);
- return NULL;
- }
-
- return s_TLSContext->instance;
-}
-
-rdpContext* freerdp_channel_get_context(void)
-{
- return s_TLSContext;
-}
-
UINT freerdp_channel_add_init_handle_data(rdpChannelHandles* handles, void* pInitHandle, void* pUserData)
{
if (!handles->init)
if (!instance)
return FALSE;
- freerdp_channel_init_thread_context(instance->context);
/* We always set the return code to 0 before we start the connect sequence*/
connectErrorCode = 0;
freerdp_set_last_error(instance->context, FREERDP_ERROR_SUCCESS);