Software /
code /
prosody
Comparison
plugins/mod_c2s.lua @ 10013:62d8689beafb 0.11
mod_c2s: Associate connection with session last (fixes #1313)
This way, any fatal error in the callback will not leave a
half-established session.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 18 May 2019 17:45:20 +0200 |
parent | 9490:6e4fbd12c11c |
child | 10017:994cccebb597 |
child | 11118:ece430d49809 |
comparison
equal
deleted
inserted
replaced
10012:acf4a7bfb6aa | 10013:62d8689beafb |
---|---|
237 end | 237 end |
238 | 238 |
239 --- Port listener | 239 --- Port listener |
240 function listener.onconnect(conn) | 240 function listener.onconnect(conn) |
241 local session = sm_new_session(conn); | 241 local session = sm_new_session(conn); |
242 sessions[conn] = session; | |
243 | 242 |
244 session.log("info", "Client connected"); | 243 session.log("info", "Client connected"); |
245 | 244 |
246 -- Client is using legacy SSL (otherwise mod_tls sets this flag) | 245 -- Client is using legacy SSL (otherwise mod_tls sets this flag) |
247 if conn:ssl() then | 246 if conn:ssl() then |
298 end | 297 end |
299 end); | 298 end); |
300 end | 299 end |
301 | 300 |
302 session.dispatch_stanza = stream_callbacks.handlestanza; | 301 session.dispatch_stanza = stream_callbacks.handlestanza; |
302 | |
303 sessions[conn] = session; | |
303 end | 304 end |
304 | 305 |
305 function listener.onincoming(conn, data) | 306 function listener.onincoming(conn, data) |
306 local session = sessions[conn]; | 307 local session = sessions[conn]; |
307 if session then | 308 if session then |