]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
count flushing as channel activity
authorRoger Dingledine <arma@torproject.org>
Wed, 31 Jan 2018 10:26:06 +0000 (05:26 -0500)
committerRoger Dingledine <arma@torproject.org>
Wed, 31 Jan 2018 10:26:06 +0000 (05:26 -0500)
Stop adding unneeded channel padding right after we finish flushing
to a connection that has been trying to flush for many seconds.
Instead, treat all partial or complete flushes as activity on the
channel, which will defer the time until we need to add padding.

This fix should resolve confusing and scary log messages like
"Channel padding timeout scheduled 221453ms in the past."

Fixes bug 22212; bugfix on 0.3.1.1-alpha.

I think technically we could resolve bug 22212 by adding a call to
channel_timestamp_active() only in the finished_flushing case. But I added
a call in the flushed_some case too since that seems to more accurately
reflect the notion of "active".

changes/bug22212-forreal [new file with mode: 0644]
src/or/connection_or.c

diff --git a/changes/bug22212-forreal b/changes/bug22212-forreal
new file mode 100644 (file)
index 0000000..3b7e3ca
--- /dev/null
@@ -0,0 +1,8 @@
+  o Major bugfixes:
+    - Stop adding unneeded channel padding right after we finish flushing
+      to a connection that has been trying to flush for many seconds.
+      Instead, treat all partial or complete flushes as activity on the
+      channel, which will defer the time until we need to add padding.
+      This fix should resolve confusing and scary log messages like
+      "Channel padding timeout scheduled 221453ms in the past." Fixes
+      bug 22212; bugfix on 0.3.1.1-alpha.
index fcd281da2605b92f1f854d906160083cc2b3683d..85459b62e8ba4294805b1136f98dde55d767cb00 100644 (file)
@@ -591,6 +591,10 @@ connection_or_flushed_some(or_connection_t *conn)
 {
   size_t datalen;
 
+  /* Update the channel's active timestamp if there is one */
+  if (conn->chan)
+    channel_timestamp_active(TLS_CHAN_TO_BASE(conn->chan));
+
   /* The channel will want to update its estimated queue size */
   channel_update_xmit_queue_size(TLS_CHAN_TO_BASE(conn->chan));
 
@@ -654,6 +658,11 @@ connection_or_finished_flushing(or_connection_t *conn)
       tor_fragile_assert();
       return -1;
   }
+
+  /* Update the channel's active timestamp if there is one */
+  if (conn->chan)
+    channel_timestamp_active(TLS_CHAN_TO_BASE(conn->chan));
+
   return 0;
 }