summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_8.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-08 17:37:36 +0100
committerGitHub <noreply@github.com>2021-03-08 17:37:36 +0100
commit01a4e696b3d2c973cdd1fb4345d747bd10e93ad9 (patch)
tree92996aef85fca3306b26535fa44feb812deb050b /src/Protocol/Protocol_1_8.h
parentSome emplace_back replacements (#5149) (diff)
downloadcuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.tar
cuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.tar.gz
cuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.tar.bz2
cuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.tar.lz
cuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.tar.xz
cuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.tar.zst
cuberite-01a4e696b3d2c973cdd1fb4345d747bd10e93ad9.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol_1_8.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Protocol/Protocol_1_8.h b/src/Protocol/Protocol_1_8.h
index e2aadf147..29bc7420c 100644
--- a/src/Protocol/Protocol_1_8.h
+++ b/src/Protocol/Protocol_1_8.h
@@ -36,8 +36,9 @@ public:
cProtocol_1_8_0(cClientHandle * a_Client, const AString & a_ServerAddress, State a_State);
- /** Called when client sends some data: */
- virtual void DataReceived(cByteBuffer & a_Buffer, const char * a_Data, size_t a_Size) override;
+ /** Called to process them, when client sends some data.
+ The protocol uses the provided buffers for storage and processing, and must have exclusive access to them. */
+ virtual void DataReceived(cByteBuffer & a_Buffer, ContiguousByteBuffer && a_Data) override;
/** Sending stuff to clients (alphabetically sorted): */
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) override;
@@ -146,9 +147,6 @@ protected:
/** State of the protocol. */
State m_State;
- /** Adds the received (unencrypted) data to m_ReceivedData, parses complete packets */
- virtual void AddReceivedData(cByteBuffer & a_Buffer, const char * a_Data, size_t a_Size);
-
/** Nobody inherits 1.8, so it doesn't use this method */
virtual UInt32 GetPacketID(ePacketType a_Packet) override;
@@ -257,6 +255,9 @@ private:
/** The logfile where the comm is logged, when g_ShouldLogComm is true */
cFile m_CommLogFile;
+ /** Adds the received (unencrypted) data to m_ReceivedData, parses complete packets */
+ void AddReceivedData(cByteBuffer & a_Buffer, ContiguousByteBufferView a_Data);
+
/** Handle a complete packet stored in the given buffer. */
void HandlePacket(cByteBuffer & a_Buffer);