mirror of
https://github.com/netfun2000/rttys_zhaojh329.git
synced 2026-02-27 09:53:24 +08:00
Fix bug: Upload file failed due to inconsistent peer rate
修复bug:两端速率不一致导致上传文件失败 Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
Executable → Regular
+9
-2
@@ -177,8 +177,10 @@ export default {
|
||||
this.upfile.percent = Math.round(this.upfile.pos / this.upfile.file.size * 100)
|
||||
|
||||
if (this.upfile.pos < this.upfile.file.size) {
|
||||
/* Control the client read speed based on the current buffer */
|
||||
if (this.ws.bufferedAmount > this.upfile.pos * 10) {
|
||||
/* Control the client read speed based on the current buffer and server */
|
||||
if (this.ws.bufferedAmount > this.upfile.pos * 10 || this.ratelimit) {
|
||||
this.ratelimit = false;
|
||||
|
||||
setTimeout(() => {
|
||||
this.readFile(fr);
|
||||
}, 100);
|
||||
@@ -334,6 +336,11 @@ export default {
|
||||
this.downfile.modal = false;
|
||||
this.$Message.info("Download Finish");
|
||||
}
|
||||
} else if (pkt.typ == rtty.RTTY_PACKET_UPFILE) {
|
||||
if (pkt.code == 5) {
|
||||
/* Need reduce the sending rate */
|
||||
this.ratelimit = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Executable → Regular
Executable → Regular
Reference in New Issue
Block a user