diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-12-11 16:02:10 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-11 16:02:10 -0500 |
commit | 252db6ad26900235f8904fa6b8d510551b9176cf (patch) | |
tree | 6105b6089e1a8c9dafb5d54e6d5ffabb18b7f445 /src/or/scheduler_kist.c | |
parent | ea929e8456d065a25d7eb5e2e0e41e0f303ebe9d (diff) | |
parent | 057139d3830bb94df8031bb6e8e385cef53352bc (diff) | |
download | tor-252db6ad26900235f8904fa6b8d510551b9176cf.tar.gz tor-252db6ad26900235f8904fa6b8d510551b9176cf.zip |
Merge branch 'maint-0.3.2'
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r-- | src/or/scheduler_kist.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c index e02926e478..7028b7fa89 100644 --- a/src/or/scheduler_kist.c +++ b/src/or/scheduler_kist.c @@ -264,10 +264,13 @@ update_socket_info_impl, (socket_table_ent_t *ent)) * ^ ((cwnd * mss) * factor) bytes */ - /* Assuming all these values from the kernel are uint32_t still, they will - * always fit into a int64_t tcp_space variable. */ - tcp_space = (ent->cwnd - ent->unacked) * (int64_t)ent->mss; - if (tcp_space < 0) { + /* These values from the kernel are uint32_t, they will always fit into a + * 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. */ + if (ent->cwnd >= ent->unacked) { + tcp_space = (ent->cwnd - ent->unacked) * (int64_t)(ent->mss); + } else { tcp_space = 0; } |