common Daemon.GetGracefulShutdownInterval
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions

This commit is contained in:
orignal 2025-09-22 15:41:20 -04:00
parent c16c6976fa
commit 4dfbf33382
4 changed files with 22 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2023, The PurpleI2P Project
* Copyright (c) 2013-2025, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
@ -98,6 +98,11 @@ namespace util
}
#endif
}
int DaemonWin32::GetGracefulShutdownInterval () const
{
return i2p::win32::GetGracefulShutdownRemainingTime ();
}
}
}
#endif //_WIN32

View file

@ -195,7 +195,7 @@ namespace win32
s << "; ";
s << "Success Rate: " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate() << "%\n";
s << "Uptime: "; ShowUptime(s, i2p::context.GetUptime ());
auto gracefulTimeLeft = GetGracefulShutdownRemainingTime ();
auto gracefulTimeLeft = Daemon.GetGracefulShutdownInterval ();
if (gracefulTimeLeft > 0)
{
s << "Graceful shutdown, time left: "; ShowUptime(s, gracefulTimeLeft);

View file

@ -29,7 +29,10 @@ namespace util
virtual void run () {};
virtual void setDataDir (std::string path);
virtual int GetGracefulShutdownInterval () const { return 0; };
public:
bool isDaemon;
bool running;
@ -74,15 +77,21 @@ namespace util
static DaemonWin32 instance;
return instance;
}
bool init(int argc, char* argv[]);
bool start();
bool stop();
void run ();
int GetGracefulShutdownInterval () const;
public:
bool isGraceful;
DaemonWin32 ():isGraceful(false) {}
private:
DaemonWin32 (): isGraceful(false) {}
};
#elif (defined(ANDROID) && !defined(ANDROID_BINARY))
#define Daemon i2p::util::DaemonAndroid::Instance()
@ -112,6 +121,8 @@ namespace util
bool stop();
void run ();
int GetGracefulShutdownInterval () const { return gracefulShutdownInterval; };
private:
std::string pidfile;

View file

@ -300,21 +300,13 @@ namespace http {
ShowNetworkStatus (s, i2p::context.GetStatusV6 (), i2p::context.GetTestingV6(), i2p::context.GetErrorV6 ());
s << "<br>\r\n";
}
#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY))
if (auto remains = Daemon.gracefulShutdownInterval) {
s << "<b>" << tr("Stopping in") << ":</b> ";
ShowUptime(s, remains);
s << "<br>\r\n";
}
#elif defined(WIN32_APP)
auto remains = i2p::win32::GetGracefulShutdownRemainingTime ();
auto remains = Daemon.GetGracefulShutdownInterval ();
if (remains > 0)
{
s << "<b>" << tr("Stopping in") << ":</b> ";
ShowUptime(s, remains);
s << "<br>\r\n";
}
#endif
auto family = i2p::context.GetFamily ();
if (family.length () > 0)
s << "<b>"<< tr("Family") << ":</b> " << family << "<br>\r\n";