mirror of https://github.com/v2ray/v2ray-core
remove nodelay function
parent
951b278ac7
commit
7bc6d8af88
|
@ -68,7 +68,6 @@ func NewConnection(conv uint16, writerCloser io.WriteCloser, local *net.UDPAddr,
|
|||
Writer: writerCloser,
|
||||
}
|
||||
conn.kcp = NewKCP(conv, authWriter)
|
||||
conn.kcp.NoDelay(effectiveConfig.Tti, 2, effectiveConfig.Congestion)
|
||||
conn.kcp.current = conn.Elapsed()
|
||||
|
||||
go conn.updateTask()
|
||||
|
|
|
@ -44,7 +44,7 @@ type KCP struct {
|
|||
snd_buf *SendingWindow
|
||||
receivingWorker *ReceivingWorker
|
||||
|
||||
fastresend int32
|
||||
fastresend uint32
|
||||
congestionControl bool
|
||||
output *BufferedSegmentWriter
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ func NewKCP(conv uint16, output *AuthenticationWriter) *KCP {
|
|||
kcp.snd_buf = NewSendingWindow(kcp, effectiveConfig.GetSendingWindowSize())
|
||||
kcp.cwnd = kcp.snd_wnd
|
||||
kcp.receivingWorker = NewReceivingWorker(kcp)
|
||||
kcp.fastresend = 2
|
||||
kcp.congestionControl = effectiveConfig.Congestion
|
||||
return kcp
|
||||
}
|
||||
|
||||
|
@ -356,22 +358,6 @@ func (kcp *KCP) Update(current uint32) {
|
|||
kcp.flush()
|
||||
}
|
||||
|
||||
// NoDelay options
|
||||
// fastest: ikcp_nodelay(kcp, 1, 20, 2, 1)
|
||||
// nodelay: 0:disable(default), 1:enable
|
||||
// interval: internal update timer interval in millisec, default is 100ms
|
||||
// resend: 0:disable fast resend(default), 1:enable fast resend
|
||||
// nc: 0:normal congestion control(default), 1:disable congestion control
|
||||
func (kcp *KCP) NoDelay(interval uint32, resend int, congestionControl bool) int {
|
||||
kcp.interval = interval
|
||||
|
||||
if resend >= 0 {
|
||||
kcp.fastresend = int32(resend)
|
||||
}
|
||||
kcp.congestionControl = congestionControl
|
||||
return 0
|
||||
}
|
||||
|
||||
// WaitSnd gets how many packet is waiting to be sent
|
||||
func (kcp *KCP) WaitSnd() uint32 {
|
||||
return uint32(kcp.snd_buf.Len()) + kcp.snd_queue.Len()
|
||||
|
|
Loading…
Reference in New Issue