summaryrefslogtreecommitdiffstats
path: root/source/Protocol/Protocol17x.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-30 23:38:55 +0100
committermadmaxoft <github@xoft.cz>2013-10-30 23:38:55 +0100
commitfeaea31b787070f4ea45c4829d4833d728a15d6f (patch)
treecb619bf9fa973efbfe5788aa18beab98de264755 /source/Protocol/Protocol17x.cpp
parentFixed a compiler warning. (diff)
downloadcuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.tar
cuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.tar.gz
cuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.tar.bz2
cuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.tar.lz
cuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.tar.xz
cuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.tar.zst
cuberite-feaea31b787070f4ea45c4829d4833d728a15d6f.zip
Diffstat (limited to '')
-rw-r--r--source/Protocol/Protocol17x.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/Protocol/Protocol17x.cpp b/source/Protocol/Protocol17x.cpp
index b93a95e12..aef1cc8c2 100644
--- a/source/Protocol/Protocol17x.cpp
+++ b/source/Protocol/Protocol17x.cpp
@@ -103,6 +103,7 @@ void cProtocol172::HandlePacket(UInt32 a_PacketType, UInt32 a_RemainingBytes)
switch (a_PacketType)
{
case 0x00: HandlePacketStatusRequest(a_RemainingBytes); return;
+ case 0x01: HandlePacketStatusPing (a_RemainingBytes); return;
}
break;
}
@@ -157,6 +158,30 @@ void cProtocol172::HandlePacketStatusRequest(UInt32 a_RemainingBytes)
+void cProtocol172::HandlePacketStatusPing(UInt32 a_RemainingBytes)
+{
+ ASSERT(a_RemainingBytes == 8);
+ if (a_RemainingBytes != 8)
+ {
+ m_Client->PacketError(0x01);
+ m_ReceivedData.SkipRead(a_RemainingBytes);
+ m_ReceivedData.CommitRead();
+ return;
+ }
+ Int64 Timestamp;
+ m_ReceivedData.ReadBEInt64(Timestamp);
+ m_ReceivedData.CommitRead();
+
+ cByteBuffer Packet(18);
+ Packet.WriteVarInt(0x01);
+ Packet.WriteBEInt64(Timestamp);
+ WritePacket(Packet);
+}
+
+
+
+
+
void cProtocol172::WritePacket(cByteBuffer & a_Packet)
{
cCSLock Lock(m_CSPacket);