Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/ofp_tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,20 @@ ofp_tcp_output(struct tcpcb *tp)
th->th_off = (sizeof (struct ofp_tcphdr) + optlen) >> 2;
}
th->th_flags = flags;

/*
* Make sure to send the "real" so->so_rcv containing space.
* Unlike the FreeBSD stack,
* we shrink the receive window packet-by-packet, not byte-by-byte.
* So we cannot use (long)(tp->rcv_adv - tp->rcv_nxt)) to calculate the size of the window.
* Also, since recwin varies packet-by-packet,
* we don't need to care about silly window syndrome,
* since it always has a minimum delta of global_param->pkt_pool.buffer_size.
*/
/* Actually it should be recwin = recwin * tp->t_maxseg / global_param->pkt_pool.buffer_size
* But whatever. Just reduce the calculation here
*/
#if 0
/*
* Calculate receive window. Don't shrink window,
* but avoid silly window syndrome.
Expand All @@ -1024,6 +1038,7 @@ ofp_tcp_output(struct tcpcb *tp)
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
recwin < (long)(tp->rcv_adv - tp->rcv_nxt))
recwin = (long)(tp->rcv_adv - tp->rcv_nxt);
#endif
if (recwin > (long)OFP_TCP_MAXWIN << tp->rcv_scale)
recwin = (long)OFP_TCP_MAXWIN << tp->rcv_scale;

Expand Down