当前位置:网站首页>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);
}
边栏推荐
- DAPP system customization of full chain hash game (scheme design)
- NPM download speed is slow
- Logical backup: mysqldump vs physical backup: xtrabackup
- Summary of message protocol problems
- After 5 months' test, it took 15K to come for an interview. When I asked, it was not worth even 5K. It was really
- How Fiddler works
- Record a deletion bash_ Profile file
- Oauth1.0 introduction
- Hongxiang Yunteng is compatible with dragon lizard operating system, and the product runs stably
- JMeter implementation specifies concurrent loop testing
猜你喜欢

A/b test helps the growth of game business

Create a multithreaded thread class

基于STM32的物联网下智能化养鱼鱼缸控制控制系统

Curl command

A/B测试助力游戏业务增长

What does virtualization mean? What technologies are included? What is the difference with private cloud?

How Fiddler works

ping: www.baidu.com: 未知的名称或服务

Alibaba cloud schedules tasks and automatically releases them

Appium desktop introduction
随机推荐
Apple mobile phone can see some fun ways to install IPA package
I just purchased a MySQL database and prompted that there are already instances. The console login instance needs to provide a database account. How do I know the database account.
PIXIV Gizmo
Axi DMA IP core operation process
data link layer
[cloud native learning notes] learn about kubernetes' pod
Rewrite, maplocal and maplocal operations of Charles
Pod lifecycle in kubernetes
2021-09-30
Auto. JS to automatically authorize screen capture permission
188. 买卖股票的最佳时机 IV
What will you do if you have been ignored by your leaders at work?
Golang reflection operation collation
Reflection - class object function - get method (case)
Read all text from stdin to a string
Limit summary (under update)
memcached全面剖析–3. memcached的删除机制和发展方向
Distributed basic concepts
how to install clustershell
Common self realization functions in C language development