mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
* Daemon.cpp : make upnp configurable via options
This commit is contained in:
parent
9f5be52a97
commit
9340bf385e
30
Daemon.cpp
30
Daemon.cpp
@ -22,11 +22,8 @@
|
|||||||
#include "I2PControl.h"
|
#include "I2PControl.h"
|
||||||
#include "ClientContext.h"
|
#include "ClientContext.h"
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
|
||||||
#include "UPnP.h"
|
#include "UPnP.h"
|
||||||
#endif
|
#include "util.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
@ -40,10 +37,7 @@ namespace i2p
|
|||||||
|
|
||||||
std::unique_ptr<i2p::http::HTTPServer> httpServer;
|
std::unique_ptr<i2p::http::HTTPServer> httpServer;
|
||||||
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
||||||
|
std::unique_ptr<i2p::transport::UPnP> UPnP;
|
||||||
#ifdef USE_UPNP
|
|
||||||
i2p::transport::UPnP m_UPnP;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Daemon_Singleton::Daemon_Singleton() : isDaemon(false), running(true), d(*new Daemon_Singleton_Private()) {}
|
Daemon_Singleton::Daemon_Singleton() : isDaemon(false), running(true), d(*new Daemon_Singleton_Private()) {}
|
||||||
@ -249,10 +243,12 @@ namespace i2p
|
|||||||
LogPrint(eLogInfo, "Daemon: starting NetDB");
|
LogPrint(eLogInfo, "Daemon: starting NetDB");
|
||||||
i2p::data::netdb.Start();
|
i2p::data::netdb.Start();
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
bool upnp; i2p::config::GetOption("upnp.enabled", upnp);
|
||||||
LogPrint(eLogInfo, "Daemon: starting UPnP");
|
if (upnp) {
|
||||||
d.m_UPnP.Start ();
|
d.UPnP = std::unique_ptr<i2p::transport::UPnP>(new i2p::transport::UPnP);
|
||||||
#endif
|
d.UPnP->Start ();
|
||||||
|
}
|
||||||
|
|
||||||
bool ntcp; i2p::config::GetOption("ntcp", ntcp);
|
bool ntcp; i2p::config::GetOption("ntcp", ntcp);
|
||||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
bool ssu; i2p::config::GetOption("ssu", ssu);
|
||||||
LogPrint(eLogInfo, "Daemon: starting Transports");
|
LogPrint(eLogInfo, "Daemon: starting Transports");
|
||||||
@ -304,10 +300,12 @@ namespace i2p
|
|||||||
i2p::client::context.Stop();
|
i2p::client::context.Stop();
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Tunnels");
|
LogPrint(eLogInfo, "Daemon: stopping Tunnels");
|
||||||
i2p::tunnel::tunnels.Stop();
|
i2p::tunnel::tunnels.Stop();
|
||||||
#ifdef USE_UPNP
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping UPnP");
|
if (d.UPnP) {
|
||||||
d.m_UPnP.Stop ();
|
d.UPnP->Stop ();
|
||||||
#endif
|
d.UPnP = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Transports");
|
LogPrint(eLogInfo, "Daemon: stopping Transports");
|
||||||
i2p::transport::transports.Stop();
|
i2p::transport::transports.Stop();
|
||||||
LogPrint(eLogInfo, "Daemon: stopping NetDB");
|
LogPrint(eLogInfo, "Daemon: stopping NetDB");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user