Browse Source

Merge remote-tracking branch 'origin/maint-0.2.4'

Nick Mathewson 10 years ago
parent
commit
566645b5ed
3 changed files with 17 additions and 1 deletions
  1. 8 0
      changes/bug9880
  2. 6 1
      src/or/channel.c
  3. 3 0
      src/or/channel.h

+ 8 - 0
changes/bug9880

@@ -0,0 +1,8 @@
+  o Minor bugfixes:
+
+    - When closing a channel that has already been open, do not close
+      pending circuits that were waiting to connect to the same relay.
+      Fixes bug 9880; bugfix on 0.2.5.1-alpha. Thanks to skruffy for
+      finding this bug.  (Bug was merged to 0.2.4 branch but not released
+      in any 0.2.4 version)
+

+ 6 - 1
src/or/channel.c

@@ -745,6 +745,9 @@ channel_init(channel_t *chan)
 
   /* Timestamp it */
   channel_timestamp_created(chan);
+
+  /* It hasn't been open yet. */
+  chan->has_been_open = 0;
 }
 
 /**
@@ -1297,7 +1300,8 @@ channel_closed(channel_t *chan)
 
   /* Inform any pending (not attached) circs that they should
    * give up. */
-  circuit_n_chan_done(chan, 0);
+  if (! chan->has_been_open)
+    circuit_n_chan_done(chan, 0);
 
   /* Now close all the attached circuits on it. */
   circuit_unlink_all_from_channel(chan, END_CIRC_REASON_CHANNEL_CLOSED);
@@ -1945,6 +1949,7 @@ channel_change_state(channel_t *chan, channel_state_t to_state)
   /* Tell circuits if we opened and stuff */
   if (to_state == CHANNEL_STATE_OPEN) {
     channel_do_open_actions(chan);
+    chan->has_been_open = 1;
 
     /* Check for queued cells to process */
     if (! TOR_SIMPLEQ_EMPTY(&chan->incoming_queue))

+ 3 - 0
src/or/channel.h

@@ -45,6 +45,9 @@ struct channel_s {
   /* Should we expect to see this channel in the channel lists? */
   unsigned char registered:1;
 
+  /** has this channel ever been open? */
+  unsigned int has_been_open:1;
+
   /** Why did we close?
    */
   enum {