- 论坛徽章:
- 3
|
回复 139# EasyIOCP
为什么执着于重启和更新呢
代码里就是更新定时器的到期时间(好像有些情况下mod_timer确实是重启定时器,so,或许也可以理解为重启吧):
inet_csk_reset_xmit_timer -> sk_reset_timer(sk, &icsk->icsk_delack_timer, icsk->icsk_ack.timeout);
- 1447 void sk_reset_timer(struct sock *sk, struct timer_list* timer,
- 1448 unsigned long expires)
- 1449 {
- 1450 if (!mod_timer(timer, expires))
- 1451 sock_hold(sk);
- 1452 }
复制代码
1、收到一个非重传的ACK时,此时会重新计算RTO,那么计算出新的RTO之后,重传定时器重启吗?
发送的包都已确认则关闭(清除)重传定时器等待标记(见下面代码),否则更新(重置)重传定时器到期时间
- 183 static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what)
- ...
- 187 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) {
- 188 icsk->icsk_pending = 0;
- 189 #ifdef INET_CSK_CLEAR_TIMERS //INET_CSK_CLEAR_TIMERS 默认未定义
- 190 sk_stop_timer(sk, &icsk->icsk_retransmit_timer);
- 191 #endif
- ...
复制代码 |
评分
-
查看全部评分
|