From 1a1d54387c3696b07f52fa5ccabe13d606b0f8d3 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 20 Oct 2016 09:28:03 -0400 Subject: [PATCH] update build files and allow compile without websocket --- Daemon.cpp | 9 ++++++--- Makefile | 6 ++++++ filelist.mk | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Daemon.cpp b/Daemon.cpp index d8b501a3..a5084194 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -41,7 +41,9 @@ namespace i2p std::unique_ptr httpServer; std::unique_ptr m_I2PControlService; std::unique_ptr UPnP; +#ifdef WITH_EVENTS std::unique_ptr m_WebsocketServer; +#endif }; 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(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort)); d.m_I2PControlService->Start (); } +#ifdef WITH_EVENTS bool websocket; i2p::config::GetOption("websockets.enabled", websocket); if(websocket) { @@ -305,7 +308,7 @@ namespace i2p i2p::event::core.SetListener(d.m_WebsocketServer->ToListener()); } - +#endif return true; } @@ -338,13 +341,13 @@ namespace i2p d.m_I2PControlService->Stop (); d.m_I2PControlService = nullptr; } - +#ifdef WITH_EVENTS if (d.m_WebsocketServer) { LogPrint(eLogInfo, "Daemon: stopping Websocket server"); d.m_WebsocketServer->Stop(); d.m_WebsocketServer = nullptr; } - +#endif i2p::crypto::TerminateCrypto (); return true; diff --git a/Makefile b/Makefile index 0e50364b..e3707c09 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,12 @@ USE_STATIC := no USE_MESHNET := no USE_UPNP := no + +ifeq ($(WEBSOCKET),1) + NEEDED_CXXFLAGS += -DWITH_EVENTS + DAEMON_SRC += Websocket.cpp +endif + ifeq ($(UNAME),Darwin) DAEMON_SRC += DaemonLinux.cpp ifeq ($(HOMEBREW),1) diff --git a/filelist.mk b/filelist.mk index cb1263e3..94ce2f22 100644 --- a/filelist.mk +++ b/filelist.mk @@ -5,7 +5,7 @@ LIB_SRC = \ SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \ Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.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 = \ AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp \