MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / handle_signal

Function handle_signal

daemon/UnixDaemon.cpp:30–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#include "util.h"
29
30void handle_signal(int sig)
31{
32 switch (sig)
33 {
34 case SIGHUP:
35 LogPrint(eLogInfo, "Daemon: Got SIGHUP, reopening tunnel configuration...");
36 i2p::client::context.ReloadConfig();
37 break;
38 case SIGUSR1:
39 LogPrint(eLogInfo, "Daemon: Got SIGUSR1, reopening logs...");
40 i2p::log::Logger().Reopen ();
41 break;
42 case SIGINT:
43 if (i2p::context.AcceptsTunnels () && !Daemon.gracefulShutdownInterval)
44 {
45 i2p::context.SetAcceptsTunnels (false);
46 Daemon.gracefulShutdownInterval = 10*60; // 10 minutes
47 LogPrint(eLogInfo, "Graceful shutdown after ", Daemon.gracefulShutdownInterval, " seconds");
48 }
49 else
50 Daemon.running = 0;
51 break;
52 case SIGABRT:
53 case SIGTERM:
54 Daemon.running = 0; // Exit loop
55 break;
56 case SIGPIPE:
57 LogPrint(eLogInfo, "SIGPIPE received");
58 break;
59 case SIGTSTP:
60 LogPrint(eLogInfo, "Daemon: Got SIGTSTP, disconnecting from network...");
61 i2p::transport::transports.SetOnline(false);
62 break;
63 case SIGCONT:
64 LogPrint(eLogInfo, "Daemon: Got SIGCONT, restoring connection to network...");
65 i2p::transport::transports.SetOnline(true);
66 break;
67 }
68}
69
70namespace i2p
71{

Callers

nothing calls this directly

Calls 6

LogPrintFunction · 0.85
ReloadConfigMethod · 0.80
ReopenMethod · 0.80
AcceptsTunnelsMethod · 0.80
SetAcceptsTunnelsMethod · 0.80
SetOnlineMethod · 0.80

Tested by

no test coverage detected