Software /
code /
prosody
Comparison
plugins/mod_bosh.lua @ 8093:8d1fd6d34bda
mod_bosh: Update session.conn to point to the current connection (fixes #890)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 17 Apr 2017 21:40:06 +0200 |
parent | 5727:372ecf3630cf |
child | 8097:e24263db3380 |
comparison
equal
deleted
inserted
replaced
8002:57060d0cee4b | 8093:8d1fd6d34bda |
---|---|
245 end | 245 end |
246 | 246 |
247 -- New session | 247 -- New session |
248 sid = new_uuid(); | 248 sid = new_uuid(); |
249 local session = { | 249 local session = { |
250 type = "c2s_unauthed", conn = {}, sid = sid, rid = tonumber(attr.rid)-1, host = attr.to, | 250 type = "c2s_unauthed", conn = request.conn, sid = sid, rid = tonumber(attr.rid)-1, host = attr.to, |
251 bosh_version = attr.ver, bosh_wait = math_min(attr.wait, bosh_max_wait), streamid = sid, | 251 bosh_version = attr.ver, bosh_wait = math_min(attr.wait, bosh_max_wait), streamid = sid, |
252 bosh_hold = BOSH_DEFAULT_HOLD, bosh_max_inactive = BOSH_DEFAULT_INACTIVITY, | 252 bosh_hold = BOSH_DEFAULT_HOLD, bosh_max_inactive = BOSH_DEFAULT_INACTIVITY, |
253 requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream, | 253 requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream, |
254 close = bosh_close_stream, dispatch_stanza = core_process_stanza, notopen = true, | 254 close = bosh_close_stream, dispatch_stanza = core_process_stanza, notopen = true, |
255 log = logger.init("bosh"..sid), secure = consider_bosh_secure or request.secure, | 255 log = logger.init("bosh"..sid), secure = consider_bosh_secure or request.secure, |
314 response.headers = default_headers; | 314 response.headers = default_headers; |
315 response:send(tostring(st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", condition = "item-not-found" }))); | 315 response:send(tostring(st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", condition = "item-not-found" }))); |
316 context.notopen = nil; | 316 context.notopen = nil; |
317 return; | 317 return; |
318 end | 318 end |
319 | |
320 session.conn = request.conn; | |
319 | 321 |
320 if session.rid then | 322 if session.rid then |
321 local rid = tonumber(attr.rid); | 323 local rid = tonumber(attr.rid); |
322 local diff = rid - session.rid; | 324 local diff = rid - session.rid; |
323 if diff > 1 then | 325 if diff > 1 then |