stanzastream: actually count stanzas in stream management
Looks like a horrible oversight. And this will need tests, but I'm short on time right now. Fixes #170.
This commit is contained in:
parent
3bda04124e
commit
a1ade974b0
4 changed files with 13 additions and 0 deletions
|
|
@ -8,6 +8,8 @@ Version NEXT:
|
|||
- Gate `AsRawFd` behind `ktls` feature to make Windows build work again.
|
||||
- Implicitly use the `Client`'s bound JID on empty `to` in tokio-xmpp's
|
||||
`IqResponseTracker`.
|
||||
- Actually count inbound stream management stanzas (!657) instead of
|
||||
always sending h='0' in our `<a/>`.
|
||||
|
||||
Version 5.0.0:
|
||||
2025-10-28 pep <pep@bouah.net>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ pub(crate) fn make_id() -> String {
|
|||
}
|
||||
|
||||
/// A stanza sent/received over the stream.
|
||||
// WARNING: do not add variants to this enum! Adding variants which refer
|
||||
// to anything but IQ, Message or Presence stanzas will cause the
|
||||
// stream management counters to be off.
|
||||
#[derive(FromXml, AsXml, Debug, PartialEq)]
|
||||
#[xml()]
|
||||
pub enum Stanza {
|
||||
|
|
|
|||
|
|
@ -543,6 +543,9 @@ impl ConnectedState {
|
|||
match item {
|
||||
// Easy case, we got some data.
|
||||
Ok(XmppStreamElement::Stanza(data)) => {
|
||||
if let Some(sm_state) = sm_state.as_mut() {
|
||||
sm_state.received();
|
||||
}
|
||||
Poll::Ready(Some(ConnectedEvent::Worker(WorkerEvent::Stanza(data))))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -214,6 +214,11 @@ impl SmState {
|
|||
self.inbound_ctr
|
||||
}
|
||||
|
||||
/// Increase the inbound counter.
|
||||
pub fn received(&mut self) {
|
||||
self.inbound_ctr = self.inbound_ctr.wrapping_add(1);
|
||||
}
|
||||
|
||||
/// Get the info necessary for resumption.
|
||||
///
|
||||
/// Returns the stream ID and the current inbound counter if resumption is
|
||||
|
|
|
|||
Loading…
Reference in a new issue