|
@@ -266,8 +266,7 @@ update_socket_info_impl, (socket_table_ent_t *ent))
|
|
|
|
|
|
|
|
|
* int64_t tcp_space variable but if the congestion window cwnd is smaller
|
|
|
- * than the unacked packets, the remaining TCP space is set to 0 so we don't
|
|
|
- * write more on this channel. */
|
|
|
+ * than the unacked packets, the remaining TCP space is set to 0. */
|
|
|
if (ent->cwnd >= ent->unacked) {
|
|
|
tcp_space = (ent->cwnd - ent->unacked) * (int64_t)(ent->mss);
|
|
|
} else {
|
|
@@ -276,20 +275,21 @@ update_socket_info_impl, (socket_table_ent_t *ent))
|
|
|
|
|
|
|
|
|
* In fact, if sock_buf_size_factor is still forced to be >= 0 in config.c,
|
|
|
- * then it will be positive for sure. Then we subtract a uint32_t. At worst
|
|
|
- * we end up negative, but then we just set extra_space to 0 in the sanity
|
|
|
- * check.*/
|
|
|
+ * then it will be positive for sure. Then we subtract a uint32_t. Getting a
|
|
|
+ * negative value is OK, see after how it is being handled. */
|
|
|
extra_space =
|
|
|
clamp_double_to_int64(
|
|
|
(ent->cwnd * (int64_t)ent->mss) * sock_buf_size_factor) -
|
|
|
ent->notsent;
|
|
|
- if (extra_space < 0) {
|
|
|
- extra_space = 0;
|
|
|
+ if ((tcp_space + extra_space) < 0) {
|
|
|
+
|
|
|
+ * more in the kernel for now. */
|
|
|
+ ent->limit = 0;
|
|
|
+ } else {
|
|
|
+
|
|
|
+ * And we know this will always be positive. */
|
|
|
+ ent->limit = (uint64_t)tcp_space + (uint64_t)extra_space;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * fit in an uint64_t. */
|
|
|
- ent->limit = (uint64_t)tcp_space + (uint64_t)extra_space;
|
|
|
return;
|
|
|
|
|
|
#else
|