|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
#include <thread>
|
|
|
|
|
#include "Config.h"
|
|
|
|
|
#include "Daemon.h"
|
|
|
|
|
#include "util.h"
|
|
|
|
@ -6,7 +7,9 @@
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
|
|
|
|
|
#include "Win32/Win32Service.h"
|
|
|
|
|
#ifdef WIN32_APP
|
|
|
|
|
#include "Win32/Win32App.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
|
{
|
|
|
|
@ -65,10 +68,12 @@ namespace i2p
|
|
|
|
|
SetConsoleCP(1251);
|
|
|
|
|
SetConsoleOutputCP(1251);
|
|
|
|
|
setlocale(LC_ALL, "Russian");
|
|
|
|
|
#ifdef WIN32_APP
|
|
|
|
|
if (!i2p::win32::StartWin32App ()) return false;
|
|
|
|
|
|
|
|
|
|
// override log
|
|
|
|
|
i2p::config::SetOption("log", std::string ("file"));
|
|
|
|
|
#endif
|
|
|
|
|
bool ret = Daemon_Singleton::start();
|
|
|
|
|
if (ret && IsLogToFile ())
|
|
|
|
|
{
|
|
|
|
@ -84,13 +89,23 @@ namespace i2p
|
|
|
|
|
|
|
|
|
|
bool DaemonWin32::stop()
|
|
|
|
|
{
|
|
|
|
|
#ifdef WIN32_APP
|
|
|
|
|
i2p::win32::StopWin32App ();
|
|
|
|
|
#endif
|
|
|
|
|
return Daemon_Singleton::stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DaemonWin32::run ()
|
|
|
|
|
{
|
|
|
|
|
#ifdef WIN32_APP
|
|
|
|
|
i2p::win32::RunWin32App ();
|
|
|
|
|
#else
|
|
|
|
|
while (running)
|
|
|
|
|
{
|
|
|
|
|
std::this_thread::sleep_for (std::chrono::seconds(1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|