Commit 80f5033d authored by martin hou's avatar martin hou

fix: 增加onprogress变量与onreceive分开

parent 1738c5a8
......@@ -294,9 +294,9 @@ function Jensen(log, conn) {
self.timewait = cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK ? 1000 : 10;
console.log(pid + '-send', data);
if (this.onreceive && (cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK))
if (this.onprogress && (cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK))
{
try { this.onreceive(0); } catch(e) { }
try { this.onprogress(0); } catch(e) { }
}
await device.transferOut(1, data).catch((e) => crash('sendNext', e));
if (cmd.onprogress) cmd.onprogress(1, 1);
......@@ -1056,8 +1056,11 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
}
};
// this.onreceive = onprogress;
this.onprogress = null;
this.onreceive = null;
this._progress_report = {};
// try { onprogress(0); } catch(e) {}
this.onprogress = onprogress;
this.onreceive = function(recvBytes)
{
let percent = Math.floor(recvBytes / length * 100);
......
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