Пример #1
0
void FtpDownloadCleanup(HFTPDL hFtpDl)
{
	if(hFtpDl) 
	{
		PFTPDLCONTEXT pFTPDLContext = (PFTPDLCONTEXT)hFtpDl;
		if(pFTPDLContext->remoteUrl) 
		{
			free(pFTPDLContext->remoteUrl);
			pFTPDLContext->remoteUrl = NULL;
		}
		if(pFTPDLContext->localFile)
		{
			free(pFTPDLContext->localFile);
			pFTPDLContext->localFile = NULL;
		}
		if(pFTPDLContext->dlInfoGetThreadRunning)
		{
			pFTPDLContext->dlInfoGetThreadRunning = 0;
			if(pFTPDLContext->dlInfoGetThreadHanle)
			{
				app_os_thread_join(pFTPDLContext->dlInfoGetThreadHanle);
				pFTPDLContext->dlInfoGetThreadHanle = NULL;
			}
		}
		if(pFTPDLContext->hCurl)
		{
			curl_easy_cleanup(pFTPDLContext->hCurl);
		}
	}
	if(IsCurlGlobalInit)
	{
		curl_global_cleanup();
		IsCurlGlobalInit = false;
	}
}
Пример #2
0
/* **************************************************************************************
 *  Function Name: Handler_Stop
 *  Description: Stop the handler
 *  Input :  None
 *  Output: None
 *  Return:  0  : Success Init Handler
 *              -1 : Fail Init Handler
 * ***************************************************************************************/
int HANDLER_API Handler_Stop( void )
{
	if(g_HandlerContex.isThreadRunning == true)
	{
		g_HandlerContex.isThreadRunning = false;
		app_os_thread_join(g_HandlerContex.threadHandler);
		g_HandlerContex.threadHandler = NULL;
	}
	g_status = handler_status_stop;
	return handler_success;
}
Пример #3
0
void SAMANAGER_API SAManager_Uninitialize()
{
	struct samanager_topic_entry *iter_topic = NULL;
	struct samanager_topic_entry *tmp_topic = NULL;

	if(g_statethreadctx.isThreadRunning == true)
	{
		g_statethreadctx.isThreadRunning = false;
		app_os_thread_join(g_statethreadctx.threadHandler);
		g_statethreadctx.threadHandler = NULL;
	}

	if(g_statethreadctx.msgqueue)
	{
		queue_uninit(g_statethreadctx.msgqueue);
		free(g_statethreadctx.msgqueue);
		g_statethreadctx.msgqueue = NULL;
	}

	/*Release Handler Loader*/	
	if(g_SALoader)
	{
//#ifdef WIN32
		keepalive_uninitialize();
//#endif
		if(g_SALoader->Loader_ConcurrentReleaseAllHandler_API)
			g_SALoader->Loader_ConcurrentReleaseAllHandler_API(&g_handlerList);
		if(g_SALoader->Loader_Uninitialize_API)
			g_SALoader->Loader_Uninitialize_API();
		dl_CleanupSALoaderLib(g_SALoader);
		free(g_SALoader);
		g_SALoader = NULL;
	}
	
	if(g_SAGeneral)
	{
		dl_CleanupSAGeneralLib(g_SAGeneral);
		free(g_SAGeneral);
		g_SAGeneral = NULL;

		app_os_sleep(500);
	}
	
	iter_topic = samanager_Topic_FirstTopic();
	while(iter_topic != NULL)
	{
		tmp_topic = iter_topic->next;
		samanager_Topic_RemoveTopic(iter_topic->name);
		iter_topic = tmp_topic;
	}
}