Explorar o código

bin/ircd2: fix an issue that caused unread be received multiple times when first connect to client

Dastan-glitch %!s(int64=3) %!d(string=hai) anos
pai
achega
274ddafb97
Modificáronse 1 ficheiros con 11 adicións e 15 borrados
  1. 11 15
      bin/ircd2/src/irc/client.rs

+ 11 - 15
bin/ircd2/src/irc/client.rs

@@ -557,23 +557,19 @@ impl<C: AsyncRead + AsyncWrite + Send + Unpin + 'static> IrcClient<C> {
                 self.reply(&j).await?;
                 self.reply(&t).await?;
             }
+        }
+        // Process missed messages if any (sorted by event's timestamp)
+        let unread_events = self.unread_events.lock().await.events.clone();
 
-            // Process missed messages if any (sorted by event's timestamp)
-            let unread_events = self.unread_events.lock().await.events.clone();
+        let mut hash_vec: Vec<Event> = unread_events.values().cloned().collect();
+        hash_vec.sort_by(|a, b| a.timestamp.cmp(&b.timestamp));
 
-            let chan_info = self.irc_config.channels.get_mut(chan).unwrap();
-            if chan_info.joined {
-                let mut hash_vec: Vec<Event> = unread_events.values().cloned().collect();
-                hash_vec.sort_by(|a, b| a.timestamp.cmp(&b.timestamp));
-
-                for event in hash_vec {
-                    match event.action {
-                        EventAction::PrivMsg(mut m) => {
-                            if let Err(e) = self.process_msg(&mut m).await {
-                                error!("[CLIENT {}] Process msg: {}", self.address, e);
-                                break
-                            }
-                        }
+        for event in hash_vec {
+            match event.action {
+                EventAction::PrivMsg(mut m) => {
+                    if let Err(e) = self.process_msg(&mut m).await {
+                        error!("[CLIENT {}] Process msg: {}", self.address, e);
+                        break
                     }
                 }
             }