From f7a8cb14199d595c88b213dc857ccfb239d948de Mon Sep 17 00:00:00 2001 From: lotodore Date: Sun, 12 Jul 2009 21:12:55 +0000 Subject: [PATCH] Adding additional logging. --- src/net/common/servergamestate.cpp | 12 +++++++++--- src/net/common/serverlobbythread.cpp | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/net/common/servergamestate.cpp b/src/net/common/servergamestate.cpp index 88f9efb2..9c235e97 100644 --- a/src/net/common/servergamestate.cpp +++ b/src/net/common/servergamestate.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -654,6 +655,7 @@ ServerGameStateHand::TimerLoop(const boost::system::error_code &ec, boost::share } catch (const PokerTHException &e) { + LOG_ERROR("Game " << server->GetId() << " - Engine exception: " << e.what()); server->RemoveAllSessions(); // Close this game on error. } } @@ -887,14 +889,17 @@ ServerGameStateHand::TimerComputerAction(const boost::system::error_code &ec, bo { try { - boost::shared_ptr tmpPlayer = server->GetGame().getCurrentPlayer(); + boost::shared_ptr curPlayer = server->GetGame().getCurrentPlayer(); + if (!curPlayer) + throw ServerException(__FILE__, __LINE__, ERR_NET_NO_CURRENT_PLAYER, 0); - tmpPlayer->action(); - SendPlayerAction(*server, tmpPlayer); + curPlayer->action(); + SendPlayerAction(*server, curPlayer); EngineLoop(server); } catch (const PokerTHException &e) { + LOG_ERROR("Game " << server->GetId() << " - Computer timer exception: " << e.what()); server->RemoveAllSessions(); // Close this game on error. } } @@ -1193,6 +1198,7 @@ ServerGameStateWaitPlayerAction::TimerTimeout(const boost::system::error_code &e } catch (const PokerTHException &e) { + LOG_ERROR("Game " << server->GetId() << " - Player timer exception: " << e.what()); server->RemoveAllSessions(); // Close this game on error. } } diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 635141be..aa52562d 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -459,7 +459,7 @@ ServerLobbyThread::Main() } catch (const PokerTHException &e) { GetCallback().SignalNetServerError(e.GetErrorId(), e.GetOsErrorCode()); - LOG_ERROR(e.what()); + LOG_ERROR("Lobby exception: " << e.what()); } // Clear all sessions. m_sessionManager.Clear(); @@ -549,7 +549,7 @@ ServerLobbyThread::HandleRead(const boost::system::error_code &ec, SessionId ses game->HandlePacket(session, packet); } catch (const PokerTHException &e) { - LOG_ERROR(e.what()); + LOG_ERROR("Game " << game->GetId() << " - Read handler exception: " << e.what()); InternalRemoveGame(game); } }