1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

remove unused code in kcp

This commit is contained in:
v2ray 2016-06-18 17:30:31 +02:00
parent a0d08e4961
commit 7bf74761df

View File

@ -175,46 +175,12 @@ func NewKCP(conv uint32, mtu uint32, output Output) *KCP {
return kcp
}
// PeekSize checks the size of next message in the recv queue
func (kcp *KCP) PeekSize() (length int) {
if len(kcp.rcv_queue) == 0 {
return -1
}
seg := &kcp.rcv_queue[0]
if seg.frg == 0 {
return len(seg.data)
}
if len(kcp.rcv_queue) < int(seg.frg+1) {
return -1
}
for k := range kcp.rcv_queue {
seg := &kcp.rcv_queue[k]
length += len(seg.data)
if seg.frg == 0 {
break
}
}
return
}
// Recv is user/upper level recv: returns size, returns below zero for EAGAIN
func (kcp *KCP) Recv(buffer []byte) (n int) {
if len(kcp.rcv_queue) == 0 {
return -1
}
//peeksize := kcp.PeekSize()
//if peeksize < 0 {
// return -2
//}
//if peeksize > len(buffer) {
// return -3
//}
var fast_recover bool
if len(kcp.rcv_queue) >= int(kcp.rcv_wnd) {
fast_recover = true
@ -844,16 +810,6 @@ func (kcp *KCP) SetMtu(mtu int) int {
return 0
}
func (kcp *KCP) Interval(interval int) int {
if interval > 5000 {
interval = 5000
} else if interval < 10 {
interval = 10
}
kcp.interval = uint32(interval)
return 0
}
// NoDelay options
// fastest: ikcp_nodelay(kcp, 1, 20, 2, 1)
// nodelay: 0:disable(default), 1:enable