Commit 14b8f807 authored by martin hou's avatar martin hou

fix: 调整接收与解码的次序

parent 4e0f785b
......@@ -468,7 +468,6 @@ function Jensen(log, conn) {
totalBytes += result.data.byteLength;
// 做一个回调,怎么样找到它呢?
blocks.push(result.data);
tryReceive();
if (self.decodeTimeout) clearTimeout(self.decodeTimeout);
self.decodeTimeout = setTimeout(function () {
tryDecode();
......@@ -476,11 +475,12 @@ function Jensen(log, conn) {
if (self.onreceive) {
try { self.onreceive(totalBytes); } catch (e) {}
}
tryReceive();
};
const tryDecode = function () {
// if (!current) return;
Logger.info('jensen', 'tryDecode', `try to decode buffer with ${blocks.length} blocks`);
Logger.info('jensen', 'tryDecode', `try to decode buffer with ${blocks.length} blocks @ ${current}`);
// 一个容器,比单独任意一个小包要大一点儿,好像还差一点儿
// 当前总缓冲区大小
let totalBuffLen = 0;
......
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