If we have almost filled the congestion window but have more data in the
send buffer than we can send right now, wait until the congestion window
frees up to avoid sending small packets unnecessarily.
assert(left >= 0);
- if(cwndleft < 0) {
+ if(cwndleft <= 0) {
left = 0;
} else if(cwndleft < left) {
left = cwndleft;
+
+ if(!sendatleastone || cwndleft > c->utcp->mtu) {
+ left -= left % c->utcp->mtu;
+ }
}
debug("cwndleft = %d, left = %d\n", cwndleft, left);