From 3cb69a9ce4df28d7b8e6b0a6bd3c29dc28c2102b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 14 Oct 2007 08:48:54 +0000 Subject: [PATCH] r15762@catbus: nickm | 2007-10-14 04:33:10 -0400 Minimal backport for r11882: Fix bug 451 by bailing out of connection_finish_flushing when there is no socket or write_event. svn:r11927 --- ChangeLog | 4 ++++ doc/TODO.012 | 2 +- src/or/connection.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5891698433..494f56bdb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ Changes in version 0.1.2.18 - 2007-??-?? connections: they specify their chosen rendezvous point by identity digest rather than by (potentially ambiguous) nickname. These changes could speed up hidden service connections dramatically. + - If a connection is shut down abruptly because of something that + happened inside connection_flushed_some(), do not call + connection_finished_flushing(). Should fix bug 451. Bugfix on + 0.1.2.7-alpha. o Minor bugfixes: - Don't try to access (or alter) the state file when running diff --git a/doc/TODO.012 b/doc/TODO.012 index 6126f3e966..9a03d4ba52 100644 --- a/doc/TODO.012 +++ b/doc/TODO.012 @@ -4,7 +4,7 @@ description of the patch.) Backport items for 0.1.2: o r11166: Don't believe future dates from the state file. o r11828+: Detect bad sa_family from accept(). -N - r11882: Avoid crash-bug 451. + o r11882: Avoid crash-bug 451. N - r11886: Consider family as well as identity when cannibalizing circuits. diff --git a/src/or/connection.c b/src/or/connection.c index e92345aeb3..e7c2365595 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -2289,6 +2289,9 @@ connection_finished_flushing(connection_t *conn) { tor_assert(conn); + if (conn->s < 0 || !conn->write_event) + return 0; + // log_fn(LOG_DEBUG,"entered. Socket %u.", conn->s); switch (conn->type) {