mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-30 10:24:32 +00:00
feat[protocol]: 提升协议的兼容性,协议向前兼容
This commit is contained in:
@@ -82,6 +82,10 @@ const ByteBuffer = function() {
|
||||
}
|
||||
};
|
||||
|
||||
this.isReadable = function() {
|
||||
return this.writeOffset > this.readOffset;
|
||||
};
|
||||
|
||||
this.writeBoolean = function(value) {
|
||||
if (!(value === true || value === false)) {
|
||||
throw new Error('value must be true of false');
|
||||
@@ -339,7 +343,7 @@ const ByteBuffer = function() {
|
||||
};
|
||||
|
||||
this.writePacketFlag = function(value) {
|
||||
const flag = value === null;
|
||||
const flag = (value === null) || (value === undefined);
|
||||
this.writeBoolean(!flag);
|
||||
return flag;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user