[tor-commits] [tor/master] count flushing as channel activity

nickm at torproject.org nickm at torproject.org
Tue Feb 6 16:48:14 UTC 2018


commit 3d9dcb49eb50b6c4681e66c847a320ace1d1c843
Author: Roger Dingledine <arma at torproject.org>
Date:   Wed Jan 31 05:26:06 2018 -0500

    count flushing as channel activity
    
    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 | 8 ++++++++
 src/or/connection_or.c   | 9 +++++++++
 2 files changed, 17 insertions(+)

diff --git a/changes/bug22212-forreal b/changes/bug22212-forreal
new file mode 100644
index 000000000..3b7e3ca0e
--- /dev/null
+++ b/changes/bug22212-forreal
@@ -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.
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index fcd281da2..85459b62e 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -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;
 }
 





More information about the tor-commits mailing list