From a78542f0c30a6d8a25b3a8c92fec61c04c3feeaf Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Tue, 22 Jan 2013 21:03:28 -0800 Subject: Bug 8024: Check for null/closed channel before probing. --- changes/bug7802 | 1 + src/or/circuitbuild.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/changes/bug7802 b/changes/bug7802 index 1d09757efe..9bc0f36fe1 100644 --- a/changes/bug7802 +++ b/changes/bug7802 @@ -8,3 +8,4 @@ - Remove a source of rounding error during path bias count scaling. - Don't count cannibalized circuits as used for path bias until we actually try to use them. + - Fix circuit_package_relay_cell warning message about n_chan==NULL. diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 97a26dd307..e3a9d59c0e 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1727,6 +1727,16 @@ pathbias_send_usable_probe(circuit_t *circ) return -1; } + /* Can't probe if the channel isn't open */ + if (circ->n_chan == NULL || + (circ->n_chan->state != CHANNEL_STATE_OPEN + && circ->n_chan->state != CHANNEL_STATE_MAINT)) { + log_info(LD_CIRC, + "Skipping pathbias probe for circuit %d: Channel is not open.", + ocirc->global_identifier); + return -1; + } + circuit_change_purpose(circ, CIRCUIT_PURPOSE_PATH_BIAS_TESTING); /* Update timestamp for when circuit_expire_building() should kill us */ -- cgit v1.2.3-54-g00ecf