Merge pull request #3232 from guusdk/OF-3176_Schedule-dont-drop-s2s-stanza-after-async-connection-closure OF-3176: Fix stanza loss during outgoing S2S session teardown
OF-3176: Fix stanza loss during outgoing S2S session teardown
When an outgoing server-to-server (S2S) connection closes, the connection is marked closed immediately, but route removal from the routing table happens asynchronously during teardown. This creates a short race window where routing can still send stanzas to a closing session, which then sees a closed connection and drops the stanza.
This change fixes that behavior by waiting for teardown to fully complete before re-routing a stanza that reached a closed outgoing session. Waiting for close completion ensures stale route cleanup has finished, after which normal routing can use an existing replacement session or create a new one.
A new system property, xmpp.server.session.redelivery-timeout (default: 30 seconds), controls how long Openfire waits for teardown completion before returning an error to the sender.