Adding additional logging.

This commit is contained in:
lotodore
2009-07-12 21:12:55 +00:00
parent 6c464107cc
commit f7a8cb1419
2 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -25,6 +25,7 @@
#include <net/netpacket.h> #include <net/netpacket.h>
#include <net/socket_msg.h> #include <net/socket_msg.h>
#include <net/serverexception.h> #include <net/serverexception.h>
#include <core/loghelper.h>
#include <gamedata.h> #include <gamedata.h>
#include <game.h> #include <game.h>
#include <playerinterface.h> #include <playerinterface.h>
@@ -654,6 +655,7 @@ ServerGameStateHand::TimerLoop(const boost::system::error_code &ec, boost::share
} }
catch (const PokerTHException &e) catch (const PokerTHException &e)
{ {
LOG_ERROR("Game " << server->GetId() << " - Engine exception: " << e.what());
server->RemoveAllSessions(); // Close this game on error. server->RemoveAllSessions(); // Close this game on error.
} }
} }
@@ -887,14 +889,17 @@ ServerGameStateHand::TimerComputerAction(const boost::system::error_code &ec, bo
{ {
try try
{ {
boost::shared_ptr<PlayerInterface> tmpPlayer = server->GetGame().getCurrentPlayer(); boost::shared_ptr<PlayerInterface> curPlayer = server->GetGame().getCurrentPlayer();
if (!curPlayer)
throw ServerException(__FILE__, __LINE__, ERR_NET_NO_CURRENT_PLAYER, 0);
tmpPlayer->action(); curPlayer->action();
SendPlayerAction(*server, tmpPlayer); SendPlayerAction(*server, curPlayer);
EngineLoop(server); EngineLoop(server);
} }
catch (const PokerTHException &e) catch (const PokerTHException &e)
{ {
LOG_ERROR("Game " << server->GetId() << " - Computer timer exception: " << e.what());
server->RemoveAllSessions(); // Close this game on error. server->RemoveAllSessions(); // Close this game on error.
} }
} }
@@ -1193,6 +1198,7 @@ ServerGameStateWaitPlayerAction::TimerTimeout(const boost::system::error_code &e
} }
catch (const PokerTHException &e) catch (const PokerTHException &e)
{ {
LOG_ERROR("Game " << server->GetId() << " - Player timer exception: " << e.what());
server->RemoveAllSessions(); // Close this game on error. server->RemoveAllSessions(); // Close this game on error.
} }
} }
+2 -2
View File
@@ -459,7 +459,7 @@ ServerLobbyThread::Main()
} catch (const PokerTHException &e) } catch (const PokerTHException &e)
{ {
GetCallback().SignalNetServerError(e.GetErrorId(), e.GetOsErrorCode()); GetCallback().SignalNetServerError(e.GetErrorId(), e.GetOsErrorCode());
LOG_ERROR(e.what()); LOG_ERROR("Lobby exception: " << e.what());
} }
// Clear all sessions. // Clear all sessions.
m_sessionManager.Clear(); m_sessionManager.Clear();
@@ -549,7 +549,7 @@ ServerLobbyThread::HandleRead(const boost::system::error_code &ec, SessionId ses
game->HandlePacket(session, packet); game->HandlePacket(session, packet);
} catch (const PokerTHException &e) } catch (const PokerTHException &e)
{ {
LOG_ERROR(e.what()); LOG_ERROR("Game " << game->GetId() << " - Read handler exception: " << e.what());
InternalRemoveGame(game); InternalRemoveGame(game);
} }
} }