From 3d9dcb49eb50b6c4681e66c847a320ace1d1c843 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Wed, 31 Jan 2018 05:26:06 -0500 Subject: [PATCH] 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(+) create mode 100644 changes/bug22212-forreal diff --git a/changes/bug22212-forreal b/changes/bug22212-forreal new file mode 100644 index 0000000000..3b7e3ca0eb --- /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 fcd281da26..85459b62e8 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; }