1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-30 21:26:33 -05:00

fix mkcp sending window

This commit is contained in:
Page Fault 2020-09-08 07:01:16 +00:00
parent 16fe0b03f6
commit 1a652933d9
No known key found for this signature in database
GPG Key ID: 11DCC4CAF7218E03

View File

@ -315,14 +315,16 @@ func (w *SendingWorker) Flush(current uint32) {
return
}
cwnd := w.firstUnacknowledged + w.conn.Config.GetSendingInFlightSize()
if cwnd > w.remoteNextNumber {
cwnd = w.remoteNextNumber
cwnd := w.conn.Config.GetSendingInFlightSize()
if cwnd > w.remoteNextNumber-w.firstUnacknowledged {
cwnd = w.remoteNextNumber - w.firstUnacknowledged
}
if w.conn.Config.Congestion && cwnd > w.firstUnacknowledged+w.controlWindow {
cwnd = w.firstUnacknowledged + w.controlWindow
if w.conn.Config.Congestion && cwnd > w.controlWindow {
cwnd = w.controlWindow
}
cwnd *= 20 // magic
if !w.window.IsEmpty() {
w.window.Flush(current, w.conn.roundTrip.Timeout(), cwnd)
w.firstUnacknowledgedUpdated = false