Skip to content

Commit

Permalink
Start the pinger after fully connected, to avoid race with extdisco
Browse files Browse the repository at this point in the history
  • Loading branch information
jbg committed Apr 24, 2023
1 parent b3e300c commit 81ad5fe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/xmpp/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,6 @@ impl Connection {
info!("My JID: {}", jid);
locked_inner.jid = Some(jid.clone());

locked_inner
.stanza_filters
.push(Box::new(Pinger::new(jid.clone(), tx.clone())));

let iq = Iq::from_get(generate_id(), DiscoInfoQuery { node: None })
.with_from(Jid::Full(jid.clone()))
.with_to(Jid::Bare(locked_inner.xmpp_domain.clone()));
Expand Down Expand Up @@ -357,6 +353,12 @@ impl Connection {
if let Some(tx) = locked_inner.connected_tx.take() {
tx.send(()).unwrap();
}

let jid = locked_inner.jid.as_ref().unwrap().clone();
locked_inner
.stanza_filters
.push(Box::new(Pinger::new(jid, tx.clone())));

locked_inner.state = Idle;
},
Idle => {
Expand Down

0 comments on commit 81ad5fe

Please sign in to comment.