Browse Source

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".
Roger Dingledine 6 years ago
parent
commit
3d9dcb49eb
2 changed files with 17 additions and 0 deletions
  1. 8 0
      changes/bug22212-forreal
  2. 9 0
      src/or/connection_or.c

+ 8 - 0
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.

+ 9 - 0
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;
 }