From 839be0e316bf756ddccb9eba17b75c974440093c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 23 Dec 2021 00:08:12 +0100 Subject: [PATCH] Collect previous counter from failed stream resumption The server is allowed to keep the counter after the session has expired, which allows a final ack to know wheter in-transit stanzas were delivered or not. --- xmpp-vala/src/module/xep/0198_stream_management.vala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xmpp-vala/src/module/xep/0198_stream_management.vala b/xmpp-vala/src/module/xep/0198_stream_management.vala index 10709d18..5ce208f1 100644 --- a/xmpp-vala/src/module/xep/0198_stream_management.vala +++ b/xmpp-vala/src/module/xep/0198_stream_management.vala @@ -152,6 +152,11 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc { ((IoXmppStream)stream).write_obj = this; } else if (node.name == "failed") { session_id = null; + string? h_acked = node.get_attribute("h", NS_URI); + if (h_acked != null) { + h_outbound = int.parse(h_acked); + handle_incoming_h(stream, h_outbound); + } foreach (var id in in_flight_stanzas.keys) { in_flight_stanzas[id].promise.set_exception(new IOStreamError.WRITE("Stanza not acked and session not resumed")); }