diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2017-11-05 09:40:22 -0500 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2017-11-24 12:42:51 -0500 |
commit | 2cda005ac49dcf02d2cfe358f8c75129a0f2f3bf (patch) | |
tree | a978a6399974e032be3cdaf77fd7a85e953a1527 /src/or/channel.c | |
parent | bf8a7201cea0dcd4da91cd67015bbdabc38c395a (diff) | |
download | tor-2cda005ac49dcf02d2cfe358f8c75129a0f2f3bf.tar.gz tor-2cda005ac49dcf02d2cfe358f8c75129a0f2f3bf.zip |
Add fast paths to channel_rsa_id_group_set_badness, #24119
Diffstat (limited to 'src/or/channel.c')
-rw-r--r-- | src/or/channel.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/or/channel.c b/src/or/channel.c index 0b5a7fde90..acd890c72b 100644 --- a/src/or/channel.c +++ b/src/or/channel.c @@ -4734,7 +4734,17 @@ static void channel_rsa_id_group_set_badness(struct channel_list_s *lst, int force) { /*XXXX This function should really be about channels. 15056 */ - channel_t *chan; + channel_t *chan = TOR_LIST_FIRST(lst); + + if (!chan) + return; + + /* if there is only one channel, don't bother looping */ + if (PREDICT_LIKELY(!TOR_LIST_NEXT(chan, next_with_same_id))) { + connection_or_single_set_badness_( + time(NULL), BASE_CHAN_TO_TLS(chan)->conn, force); + return; + } /* First, get a minimal list of the ed25519 identites */ smartlist_t *ed_identities = smartlist_new(); |