mirror of
https://github.com/skywind3000/kcp.git
synced 2024-12-26 07:00:09 +08:00
update rto calculation
This commit is contained in:
parent
cf683713cb
commit
9158f84781
6
ikcp.c
6
ikcp.c
@ -1056,9 +1056,11 @@ void ikcp_flush(ikcpcb *kcp)
|
||||
segment->xmit++;
|
||||
kcp->xmit++;
|
||||
if (kcp->nodelay == 0) {
|
||||
segment->rto += kcp->rx_rto;
|
||||
segment->rto += _imax_(segment->rto, (IUINT32)kcp->rx_rto);
|
||||
} else {
|
||||
segment->rto += kcp->rx_rto / 2;
|
||||
IINT32 step = (kcp->nodelay < 2)?
|
||||
((IINT32)(segment->rto)) : kcp->rx_rto;
|
||||
segment->rto += step / 2;
|
||||
}
|
||||
segment->resendts = current + segment->rto;
|
||||
lost = 1;
|
||||
|
4
test.cpp
4
test.cpp
@ -70,8 +70,8 @@ void test(int mode)
|
||||
// 第三个参数 interval为内部处理时钟,默认设置为 10ms
|
||||
// 第四个参数 resend为快速重传指标,设置为2
|
||||
// 第五个参数 为是否禁用常规流控,这里禁止
|
||||
ikcp_nodelay(kcp1, 1, 10, 2, 1);
|
||||
ikcp_nodelay(kcp2, 1, 10, 2, 1);
|
||||
ikcp_nodelay(kcp1, 2, 10, 2, 1);
|
||||
ikcp_nodelay(kcp2, 2, 10, 2, 1);
|
||||
kcp1->rx_minrto = 10;
|
||||
kcp1->fastresend = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user