[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Stop clearing the is_client flag on channel directly



commit d1e0e486e9eafa7ba44e3ed49ce1b92fec9c7201
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Sep 6 14:55:58 2017 -0400

    Stop clearing the is_client flag on channel directly
---
 src/or/channel.c | 14 ++++++++++++++
 src/or/channel.h |  1 +
 src/or/command.c |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/or/channel.c b/src/or/channel.c
index 9f8a03683..ea113903a 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -4097,6 +4097,20 @@ channel_mark_client(channel_t *chan)
 }
 
 /**
+ * Clear the client flag
+ *
+ * Mark a channel as being _not_ from a client
+ */
+
+void
+channel_clear_client(channel_t *chan)
+{
+  tor_assert(chan);
+
+  chan->is_client = 0;
+}
+
+/**
  * Get the canonical flag for a channel
  *
  * This returns the is_canonical for a channel; this flag is determined by
diff --git a/src/or/channel.h b/src/or/channel.h
index 2d0ec3992..a5a87de13 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -671,6 +671,7 @@ int channel_is_local(channel_t *chan);
 int channel_is_incoming(channel_t *chan);
 int channel_is_outgoing(channel_t *chan);
 void channel_mark_client(channel_t *chan);
+void channel_clear_client(channel_t *chan);
 int channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info);
 int channel_matches_target_addr_for_extend(channel_t *chan,
                                            const tor_addr_t *target);
diff --git a/src/or/command.c b/src/or/command.c
index 2c8298490..46d3b6291 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -331,7 +331,7 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
     // Needed for chutney: Sometimes relays aren't in the consensus yet, and
     // get marked as clients. This resets their channels once they appear.
     // Probably useful for normal operation wrt relay flapping, too.
-    chan->is_client = 0;
+    channel_clear_client(chan);
   } else {
     channel_mark_client(chan);
   }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits