Browse Source

fix linux build

pull/69/head
root 11 years ago
parent
commit
607be87a4d
  1. 40
      Daemon.cpp
  2. 4
      DaemonLinux.cpp

40
Daemon.cpp

@ -1,7 +1,3 @@ @@ -1,7 +1,3 @@
#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS // to use freopen
#endif
#include <thread>
#include "Daemon.h"
@ -68,13 +64,9 @@ namespace i2p @@ -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 @@ -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 @@ -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 @@ -140,4 +132,4 @@ namespace i2p
return true;
}
}
}
}

4
DaemonLinux.cpp

@ -5,8 +5,10 @@ @@ -5,8 +5,10 @@
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
//#include <boost/filesystem.hpp>
#include "Log.h"
#include "util.h"

Loading…
Cancel
Save