summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Traudt <sirmatt@ksu.edu>2017-09-15 10:28:52 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-09-15 11:40:59 -0400
commitae9e6b547df8efe3eab40237cb4646e158d4d8b0 (patch)
tree8e4928adb7179406886016bc9615b2793c7cb62c
parent47390d1c9e16cd5973e10896e46c2ef13fc617fb (diff)
downloadtor-ae9e6b547df8efe3eab40237cb4646e158d4d8b0.tar.gz
tor-ae9e6b547df8efe3eab40237cb4646e158d4d8b0.zip
sched: add comment about how we determine if a socket should write
-rw-r--r--src/or/scheduler_kist.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index 3a897f5bfe..913cb4dce6 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -375,6 +375,10 @@ socket_can_write(socket_table_t *table, const channel_t *chan)
return 1; // Just return true, saying that kist wouldn't limit the socket
}
+ /* We previously caclulated a write limit for this socket. In the below
+ * calculation, first determine how much room is left in bytes. Then divide
+ * that by the amount of space a cell takes. If there's room for at least 1
+ * cell, then KIST will allow the socket to write. */
int64_t kist_limit_space =
(int64_t) (ent->limit - ent->written) /
(CELL_MAX_NETWORK_SIZE + TLS_PER_CELL_OVERHEAD);