Mercurial > prosody-hg
comparison plugins/mod_tls.lua @ 11519:df4bd3af4099
mod_tls: Bail out if session got destroyed while sending <proceed/>
Can happen in case opportunistic_writes is enabled and the session got
destroyed while writing that tag.
Thanks Ge0rG
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 15 Apr 2021 15:57:24 +0200 |
| parents | c567e5e2b77a |
| children | a90389e7296c |
comparison
equal
deleted
inserted
replaced
| 11518:3f1a865e9419 | 11519:df4bd3af4099 |
|---|---|
| 119 -- Hook <starttls/> | 119 -- Hook <starttls/> |
| 120 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event) | 120 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event) |
| 121 local origin = event.origin; | 121 local origin = event.origin; |
| 122 if can_do_tls(origin) then | 122 if can_do_tls(origin) then |
| 123 (origin.sends2s or origin.send)(starttls_proceed); | 123 (origin.sends2s or origin.send)(starttls_proceed); |
| 124 if origin.destroyed then return end | |
| 124 origin:reset_stream(); | 125 origin:reset_stream(); |
| 125 origin.conn:starttls(origin.ssl_ctx); | 126 origin.conn:starttls(origin.ssl_ctx); |
| 126 origin.log("debug", "TLS negotiation started for %s...", origin.type); | 127 origin.log("debug", "TLS negotiation started for %s...", origin.type); |
| 127 origin.secure = false; | 128 origin.secure = false; |
| 128 else | 129 else |
