Software /
code /
prosody
Comparison
plugins/mod_s2s.lua @ 11609:6dcc45a2e3bc
mod_s2s: Bail if connection is destroyed after attempting to open stream
Fixes "attempt to compare number with nil" because `session.version` has
been cleared by s2smanager.destroy_session.
This can happen with the server_epoll setting opportunistic_writes
enabled, which means that it can notice that the connection failed at
this point, after which it triggers the whole chain of events that leads
to session destruction and "cleaning" most of the session fields.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 16 Jun 2021 23:53:00 +0200 |
parent | 11608:b2610460d9ab |
child | 11623:cce5191a65a7 |
comparison
equal
deleted
inserted
replaced
11608:b2610460d9ab | 11609:6dcc45a2e3bc |
---|---|
459 return; | 459 return; |
460 end | 460 end |
461 end | 461 end |
462 | 462 |
463 session:open_stream(session.to_host, session.from_host) | 463 session:open_stream(session.to_host, session.from_host) |
464 if session.destroyed then | |
465 -- sending the stream opening could have failed during an opportunistic write | |
466 return | |
467 end | |
468 | |
464 session.notopen = nil; | 469 session.notopen = nil; |
465 if session.version >= 1.0 then | 470 if session.version >= 1.0 then |
466 local features = st.stanza("stream:features"); | 471 local features = st.stanza("stream:features"); |
467 | 472 |
468 if to then | 473 if to then |