]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
sched: add comment about how we determine if a socket should write
authorMatt Traudt <sirmatt@ksu.edu>
Fri, 15 Sep 2017 14:28:52 +0000 (10:28 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Fri, 15 Sep 2017 15:40:59 +0000 (11:40 -0400)
src/or/scheduler_kist.c

index 3a897f5bfec1df3f4abafc783a456e67b64e6cdf..913cb4dce6de22a04203243dd3b99a182a1e5d8a 100644 (file)
@@ -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);