1.根據Nagle算法,什麼時候要發送包
內核代碼,Nagle算法下,當一個報文能夠被髮送時,下面這個函數返回0
Filename : \linux-3.4.4\net\ipv4\tcp_output.c
/* Return 0, if packet can be sent now without violation Nagle's rules:
* 1. It is full sized.
* 2. Or it contains FIN. (already checked by caller)
* 3. Or TCP_CORK is not set, and TCP_NODELAY is set.
* 4. Or TCP_CORK is not set, and all sent packets are ACKed.
* With Minshall's modification: all sent small packets are ACKed.
*/
static inline int tcp_nagle_check(const struct tcp_sock *tp,
const struct sk_buff *skb,
unsigned mss_now, int nonagle)
{
return skb->len < mss_now && ((nonagle & TCP_NAGLE_CORK)
|| (!nonagle && tp->packets_out && tcp_minshall_check(tp)));
}
1.報文到達MSS
2.有FIN
3.!TCP_CORK && TCP_NOREPLY
4.!TCP_CORK && All_ACKED
5.超時