当前位置:网站首页>When to send the update windows message
When to send the update windows message
2022-06-24 21:24:00 【already_ skb】
* then send an ACK if necessary. COPIED is the number of bytes
* tcp_recvmsg has given to the user so far, it speeds up the
* calculation of whether or not we must ACK for the sake of
* a window update.
*/
static void tcp_cleanup_rbuf(struct sock *sk, int copied)
{
struct tcp_sock *tp = tcp_sk(sk);
bool time_to_ack = false;
struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
WARN(skb && !before(tp->copied_seq, TCP_SKB_CB(skb)->end_seq),
"cleanup rbuf bug: copied %X seq %X rcvnxt %X\n",
tp->copied_seq, TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt);
if (inet_csk_ack_scheduled(sk)) {
const struct inet_connection_sock *icsk = inet_csk(sk);
/* Delayed ACKs frequently hit locked sockets during bulk
* receive. */
if (icsk->icsk_ack.blocked ||
/* Once-per-two-segments ACK was not sent by tcp_input.c */
tp->rcv_nxt - tp->rcv_wup > icsk->icsk_ack.rcv_mss ||
/*
* If this read emptied read buffer, we send ACK, if
* connection is not bidirectional, user drained
* receive buffer and there was a small segment
* in queue.
*/
(copied > 0 &&
((icsk->icsk_ack.pending & ICSK_ACK_PUSHED2) ||
((icsk->icsk_ack.pending & ICSK_ACK_PUSHED) &&
!icsk->icsk_ack.pingpong)) &&
!atomic_read(&sk->sk_rmem_alloc)))
time_to_ack = true;
}
/* We send an ACK if we can now advertise a non-zero window
* which has been raised "significantly".
*
* Even if window raised up to infinity, do not send window open ACK
* in states, where we will not receive more. It is useless.
*/
if (copied > 0 && !time_to_ack && !(sk->sk_shutdown & RCV_SHUTDOWN)) {
__u32 rcv_window_now = tcp_receive_window(tp);
/* Optimize, __tcp_select_window() is not cheap. */
if (2*rcv_window_now <= tp->window_clamp) {
__u32 new_window = __tcp_select_window(sk);
/* Send ACK now, if this read freed lots of space
* in our buffer. Certainly, new_window is new window.
* We can advertise it now, if it is not less than current one.
* "Lots" means "at least twice" here.
*/
if (new_window && new_window >= 2 * rcv_window_now)
time_to_ack = true;
}
}
if (time_to_ack)
tcp_send_ack(sk);
}
边栏推荐
- Capture the whole process of accessing web pages through Wireshark
- ping: www.baidu.com: 未知的名称或服务
- What does virtualization mean? What technologies are included? What is the difference with private cloud?
- Is the waiting insurance record a waiting insurance evaluation? What is the relationship between the two?
- Power apps Guide
- Network layer
- Smooth live broadcast | analysis of key technologies for live broadcast pain points
- Basic database syntax learning
- The first day of handwritten RPC -- review of some basic knowledge
- Learn together and make progress together. Welcome to exchange
猜你喜欢

Pytest test framework II

After 5 months' test, it took 15K to come for an interview. When I asked, it was not worth even 5K. It was really

Pytest testing framework

Limit summary (under update)

memcached全面剖析–3. memcached的删除机制和发展方向

Dynamic routing protocol rip, OSPF

Basic database syntax learning

Postman assertion

虚拟货币7个月蒸发2万亿美元,“马斯克们”终结15万人暴富梦

After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
随机推荐
网络安全审查办公室对知网启动网络安全审查
Postman assertion
基于STM32的物联网下智能化养鱼鱼缸控制控制系统
NPM download speed is slow
memcached全面剖析–2. 理解memcached的内存存储
An example illustrates restful API
Golang daily question
Background of master data construction
Poj1061 frog dating (extended Euclid)
Different WordPress pages display different gadgets
Appium desktop introduction
Undo log and redo log must be clear this time
Nifi quick installation (stand-alone / cluster)
JUnit unit test
Typescript syntax
VIM usage
DHCP operation
Geek University cloud native training camp
Can the OPDS SQL component pass process parameters to the next component through context
Haitai Advanced Technology | application of privacy computing technology in medical data protection