PROXY_API void PMC_API uninit_proxy()
{
	g_InitLock.Lock();

	g_iInitCount--;
	
	if(g_iInitCount){
		g_InitLock.UnLock();
		return;
	}

	if(g_Worker){
		if(g_Worker->stop(3000)){
			delete g_Worker;
		}		
		g_Worker = 0;
	}

	stop_dispatcher();
	uninit_network();
	uninit_rtdb();
	unhook_rtdb_events(&g_DBDispatchTable);

	g_iInitFlag = 0;
		
	g_InitLock.UnLock();

	delete _g_InitLock;
	_g_InitLock = 0;
}
Beispiel #2
0
LIBHISPROXY_API void PMC_API uninitHisProxy()
{
	if(cache){
		delete cache;
		cache = 0;
	}
	uninitArchiveCache();
	uninit_network();
}
Beispiel #3
0
int main()
{
	int ret=init_network();
	if( ret!=0 )
	{
		LLOG(L_ERROR, "init_network error. ");
		return -1;
	}
	
	Spider_Config::instance().load();
	Spider_Seed spider_seed;
	if( 0!=spider_seed.load() )
	{
		return -1;
	}
	
	Spider_Cookie::instance().login();
	Spider_Storage::instance().initialize();
	Spider_Executor::instance().initialize();
	Spider_Url_Rinse::instance().initialize();

	while(true)
	{
		Seed* seed=NULL;
		std::string site_name;
		spider_seed.get_seed(site_name,&seed);
		if ( seed!=NULL )
		{
            LLOG(L_DEBUG, "load seed %s", site_name.c_str());
			Spider_WebSite* website=Spider_WebSite_Factory::create_website(site_name);
			website->initialize(site_name.c_str(), seed);
			website->begin_process();  //处理seed节点
		}
		else
		{
			LLOG(L_DEBUG, "load all seed.");
			break;
		}
		Sleep(1000); //1s
	}
	
	Spider_Executor::instance().execute_loop(); //循环等待完成
	
	Spider_Url_Rinse::instance().uninitialize();
	Spider_Executor::instance().uninitialize();
	Spider_Storage::instance().uninitialize();
	uninit_network();
	return 0;
};
Beispiel #4
0
KPROXY_API void kproxy_uninit()
{
	uninit_blklib();
	uninit_network();
	
	if(proxy_adapter){
		on_offline(0, 0);
		delete_adapter(proxy_adapter);
		proxy_adapter = 0;
	}
	if(x_buffer){
		__free__(x_buffer);
		x_buffer = 0;
	}
	
	ex_uninit();
}
Beispiel #5
0
bool CRtkService::_uninit()
{
	bool is_server;

	is_server = get_power_state()==PWR_RUNNING? true : false;

	utils_trace("Please stand-by ...\n");		
	
	switch_to_backup();

	uninit_ioss();
	utils_trace("IO subsystem stopped.\n");
	destroy_rtdb();
	utils_trace("Realtime Database Subsystem closed.\n");	
#ifdef _WIN32
	uninit_spac();
#endif
	utils_trace("IO Subsystem closed.\n");

	if(is_server){
		if(!bring_up_backups()){
			offline_broadcast();
		}
	}
	
	unregister_power_callback(power_state_changed, 0);

	uninit_network();
	utils_trace("Networking subsystem closed.\n");

	utils_trace("%s stopped.\n",  versionString.c_str());

	uninit_config();
	uninit_server_shell();
	
	return true;
}