Example #1
0
/**
 * Destroy the given control point
 *
 * @param ctrlPoint The control point struct to destroy
 */
void mupnp_controlpoint_delete(mUpnpControlPoint *ctrlPoint)
{
	mupnp_log_debug_l4("Entering...\n");

	mupnp_controlpoint_stop(ctrlPoint);
	
	/* Delete cached interfaces */
	mupnp_net_interfacelist_delete(ctrlPoint->ifCache);
	
	/* Delete expiration handlers */
	mupnp_thread_delete(ctrlPoint->expThread);
	mupnp_mutex_delete(ctrlPoint->expMutex);
	mupnp_cond_delete(ctrlPoint->expCond);
	
	/* Delete others */
	mupnp_mutex_delete(ctrlPoint->mutex);
	mupnp_xml_nodelist_delete(ctrlPoint->deviceRootNodeList);
	mupnp_devicelist_delete(ctrlPoint->deviceList);
	mupnp_ssdp_serverlist_delete(ctrlPoint->ssdpServerList);
	mupnp_ssdpresponse_serverlist_delete(ctrlPoint->ssdpResServerList);
	mupnp_http_serverlist_delete(ctrlPoint->httpServerList);
	mupnp_string_delete(ctrlPoint->httpEventURI);
	mupnp_eventlistenerlist_delete(ctrlPoint->eventListeners);	

#ifdef MUPNP_HTTP_USE_PERSISTENT_CONNECTIONS	
	mupnp_http_persistentconnection_clear();
#endif
	free(ctrlPoint);

	mupnp_log_debug_l4("Leaving...\n");
}
Example #2
0
void mupnp_upnpav_dmr_delete(mUpnpAvRenderer *dmr)
{
	if (dmr == NULL)
		return;

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

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

	mupnp_device_delete(dmr->dev);

	free(dmr);
}
Example #3
0
void mupnp_http_server_delete(mUpnpHttpServer *httpServer)
{
	mupnp_log_debug_l4("Entering...\n");

	mupnp_http_server_stop(httpServer);
	mupnp_http_server_close(httpServer);

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

	mupnp_list_remove((mUpnpList *)httpServer);

	free(httpServer);

	mupnp_log_debug_l4("Leaving...\n");
}
void mupnp_http_persistentconnection_clear(void)
{
	mupnp_log_debug_l4("Entering...\n");

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

       mupnp_http_persistentconnection_lock();
       mupnp_list_clear((mUpnpList*)cache, (CG_LIST_DESTRUCTORFUNC)mupnp_http_persistentconnection_delete);
       free(cache);
       cache = NULL;
       mupnp_http_persistentconnection_unlock();

       mupnp_mutex_delete(persistent_connection_mutex);
       persistent_connection_mutex = NULL;

	mupnp_log_debug_l4("Leaving...\n");
}
BOOL mupnp_http_persistentconnection_init(void)
{
	mupnp_log_debug_l4("Entering...\n");

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

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

               mupnp_http_persistentconnection_lock();
               cache = (mUpnpHttpPersistentConnectionList *)malloc(sizeof(mUpnpHttpPersistentConnectionList));

               if (cache == NULL)
               {
                       if (persistent_connection_mutex != NULL)
                       {
                               mupnp_http_persistentconnection_unlock();
                               mupnp_mutex_delete(persistent_connection_mutex);
                               persistent_connection_mutex = NULL;
                       }
                       return FALSE;
               }

               mupnp_list_header_init((mUpnpList *)cache);

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

               cache->timestamp = 0;

               mupnp_http_persistentconnection_unlock();
       }

       return TRUE;

	mupnp_log_debug_l4("Leaving...\n");
}
Example #6
0
void mupnp_upnpav_dms_delete(mUpnpAvServer *dms)
{
	if (dms == NULL)
		return;

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

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

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

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

	mupnp_device_delete(dms->dev);

	free(dms);
}