From ea9de4bbb70192626b00a810482671cf14bd7f8c Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 26 Jan 2014 16:15:05 +0000 Subject: Added SIGABRT to catchers list --- src/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 06b344c25..0f6895d03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,9 +68,10 @@ void NonCtrlHandler(int a_Signal) LOGERROR("Details | SIGABRT: Server self-terminated due to an internal fault"); 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 +225,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: -- cgit v1.2.3 From 30c431b479673b2c94b9d642fc7de73679cf3e6f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 26 Jan 2014 17:54:18 +0100 Subject: Fixed client packet parsing. When the packet wouldn't fit the current buffer, the server would mis-parse the next packet. This was the cause for #541. Also modified comm logging, now each direction can be turned on separately. --- src/main.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 0f6895d03..9acc7db3a 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; @@ -242,7 +245,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; } } -- cgit v1.2.3 From fc9e5278304adf811becf90e62311c1318e9658d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 27 Jan 2014 18:57:14 +0000 Subject: SIGABRT exits with failure. --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 9acc7db3a..c8cd2d4fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -69,6 +69,7 @@ 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: -- cgit v1.2.3