summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-02-01 00:31:05 +0100
committerTycho <work.tycho+git@gmail.com>2014-02-01 00:31:05 +0100
commitfec17409d2f566af18bad269fe2c5c372a474ecb (patch)
tree93baa2311e38fddb86a68e550955c261ac96cf3b /src/main.cpp
parentChanged signitures of Several BLockHandler Methods (diff)
parentContributors now match real life, and are alpha-sorted. (diff)
downloadcuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.gz
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.bz2
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.lz
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.xz
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.zst
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.zip
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 06b344c25..c8cd2d4fe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,8 +19,11 @@ bool g_SERVER_TERMINATED = false; // Set to true when the server terminates, so
-/** If set to true, the protocols will log each player's communication to a separate logfile */
-bool g_ShouldLogComm;
+/** If set to true, the protocols will log each player's incoming (C->S) communication to a per-connection logfile */
+bool g_ShouldLogCommIn;
+
+/** If set to true, the protocols will log each player's outgoing (S->C) communication to a per-connection logfile */
+bool g_ShouldLogCommOut;
@@ -66,11 +69,13 @@ void NonCtrlHandler(int a_Signal)
std::signal(a_Signal, SIG_DFL);
LOGERROR(" D: | MCServer has encountered an error and needs to close");
LOGERROR("Details | SIGABRT: Server self-terminated due to an internal fault");
+ exit(EXIT_FAILURE);
break;
}
+ case SIGINT:
case SIGTERM:
{
- std::signal(SIGTERM, SIG_IGN); // Server is shutting down, wait for it...
+ std::signal(a_Signal, SIG_IGN); // Server is shutting down, wait for it...
break;
}
default: break;
@@ -224,6 +229,10 @@ int main( int argc, char **argv )
std::signal(SIGSEGV, NonCtrlHandler);
std::signal(SIGTERM, NonCtrlHandler);
std::signal(SIGINT, NonCtrlHandler);
+ std::signal(SIGABRT, NonCtrlHandler);
+ #ifdef SIGABRT_COMPAT
+ std::signal(SIGABRT_COMPAT, NonCtrlHandler);
+ #endif // SIGABRT_COMPAT
#endif
// DEBUG: test the dumpfile creation:
@@ -237,7 +246,24 @@ int main( int argc, char **argv )
(NoCaseCompare(argv[i], "/logcomm") == 0)
)
{
- g_ShouldLogComm = true;
+ g_ShouldLogCommIn = true;
+ g_ShouldLogCommOut = true;
+ }
+ if (
+ (NoCaseCompare(argv[i], "/commlogin") == 0) ||
+ (NoCaseCompare(argv[i], "/comminlog") == 0) ||
+ (NoCaseCompare(argv[i], "/logcommin") == 0)
+ )
+ {
+ g_ShouldLogCommIn = true;
+ }
+ if (
+ (NoCaseCompare(argv[i], "/commlogout") == 0) ||
+ (NoCaseCompare(argv[i], "/commoutlog") == 0) ||
+ (NoCaseCompare(argv[i], "/logcommout") == 0)
+ )
+ {
+ g_ShouldLogCommOut = true;
}
}