Просмотр исходного кода

darkirc/command: Fix deadlock in welcome()

parazyd 2 лет назад
Родитель
Сommit
0e242915cf
2 измененных файлов с 4 добавлено и 1 удалено
  1. 1 1
      bin/darkirc/src/irc/client.rs
  2. 3 0
      bin/darkirc/src/irc/command.rs

+ 1 - 1
bin/darkirc/src/irc/client.rs

@@ -212,7 +212,7 @@ impl Client {
                     self.server.try_decrypt(&mut privmsg).await;
 
                     // If we have this channel, or it's a DM, forward it to the client.
-                    // As a DM, we consider something that is < MAX_NICK_LEN, and does not
+                    // As a DM, we consider something that is <= MAX_NICK_LEN, and does not
                     // start with the '#' character. With ChaCha, the ciphertext should be
                     // longer than our MAX_NICK_LEN, so in case it is garbled, it should be
                     // skipped by this code.

+ 3 - 0
bin/darkirc/src/irc/command.rs

@@ -914,6 +914,9 @@ impl Client {
             }
         }
 
+        // Drop the server.channels write lock, it's used in get_history.
+        drop(config_chans);
+
         // Potentially extend replies with history
         autojoin_chans.insert(self.nickname.read().await.to_string());
         replies.append(&mut self.get_history(&autojoin_chans).await.unwrap());