diff options
| author | Adam <Adam@anope.org> | 2011-05-23 04:41:51 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-05-23 04:41:51 -0400 |
| commit | 8bf8832b70dea28e2048d5952ee03247f12bda92 (patch) | |
| tree | f76f670690c105ec8f9ca079d868e930fd8f205b /include | |
| parent | 4dd7e261f5704569856b5854dcc1f68010f0aaad (diff) | |
Rewrote the signal handling to use sigaction
Diffstat (limited to 'include')
| -rw-r--r-- | include/extern.h | 1 | ||||
| -rw-r--r-- | include/modules.h | 8 | ||||
| -rw-r--r-- | include/services.h | 17 | ||||
| -rw-r--r-- | include/sockets.h | 6 |
4 files changed, 21 insertions, 11 deletions
diff --git a/include/extern.h b/include/extern.h index 7774c104f..97bc39d5a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -115,7 +115,6 @@ E bool protocoldebug; E bool quitting; E bool restarting; E Anope::string quitmsg; -E bool save_data; E time_t start_time; E ConnectionSocket *UplinkSock; diff --git a/include/modules.h b/include/modules.h index ff0c576a0..c886e9a74 100644 --- a/include/modules.h +++ b/include/modules.h @@ -572,12 +572,6 @@ class CoreExport Module : public Extensible */ virtual void OnShutdown() { } - /** Called on signal - * @param signum The signum - * @param msg The quitmsg - */ - virtual void OnSignal(int signum, const Anope::string &msg) { } - /** Called before a nick expires * @param na The nick * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it @@ -1077,7 +1071,7 @@ enum Implementation /* Other */ I_OnReload, I_OnNewServer, I_OnPreServerConnect, I_OnServerConnect, I_OnPreUplinkSync, I_OnServerDisconnect, I_OnPreCommandRun, - I_OnPreCommand, I_OnPostCommand, I_OnRestart, I_OnShutdown, I_OnSignal, + I_OnPreCommand, I_OnPostCommand, I_OnRestart, I_OnShutdown, I_OnServerQuit, I_OnTopicUpdated, I_OnEncrypt, I_OnDecrypt, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd, diff --git a/include/services.h b/include/services.h index f329f99ef..35342e1da 100644 --- a/include/services.h +++ b/include/services.h @@ -241,6 +241,23 @@ class DatabaseException : public CoreException virtual ~DatabaseException() throw() { } }; +class Signal +{ + static std::vector<Signal *> SignalHandlers; + static void SignalHandler(int signal); + + struct sigaction action; + sig_atomic_t called; + public: + static void Process(); + + int signal; + + Signal(int s); + ~Signal(); + virtual void OnSignal() = 0; +}; + /** Debug cast to be used instead of dynamic_cast, this uses dynamic_cast * for debug builds and static_cast on releass builds to speed up the program * because dynamic_cast relies on RTTI. diff --git a/include/sockets.h b/include/sockets.h index eca2635e8..5e5ca1fde 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -254,7 +254,7 @@ class CoreExport BufferedSocket : public Socket /* Part of a message sent from the server, but not totally received */ Anope::string extrabuf; /* How much data was received from this socket */ - size_t RecvLen; + int RecvLen; public: /** Blank constructor @@ -297,12 +297,12 @@ class CoreExport BufferedSocket : public Socket /** Get the length of the read buffer * @return The length of the read buffer */ - size_t ReadBufferLen() const; + int ReadBufferLen() const; /** Get the length of the write buffer * @return The length of the write buffer */ - size_t WriteBufferLen() const; + int WriteBufferLen() const; }; class CoreExport ListenSocket : public Socket |
