plugins/mod_bosh.lua
changeset 8100 e24263db3380
parent 7662 449de852cf38
parent 8096 8d1fd6d34bda
child 8104 3e25d96571d1
child 8185 048a83433295
equal deleted inserted replaced
8099:dd3191974f2a 8100:e24263db3380
   279 		wait = math_min(wait, bosh_max_wait);
   279 		wait = math_min(wait, bosh_max_wait);
   280 
   280 
   281 		-- New session
   281 		-- New session
   282 		sid = new_uuid();
   282 		sid = new_uuid();
   283 		local session = {
   283 		local session = {
   284 			type = "c2s_unauthed", conn = {}, sid = sid, rid = rid, host = attr.to,
   284 			type = "c2s_unauthed", conn = request.conn, sid = sid, rid = rid, host = attr.to,
   285 			bosh_version = attr.ver, bosh_wait = wait, streamid = sid,
   285 			bosh_version = attr.ver, bosh_wait = wait, streamid = sid,
   286 			bosh_max_inactive = bosh_max_inactivity,
   286 			bosh_max_inactive = bosh_max_inactivity,
   287 			requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream,
   287 			requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream,
   288 			close = bosh_close_stream, dispatch_stanza = core_process_stanza, notopen = true,
   288 			close = bosh_close_stream, dispatch_stanza = core_process_stanza, notopen = true,
   289 			log = logger.init("bosh"..sid),	secure = consider_bosh_secure or request.secure,
   289 			log = logger.init("bosh"..sid),	secure = consider_bosh_secure or request.secure,
   351 		response:send(tostring(st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", condition = "item-not-found" })));
   351 		response:send(tostring(st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", condition = "item-not-found" })));
   352 		context.notopen = nil;
   352 		context.notopen = nil;
   353 		return;
   353 		return;
   354 	end
   354 	end
   355 
   355 
       
   356 	session.conn = request.conn;
       
   357 
   356 	if session.rid then
   358 	if session.rid then
   357 		local rid = tonumber(attr.rid);
   359 		local rid = tonumber(attr.rid);
   358 		local diff = rid - session.rid;
   360 		local diff = rid - session.rid;
   359 		-- Diff should be 1 for a healthy request
   361 		-- Diff should be 1 for a healthy request
   360 		if diff ~= 1 then
   362 		if diff ~= 1 then