2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* "$Id: p3face-config.cc,v 1.4 2007-05-05 16:10:05 rmf24 Exp $"
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* Copyright 2004-2006 by Robert Fernie.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "rsserver/p3face.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
2010-01-13 15:56:55 -05:00
|
|
|
#include "pqi/authssl.h"
|
2010-01-13 16:22:52 -05:00
|
|
|
#include "pqi/authgpg.h"
|
2010-08-06 05:40:23 -04:00
|
|
|
#include "retroshare/rsinit.h"
|
2012-08-02 09:17:53 -04:00
|
|
|
#include "plugins/pluginmanager.h"
|
2008-07-10 12:29:18 -04:00
|
|
|
#include "util/rsdebug.h"
|
2018-09-19 16:02:07 -04:00
|
|
|
|
|
|
|
#ifdef RS_JSONAPI
|
|
|
|
# include "jsonapi/jsonapi.h"
|
|
|
|
#endif // ifdef RS_JSONAPI
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
#include "pqi/p3peermgr.h"
|
|
|
|
#include "pqi/p3netmgr.h"
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2012-12-16 10:04:52 -05:00
|
|
|
// TO SHUTDOWN THREADS.
|
|
|
|
#ifdef RS_ENABLE_GXS
|
|
|
|
|
2016-10-09 08:32:52 -04:00
|
|
|
#include "services/autoproxy/rsautoproxymonitor.h"
|
|
|
|
|
2012-12-16 10:04:52 -05:00
|
|
|
#include "services/p3idservice.h"
|
|
|
|
#include "services/p3gxscircles.h"
|
|
|
|
#include "services/p3wiki.h"
|
|
|
|
#include "services/p3posted.h"
|
|
|
|
#include "services/p3photoservice.h"
|
|
|
|
#include "services/p3gxsforums.h"
|
2013-03-04 15:26:48 -05:00
|
|
|
#include "services/p3gxschannels.h"
|
2012-12-16 10:04:52 -05:00
|
|
|
#include "services/p3wire.h"
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/****************************************/
|
|
|
|
/* RsIface Config */
|
|
|
|
/* Config */
|
|
|
|
|
2016-12-03 14:04:25 -05:00
|
|
|
void RsServer::ConfigFinalSave()
|
2008-02-07 11:18:34 -05:00
|
|
|
{
|
2016-12-03 14:04:25 -05:00
|
|
|
//TODO: force saving of transfers
|
2008-11-02 06:38:11 -05:00
|
|
|
//ftserver->saveFileTransferStatus();
|
2008-02-08 07:39:40 -05:00
|
|
|
|
2016-12-03 14:04:25 -05:00
|
|
|
#ifdef RS_AUTOLOGIN
|
|
|
|
if(!RsInit::getAutoLogin()) RsInit::RsClearAutoLogin();
|
|
|
|
#endif // RS_AUTOLOGIN
|
|
|
|
|
|
|
|
//AuthSSL::getAuthSSL()->FinalSaveCertificates();
|
2008-02-07 11:18:34 -05:00
|
|
|
mConfigMgr->completeConfiguration();
|
|
|
|
}
|
|
|
|
|
2016-06-01 10:47:21 -04:00
|
|
|
void RsServer::startServiceThread(RsTickingThread *t, const std::string &threadName)
|
2014-12-21 15:52:34 -05:00
|
|
|
{
|
2016-06-01 10:47:21 -04:00
|
|
|
t->start(threadName) ;
|
2014-12-21 15:52:34 -05:00
|
|
|
mRegisteredServiceThreads.push_back(t) ;
|
|
|
|
}
|
|
|
|
|
2008-04-06 16:57:36 -04:00
|
|
|
void RsServer::rsGlobalShutDown()
|
|
|
|
{
|
2018-08-30 13:06:20 -04:00
|
|
|
coreReady = false;
|
2010-05-08 12:10:34 -04:00
|
|
|
// TODO: cache should also clean up old files
|
2010-12-18 14:35:07 -05:00
|
|
|
|
2008-04-06 16:57:36 -04:00
|
|
|
ConfigFinalSave(); // save configuration before exit
|
2014-01-02 12:13:41 -05:00
|
|
|
|
2015-06-16 10:20:59 -04:00
|
|
|
mPluginsManager->stopPlugins(pqih);
|
2014-01-02 12:13:41 -05:00
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
mNetMgr->shutdown(); /* Handles UPnP */
|
2008-04-09 08:54:15 -04:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
#ifdef RS_JSONAPI
|
|
|
|
if(jsonApiServer) jsonApiServer->shutdown();
|
|
|
|
#endif
|
|
|
|
|
2016-10-09 08:32:52 -04:00
|
|
|
rsAutoProxyMonitor::instance()->stopAllRSShutdown();
|
|
|
|
|
2015-05-22 16:54:38 -04:00
|
|
|
fullstop() ;
|
2010-09-30 15:05:43 -04:00
|
|
|
|
2015-05-22 16:54:38 -04:00
|
|
|
// kill all registered service threads
|
2014-12-21 15:52:34 -05:00
|
|
|
|
2015-05-22 16:54:38 -04:00
|
|
|
for(std::list<RsTickingThread*>::iterator it= mRegisteredServiceThreads.begin();it!=mRegisteredServiceThreads.end();++it)
|
2014-12-21 15:52:34 -05:00
|
|
|
{
|
2015-05-22 16:54:38 -04:00
|
|
|
(*it)->fullstop() ;
|
2014-12-21 15:52:34 -05:00
|
|
|
}
|
|
|
|
// #ifdef RS_ENABLE_GXS
|
|
|
|
// // We should automate this.
|
|
|
|
// //
|
|
|
|
// if(mGxsCircles) mGxsCircles->join();
|
|
|
|
// if(mGxsForums) mGxsForums->join();
|
|
|
|
// if(mGxsChannels) mGxsChannels->join();
|
|
|
|
// if(mGxsIdService) mGxsIdService->join();
|
|
|
|
// if(mPosted) mPosted->join();
|
|
|
|
// if(mWiki) mWiki->join();
|
|
|
|
// if(mGxsNetService) mGxsNetService->join();
|
|
|
|
// if(mPhoto) mPhoto->join();
|
|
|
|
// if(mWire) mWire->join();
|
|
|
|
// #endif
|
2012-12-11 17:26:11 -05:00
|
|
|
|
2012-06-09 20:29:46 -04:00
|
|
|
AuthGPG::exit();
|
2018-09-19 15:28:26 -04:00
|
|
|
|
|
|
|
mShutdownCallback(0);
|
2010-05-29 11:14:25 -04:00
|
|
|
}
|