static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr) { int i; IWTSPlugin* pPlugin; DVCMAN_LISTENER* listener; DVCMAN* dvcman = (DVCMAN*) pChannelMgr; UINT error; ArrayList_Free(dvcman->channels); for (i = 0; i < dvcman->num_listeners; i++) { listener = (DVCMAN_LISTENER*) dvcman->listeners[i]; free(listener->channel_name); free(listener); } dvcman->num_listeners = 0; for (i = 0; i < dvcman->num_plugins; i++) { pPlugin = dvcman->plugins[i]; if (pPlugin->Terminated) if ((error = pPlugin->Terminated(pPlugin))) WLog_Print(drdynvc->log, WLOG_ERROR, "Terminated failed with error %"PRIu32"!", error); } dvcman->num_plugins = 0; StreamPool_Free(dvcman->pool); free(dvcman); }
void transport_free(rdpTransport* transport) { if (transport != NULL) { SetEvent(transport->stopEvent); if (transport->ReceiveBuffer) Stream_Release(transport->ReceiveBuffer); StreamPool_Free(transport->ReceivePool); CloseHandle(transport->ReceiveEvent); CloseHandle(transport->connectedEvent); if (transport->TlsIn) tls_free(transport->TlsIn); if (transport->TlsOut != transport->TlsIn) tls_free(transport->TlsOut); tcp_free(transport->TcpIn); if (transport->TcpOut != transport->TcpIn) tcp_free(transport->TcpOut); tsg_free(transport->tsg); CloseHandle(transport->ReadMutex); CloseHandle(transport->WriteMutex); free(transport); } }
void transport_free(rdpTransport* transport) { if (transport != NULL) { if (transport->ReceiveBuffer) Stream_Release(transport->ReceiveBuffer); if (transport->ReceiveStream) Stream_Release(transport->ReceiveStream); StreamPool_Free(transport->ReceivePool); Stream_Free(transport->SendStream, TRUE); CloseHandle(transport->ReceiveEvent); CloseHandle(transport->connectedEvent); if (transport->TlsIn) tls_free(transport->TlsIn); if (transport->TlsOut != transport->TlsIn) tls_free(transport->TlsOut); tcp_free(transport->TcpIn); if (transport->TcpOut != transport->TcpIn) tcp_free(transport->TcpOut); tsg_free(transport->tsg); free(transport); } }
void transport_free(rdpTransport* transport) { if (transport) { if (transport->async) { if (transport->stopEvent) { SetEvent(transport->stopEvent); WaitForSingleObject(transport->thread, INFINITE); CloseHandle(transport->thread); CloseHandle(transport->stopEvent); transport->thread = NULL; transport->stopEvent = NULL; } } if (transport->ReceiveBuffer) Stream_Release(transport->ReceiveBuffer); StreamPool_Free(transport->ReceivePool); CloseHandle(transport->ReceiveEvent); CloseHandle(transport->connectedEvent); if (transport->TlsIn) tls_free(transport->TlsIn); if (transport->TlsOut != transport->TlsIn) tls_free(transport->TlsOut); transport->TlsIn = NULL; transport->TlsOut = NULL; if (transport->TcpIn) tcp_free(transport->TcpIn); if (transport->TcpOut != transport->TcpIn) tcp_free(transport->TcpOut); transport->TcpIn = NULL; transport->TcpOut = NULL; tsg_free(transport->tsg); transport->tsg = NULL; DeleteCriticalSection(&(transport->ReadLock)); DeleteCriticalSection(&(transport->WriteLock)); free(transport); } }
rdpTransport* transport_new(rdpContext* context) { rdpTransport* transport; transport = (rdpTransport*) calloc(1, sizeof(rdpTransport)); if (!transport) return NULL; transport->context = context; transport->settings = context->settings; transport->ReceivePool = StreamPool_New(TRUE, BUFFER_SIZE); if (!transport->ReceivePool) goto out_free_transport; /* receive buffer for non-blocking read. */ transport->ReceiveBuffer = StreamPool_Take(transport->ReceivePool, 0); if (!transport->ReceiveBuffer) goto out_free_receivepool; transport->connectedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!transport->connectedEvent || transport->connectedEvent == INVALID_HANDLE_VALUE) goto out_free_receivebuffer; transport->blocking = TRUE; transport->GatewayEnabled = FALSE; transport->layer = TRANSPORT_LAYER_TCP; if (!InitializeCriticalSectionAndSpinCount(&(transport->ReadLock), 4000)) goto out_free_connectedEvent; if (!InitializeCriticalSectionAndSpinCount(&(transport->WriteLock), 4000)) goto out_free_readlock; return transport; out_free_readlock: DeleteCriticalSection(&(transport->ReadLock)); out_free_connectedEvent: CloseHandle(transport->connectedEvent); out_free_receivebuffer: StreamPool_Return(transport->ReceivePool, transport->ReceiveBuffer); out_free_receivepool: StreamPool_Free(transport->ReceivePool); out_free_transport: free(transport); return NULL; }
void transport_free(rdpTransport* transport) { if (!transport) return; transport_disconnect(transport); if (transport->ReceiveBuffer) Stream_Release(transport->ReceiveBuffer); StreamPool_Free(transport->ReceivePool); CloseHandle(transport->connectedEvent); DeleteCriticalSection(&(transport->ReadLock)); DeleteCriticalSection(&(transport->WriteLock)); free(transport); }
void transport_free(rdpTransport* transport) { if (transport) { if (transport->async) { assert(!transport->thread); assert(!transport->stopEvent); } if (transport->ReceiveBuffer) Stream_Release(transport->ReceiveBuffer); StreamPool_Free(transport->ReceivePool); CloseHandle(transport->ReceiveEvent); CloseHandle(transport->connectedEvent); if (transport->TlsIn) tls_free(transport->TlsIn); if (transport->TlsOut != transport->TlsIn) tls_free(transport->TlsOut); transport->TlsIn = NULL; transport->TlsOut = NULL; if (transport->TcpIn) tcp_free(transport->TcpIn); if (transport->TcpOut != transport->TcpIn) tcp_free(transport->TcpOut); transport->TcpIn = NULL; transport->TcpOut = NULL; tsg_free(transport->tsg); transport->tsg = NULL; CloseHandle(transport->ReadMutex); CloseHandle(transport->WriteMutex); free(transport); } }
void transport_free(rdpTransport* transport) { if (!transport) return; transport_stop(transport); if (transport->ReceiveBuffer) Stream_Release(transport->ReceiveBuffer); StreamPool_Free(transport->ReceivePool); CloseHandle(transport->ReceiveEvent); CloseHandle(transport->connectedEvent); if (transport->TlsIn) tls_free(transport->TlsIn); if (transport->TlsOut != transport->TlsIn) tls_free(transport->TlsOut); transport->TlsIn = NULL; transport->TlsOut = NULL; if (transport->TcpIn) tcp_free(transport->TcpIn); if (transport->TcpOut != transport->TcpIn) tcp_free(transport->TcpOut); transport->TcpIn = NULL; transport->TcpOut = NULL; tsg_free(transport->tsg); transport->tsg = NULL; DeleteCriticalSection(&(transport->ReadLock)); DeleteCriticalSection(&(transport->WriteLock)); free(transport); }
void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) { int i; int count; IWTSPlugin* pPlugin; DVCMAN_LISTENER* listener; DVCMAN_CHANNEL* channel; DVCMAN* dvcman = (DVCMAN*) pChannelMgr; ArrayList_Lock(dvcman->channels); count = ArrayList_Count(dvcman->channels); for (i = 0; i < count; i++) { channel = (DVCMAN_CHANNEL*) ArrayList_GetItem(dvcman->channels, i); dvcman_channel_free(channel); } ArrayList_Unlock(dvcman->channels); ArrayList_Free(dvcman->channels); for (i = 0; i < dvcman->num_listeners; i++) { listener = (DVCMAN_LISTENER*) dvcman->listeners[i]; free(listener->channel_name); free(listener); } for (i = 0; i < dvcman->num_plugins; i++) { pPlugin = dvcman->plugins[i]; if (pPlugin->Terminated) pPlugin->Terminated(pPlugin); } StreamPool_Free(dvcman->pool); free(dvcman); }
rdpTransport* transport_new(rdpSettings* settings) { rdpTransport* transport; transport = (rdpTransport *)calloc(1, sizeof(rdpTransport)); if (!transport) return NULL; WLog_Init(); transport->log = WLog_Get("com.freerdp.core.transport"); if (!transport->log) goto out_free; transport->TcpIn = tcp_new(settings); if (!transport->TcpIn) goto out_free; transport->settings = settings; /* a small 0.1ms delay when transport is blocking. */ transport->SleepInterval = 100; transport->ReceivePool = StreamPool_New(TRUE, BUFFER_SIZE); if (!transport->ReceivePool) goto out_free_tcpin; /* receive buffer for non-blocking read. */ transport->ReceiveBuffer = StreamPool_Take(transport->ReceivePool, 0); if (!transport->ReceiveBuffer) goto out_free_receivepool; transport->ReceiveEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!transport->ReceiveEvent || transport->ReceiveEvent == INVALID_HANDLE_VALUE) goto out_free_receivebuffer; transport->connectedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!transport->connectedEvent || transport->connectedEvent == INVALID_HANDLE_VALUE) goto out_free_receiveEvent; transport->blocking = TRUE; transport->GatewayEnabled = FALSE; transport->layer = TRANSPORT_LAYER_TCP; if (!InitializeCriticalSectionAndSpinCount(&(transport->ReadLock), 4000)) goto out_free_connectedEvent; if (!InitializeCriticalSectionAndSpinCount(&(transport->WriteLock), 4000)) goto out_free_readlock; return transport; out_free_readlock: DeleteCriticalSection(&(transport->ReadLock)); out_free_connectedEvent: CloseHandle(transport->connectedEvent); out_free_receiveEvent: CloseHandle(transport->ReceiveEvent); out_free_receivebuffer: StreamPool_Return(transport->ReceivePool, transport->ReceiveBuffer); out_free_receivepool: StreamPool_Free(transport->ReceivePool); out_free_tcpin: tcp_free(transport->TcpIn); out_free: free(transport); return NULL; }