From 59af89235bfb9189dec1fcee40a9231d03690d27 Mon Sep 17 00:00:00 2001 From: "mtilden@gmail.com" Date: Tue, 27 Dec 2011 18:39:06 +0000 Subject: - Added basic ping handling. Not sure what's up with the MC client, though. It doesn't seem to end up giving good results like the KA packet return is hanging and waiting for other things to process instead of being handled on its own to give a true result. Feel free to update if there's any way to deliver truer results. git-svn-id: http://mc-server.googlecode.com/svn/trunk@133 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/cClientHandle.h') diff --git a/source/cClientHandle.h b/source/cClientHandle.h index 4f8981b78..abb0c14c6 100644 --- a/source/cClientHandle.h +++ b/source/cClientHandle.h @@ -54,7 +54,7 @@ public: static void AuthenticateThread( void* a_Param ); const char* GetUsername(); - + inline short GetPing() { return m_Ping; } private: void HandlePacket( cPacket* a_Packet ); @@ -71,8 +71,11 @@ private: float m_TimeLastPacket; - // TODO: ping calculation per minecraft short m_Ping; + int m_PingID; + long long m_PingStartTime; + long long m_LastPingTime; + static const unsigned short PING_TIME_MS = 1000; //minecraft sends 1 per 20 ticks (1 second or every 1000 ms) bool m_bLoggedIn; bool m_bSendLoginResponse; -- cgit v1.2.3