缓冲区满的情况处理办法
// 缓冲区満了
if (sendChannel.bufferedAmount > sendChannel.bufferedAmountLowThreshold) {
this.addSysLogs("sendChannel缓冲区已满,等待中...")
sendChannel.onbufferedamountlow = () => {
this.addSysLogs("sendChannel缓冲区已恢复,继续发送中...")
sendChannel.onbufferedamountlow = null;
that.sendFileToRemoteByLoop(event);
}
return;
}
// 发送数据
sendChannel.send(event.target.result);
fileOffset += event.target.result.byteLength;
remote[this.currentChooseFile.index + "offset"] = fileOffset
this.currentSendAllSize += event.target.result.byteLength;