예제 #1
0
/**
 * Destroy the given control point
 *
 * @param ctrlPoint The control point struct to destroy
 */
void cg_upnp_controlpoint_delete(CgUpnpControlPoint *ctrlPoint)
{
	cg_log_debug_l4("Entering...\n");

	cg_upnp_controlpoint_stop(ctrlPoint);
	
	/* Delete cached interfaces */
	cg_net_interfacelist_delete(ctrlPoint->ifCache);
	
	/* Delete expiration handlers */
	cg_thread_delete(ctrlPoint->expThread);
	cg_mutex_delete(ctrlPoint->expMutex);
	cg_cond_delete(ctrlPoint->expCond);
	
	/* Delete others */
	cg_mutex_delete(ctrlPoint->mutex);
	cg_xml_nodelist_delete(ctrlPoint->deviceRootNodeList);
	cg_upnp_devicelist_delete(ctrlPoint->deviceList);
	cg_upnp_ssdp_serverlist_delete(ctrlPoint->ssdpServerList);
	cg_upnp_ssdpresponse_serverlist_delete(ctrlPoint->ssdpResServerList);
	cg_http_serverlist_delete(ctrlPoint->httpServerList);
	cg_string_delete(ctrlPoint->httpEventURI);
	cg_upnp_eventlistenerlist_delete(ctrlPoint->eventListeners);	

#ifdef CG_HTTP_USE_PERSISTENT_CONNECTIONS	
	cg_http_persistentconnection_clear();
#endif
	free(ctrlPoint);

	cg_log_debug_l4("Leaving...\n");
}
예제 #2
0
void cg_upnpav_dmr_delete(CgUpnpAvRenderer* dmr)
{
  if (dmr == NULL)
    return;

  if (dmr->mutex)
    cg_mutex_delete(dmr->mutex);

  if (dmr->protocolInfoList)
    cg_upnpav_protocolinfolist_delete(dmr->protocolInfoList);

  cg_upnp_device_delete(dmr->dev);

  free(dmr);
}
예제 #3
0
void cg_http_server_delete(CgHttpServer *httpServer)
{
	cg_log_debug_l4("Entering...\n");

	cg_http_server_stop(httpServer);
	cg_http_server_close(httpServer);

	if (httpServer->mutex)
		cg_mutex_delete(httpServer->mutex);

	cg_list_remove((CgList *)httpServer);

	free(httpServer);

	cg_log_debug_l4("Leaving...\n");
}
void cg_http_persistentconnection_clear(void)
{
	cg_log_debug_l4("Entering...\n");

       /* If we dont have cache, then just exit */
       if (cache == NULL) return;

       cg_http_persistentconnection_lock();
       cg_list_clear((CgList*)cache, (CG_LIST_DESTRUCTORFUNC)cg_http_persistentconnection_delete);
       free(cache);
       cache = NULL;
       cg_http_persistentconnection_unlock();

       cg_mutex_delete(persistent_connection_mutex);
       persistent_connection_mutex = NULL;

	cg_log_debug_l4("Leaving...\n");
}
BOOL cg_http_persistentconnection_init(void)
{
	cg_log_debug_l4("Entering...\n");

       if (cache == NULL)
       {
               persistent_connection_mutex = cg_mutex_new();

               if (persistent_connection_mutex == NULL)
               {
                       return FALSE;
               }

               cg_http_persistentconnection_lock();
               cache = (CgHttpPersistentConnectionList *)malloc(sizeof(CgHttpPersistentConnectionList));

               if (cache == NULL)
               {
                       if (persistent_connection_mutex != NULL)
                       {
                               cg_http_persistentconnection_unlock();
                               cg_mutex_delete(persistent_connection_mutex);
                               persistent_connection_mutex = NULL;
                       }
                       return FALSE;
               }

               cg_list_header_init((CgList *)cache);

               cache->host = NULL;
               cache->port = 0;
               cache->cacheData = NULL;

               cache->timestamp = 0;

               cg_http_persistentconnection_unlock();
       }

       return TRUE;

	cg_log_debug_l4("Leaving...\n");
}
void cg_upnpav_dms_delete(CgUpnpAvServer *dms)
{
    if (dms == NULL)
        return;

    if (dms->rootContent)
        cg_upnpav_content_delete(dms->rootContent);

    if (dms->mutex)
        cg_mutex_delete(dms->mutex);

    if (dms->protocolInfoList)
        cg_upnpav_protocolinfolist_delete(dms->protocolInfoList);

    if (dms->networkInterfaceList)
        cg_net_interfacelist_delete(dms->networkInterfaceList);

    cg_upnp_device_delete(dms->dev);

    free(dms);
}
예제 #7
0
void cg_bittorrent_client_delete(CgBittorrentClient *cbc)
{
	if (!cbc)
		return;

	cg_bittorrent_client_stop(cbc);
	cg_bittorrent_client_clean(cbc);

	/* Mutex */
	if (cbc->mutex)
		cg_mutex_delete(cbc->mutex);

	/* Socket Server */
	if (cbc->serverSock)
		cg_socket_delete(cbc->serverSock );

	/* HTTP Server */
	if (cbc->httpServer)
		cg_http_server_delete(cbc->httpServer);

	free(cbc);
}