Commit 913aff64 authored by Skye Yu's avatar Skye Yu

fix: add continued decode function

parent 173aec1d
......@@ -320,11 +320,27 @@ function Jensen(log) {
}, self.timewait);
if (self.onreceive)
try {
self.onreceive(totalBytes, result.data);
self.onreceive(totalBytes, ciDecode(result.data));
} catch (e) {
}
};
// 持续解码
const ciDecode = (block) => {
const buff = new ArrayBuffer(RECV_BUFF_SIZE * 2);
let bview = new Uint8Array(buff);
for (let k = 0; k < block.byteLength; k++) {
bview[k + buffLength] = block.getInt8(k);
}
let result = null;
try {
result = decodeMessage(bview, 0, block.byteLength);
} catch (err) {
console.error('ci decode', err);
}
return result ? result.message.body : null;
}
const tryDecode = function () {
// 一个容器,比单独任意一个小包要大一点儿,好像还差一点儿
let stime = new Date();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment