Commit e2eee8f8 authored by martin hou's avatar martin hou

Merge branch 'v20250816' into device-mgr

parents fde0add4 dd80620f
......@@ -334,7 +334,7 @@ function Jensen(log, conn) {
current = 'cmd-' + cmd.command + '-' + cmd.index;
Logger.debug('jensen', 'sendNext', pid + '-command: ' + current + ', data bytes: ' + data.byteLength);
self.timewait = cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK ? 5000 : 10;
self.timewait = cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK ? 1000 : 10;
// self.timewait = 10000;
console.log(pid + '-send', data);
if (self.onprogress && cmd.command == TRANSFER_FILE)
......@@ -1103,16 +1103,16 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
this.onprogress = onprogress;
this.onreceive = function(recvBytes)
{
let percent = Math.floor(recvBytes / length * 1000);
percent = Math.min(1000, percent);
let percent = Math.floor(recvBytes / length * 100);
percent = Math.min(100, percent);
let k = 't' + percent;
Logger.info('jensen', 'transfer', (percent / 10).toFixed(1) + '%');
if (percent > 0 && percent < 1000)
Logger.info('jensen', 'transfer', percent + '%');
if (percent > 0 && percent < 100)
{
if (!(k in self._progress_report)) setTimeout(() => onprogress?.(recvBytes), 0);
self._progress_report[k] = true;
}
if (percent >= 1000 && !(k in self._progress_report))
if (percent >= 100 && !(k in self._progress_report))
{
setTimeout(() => onprogress?.(length), 0);
self._progress_report[k] = true;
......
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