mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -04:00
made JsonApiServer an singleton through static method instance()
This commit is contained in:
parent
3b45fc5199
commit
d19d1685de
9 changed files with 129 additions and 95 deletions
|
@ -91,7 +91,7 @@ void RsServer::rsGlobalShutDown()
|
|||
mNetMgr->shutdown(); /* Handles UPnP */
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
if(jsonApiServer) jsonApiServer->shutdown();
|
||||
JsonApiServer::instance().shutdown();
|
||||
#endif
|
||||
|
||||
rsAutoProxyMonitor::instance()->stopAllRSShutdown();
|
||||
|
|
|
@ -410,10 +410,8 @@ int RsInit::InitRetroShare(const RsConfigOptions& conf)
|
|||
|
||||
#ifdef RS_JSONAPI
|
||||
if(rsInitConfig->jsonApiPort)
|
||||
{
|
||||
jsonApiServer = new JsonApiServer( rsInitConfig->jsonApiPort, rsInitConfig->jsonApiBindAddress );
|
||||
jsonApiServer->start("JSON API Server");
|
||||
}
|
||||
JsonApiServer::instance().start(rsInitConfig->jsonApiPort, rsInitConfig->jsonApiBindAddress);
|
||||
|
||||
#endif // ifdef RS_JSONAPI
|
||||
|
||||
return RS_INIT_OK;
|
||||
|
@ -1214,14 +1212,7 @@ int RsServer::StartupRetroShare()
|
|||
//
|
||||
mPluginsManager->loadPlugins(programatically_inserted_plugins) ;
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
if(jsonApiServer) // JsonApiServer may be disabled at runtime
|
||||
{
|
||||
mConfigMgr->addConfiguration("jsonApi.cfg", jsonApiServer);
|
||||
RsFileHash dummyHash;
|
||||
jsonApiServer->loadConfiguration(dummyHash);
|
||||
}
|
||||
#endif
|
||||
JsonApiServer::setConfigMgr(mConfigMgr);
|
||||
|
||||
/**** Reputation system ****/
|
||||
|
||||
|
@ -1230,7 +1221,7 @@ int RsServer::StartupRetroShare()
|
|||
|
||||
#ifdef RS_ENABLE_GXS
|
||||
|
||||
std::string currGxsDir = RsAccounts::AccountDirectory() + "/gxs";
|
||||
std::string currGxsDir = RsAccounts::AccountDirectory() + "/gxs";
|
||||
RsDirUtil::checkCreateDirectory(currGxsDir);
|
||||
|
||||
RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(serviceCtrl);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue