mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-06-03 16:15:34 +00:00
feat[cpp]: compatible field of inside protocol class
This commit is contained in:
@@ -46,10 +46,15 @@ namespace zfoo {
|
||||
|
||||
IProtocol *read(ByteBuffer &buffer) override {
|
||||
auto *packet = new {}();
|
||||
if (!buffer.readBool()) {
|
||||
auto length = buffer.readInt();
|
||||
if (length == 0) {
|
||||
return packet;
|
||||
}
|
||||
auto beforeReadIndex = buffer.readerIndex();
|
||||
{}
|
||||
if (length > 0) {
|
||||
buffer.readerIndex(beforeReadIndex + length);
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user