update build files and allow compile without websocket

This commit is contained in:
Jeff Becker 2016-10-20 09:28:03 -04:00
parent 9575f70f38
commit 1a1d54387c
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
3 changed files with 13 additions and 4 deletions

View File

@ -41,7 +41,9 @@ 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; std::unique_ptr<i2p::transport::UPnP> UPnP;
#ifdef WITH_EVENTS
std::unique_ptr<i2p::event::WebsocketServer> m_WebsocketServer; std::unique_ptr<i2p::event::WebsocketServer> m_WebsocketServer;
#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()) {}
@ -294,6 +296,7 @@ namespace i2p
d.m_I2PControlService = std::unique_ptr<i2p::client::I2PControlService>(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort)); d.m_I2PControlService = std::unique_ptr<i2p::client::I2PControlService>(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort));
d.m_I2PControlService->Start (); d.m_I2PControlService->Start ();
} }
#ifdef WITH_EVENTS
bool websocket; i2p::config::GetOption("websockets.enabled", websocket); bool websocket; i2p::config::GetOption("websockets.enabled", websocket);
if(websocket) { if(websocket) {
@ -305,7 +308,7 @@ namespace i2p
i2p::event::core.SetListener(d.m_WebsocketServer->ToListener()); i2p::event::core.SetListener(d.m_WebsocketServer->ToListener());
} }
#endif
return true; return true;
} }
@ -338,13 +341,13 @@ namespace i2p
d.m_I2PControlService->Stop (); d.m_I2PControlService->Stop ();
d.m_I2PControlService = nullptr; d.m_I2PControlService = nullptr;
} }
#ifdef WITH_EVENTS
if (d.m_WebsocketServer) { if (d.m_WebsocketServer) {
LogPrint(eLogInfo, "Daemon: stopping Websocket server"); LogPrint(eLogInfo, "Daemon: stopping Websocket server");
d.m_WebsocketServer->Stop(); d.m_WebsocketServer->Stop();
d.m_WebsocketServer = nullptr; d.m_WebsocketServer = nullptr;
} }
#endif
i2p::crypto::TerminateCrypto (); i2p::crypto::TerminateCrypto ();
return true; return true;

View File

@ -14,6 +14,12 @@ USE_STATIC := no
USE_MESHNET := no USE_MESHNET := no
USE_UPNP := no USE_UPNP := no
ifeq ($(WEBSOCKET),1)
NEEDED_CXXFLAGS += -DWITH_EVENTS
DAEMON_SRC += Websocket.cpp
endif
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
DAEMON_SRC += DaemonLinux.cpp DAEMON_SRC += DaemonLinux.cpp
ifeq ($(HOMEBREW),1) ifeq ($(HOMEBREW),1)

View File

@ -5,7 +5,7 @@ LIB_SRC = \
SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \ SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \
Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \ Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \
Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \ Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \
Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Event.cpp
LIB_CLIENT_SRC = \ LIB_CLIENT_SRC = \
AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp \ AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp \