diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-09-28 13:49:44 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-09-28 13:49:44 +0200 |
| commit | 02d497165a0b1fe064477f3248d86f4cb5b59a9e (patch) | |
| tree | ff88495b4ee5684d1b40adfdcca7965141ec094f | |
| parent | 48b7e0c60c9b675e5c5644081a675c71dafc174e (diff) | |
WorldServer/Misc: Log possible errors on shutdown
Log possible error on shutdown happening when trying to cancel any I/O sync operation in CliThread, refers to #13201
| -rw-r--r-- | src/server/worldserver/Main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 07101e61eb6..bd028069c62 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -280,7 +280,20 @@ extern int main(int argc, char** argv) if (cliThread != nullptr) { #ifdef _WIN32 - CancelSynchronousIo(cliThread->native_handle()); + if (!CancelSynchronousIo(cliThread->native_handle())) + { + DWORD errorCode = GetLastError(); + LPSTR errorBuffer; + + DWORD formatReturnCode = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, + nullptr, errorCode, 0, (LPTSTR)&errorBuffer, 0, nullptr); + if (!formatReturnCode) + errorBuffer = "Unknown error"; + + TC_LOG_ERROR("server.worldserver", "Error cancelling I/O of CliThread, error code %u, detail: %s", + errorCode, errorBuffer); + LocalFree(errorBuffer); + } #endif cliThread->join(); delete cliThread; |
