Update server ping with each game action (#239).

This commit is contained in:
lotodore
2013-12-08 12:20:51 +01:00
parent e58545b001
commit 0d60360fca
11 changed files with 76 additions and 14 deletions
+12
View File
@@ -158,6 +158,10 @@ ClientThread::SendPlayerAction()
{
// Warning: This function is called in the context of the GUI thread.
// Create a network packet containing the current player action.
{
boost::mutex::scoped_lock lock(m_pingDataMutex);
m_pingData.StartPing();
}
boost::shared_ptr<NetPacket> packet(new NetPacket);
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_MyActionRequestMessage);
MyActionRequestMessage *netMyAction = packet->GetMsg()->mutable_myactionrequestmessage();
@@ -1558,6 +1562,14 @@ ClientThread::UpdateStatData(const ServerStats &stats)
GetCallback().SignalNetClientStatsUpdate(m_curStats);
}
void
ClientThread::EndPing()
{
boost::mutex::scoped_lock lock(m_pingDataMutex);
m_pingData.EndPing();
GetCallback().SignalNetClientPingUpdate(m_pingData.MinPing(), m_pingData.AveragePing(), m_pingData.MaxPing());
}
ServerStats
ClientThread::GetStatData() const
{