From 607be87a4dacb549351edc6f7e4edd08f5460c1e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Apr 2014 00:37:24 +0200 Subject: [PATCH] fix linux build --- Daemon.cpp | 40 ++++++++++++++++------------------------ DaemonLinux.cpp | 4 +++- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/Daemon.cpp b/Daemon.cpp index c587bfa9..7dfe54d9 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -1,7 +1,3 @@ -#ifdef _WIN32 -#define _CRT_SECURE_NO_WARNINGS // to use freopen -#endif - #include #include "Daemon.h" @@ -68,13 +64,9 @@ namespace i2p logfile_path.append("\\debug.log"); #endif logfile.open(logfile_path, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); - //logfile = freopen(logfile_path.c_str(), "a", stdout); + if (!logfile.is_open()) - { exit(-17); - } - - //std::streambuf * old = std::cout.rdbuf(logfile.rdbuf()); LogPrint("Logging to file enabled."); @@ -90,22 +82,22 @@ namespace i2p { d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070)); d.httpServer->Start(); - LogPrint("HTTPServer started", EVENTLOG_INFORMATION_TYPE); + LogPrint("HTTPServer started"); i2p::data::netdb.Start(); - LogPrint("NetDB started", EVENTLOG_INFORMATION_TYPE); + LogPrint("NetDB started"); i2p::transports.Start(); - LogPrint("Transports started", EVENTLOG_INFORMATION_TYPE); + LogPrint("Transports started"); i2p::tunnel::tunnels.Start(); - LogPrint("Tunnels started", EVENTLOG_INFORMATION_TYPE); + LogPrint("Tunnels started"); i2p::garlic::routing.Start(); - LogPrint("Routing started", EVENTLOG_INFORMATION_TYPE); + LogPrint("Routing started"); i2p::stream::StartStreaming(); - LogPrint("Streaming started", EVENTLOG_INFORMATION_TYPE); + LogPrint("Streaming started"); d.httpProxy = new i2p::proxy::HTTPProxy(i2p::util::config::GetArg("-httpproxyport", 4446)); d.httpProxy->Start(); - LogPrint("Proxy started", EVENTLOG_INFORMATION_TYPE); + LogPrint("Proxy started"); return true; } @@ -115,19 +107,19 @@ namespace i2p LogPrint("Shutdown started."); d.httpProxy->Stop(); - LogPrint("HTTPProxy stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("HTTPProxy stoped"); i2p::stream::StopStreaming(); - LogPrint("Streaming stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("Streaming stoped"); i2p::garlic::routing.Stop(); - LogPrint("Routing stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("Routing stoped"); i2p::tunnel::tunnels.Stop(); - LogPrint("Tunnels stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("Tunnels stoped"); i2p::transports.Stop(); - LogPrint("Transports stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("Transports stoped"); i2p::data::netdb.Stop(); - LogPrint("NetDB stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("NetDB stoped"); d.httpServer->Stop(); - LogPrint("HTTPServer stoped", EVENTLOG_INFORMATION_TYPE); + LogPrint("HTTPServer stoped"); delete d.httpProxy; d.httpProxy = nullptr; delete d.httpServer; d.httpServer = nullptr; @@ -140,4 +132,4 @@ namespace i2p return true; } } -} \ No newline at end of file +} diff --git a/DaemonLinux.cpp b/DaemonLinux.cpp index 4cfd51ce..119752ac 100644 --- a/DaemonLinux.cpp +++ b/DaemonLinux.cpp @@ -5,8 +5,10 @@ #include #include #include +#include +#include -//#include +#include "Log.h" #include "util.h"