- request:send(tostring(st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", condition = "item-not-found" })));
+ request:send{ headers = default_headers, body = tostring(st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", condition = "item-not-found" })) };
+ request.notopen = nil;
+ return;
+ end
+
+ if session.rid then
+ local rid = tonumber(attr.rid);
+ local diff = rid - session.rid;
+ if diff > 1 then
+ session.log("warn", "rid too large (means a request was lost). Last rid: %d New rid: %s", session.rid, attr.rid);
+ elseif diff <= 0 then
+ -- Repeated, ignore
+ session.log("debug", "rid repeated (on request %s), ignoring: %d", request.id, session.rid);
+ request.notopen = nil;
+ t_insert(session.requests, request);
+ return;
+ end
+ session.rid = rid;
+ end
+
+ if attr.type == "terminate" then
+ -- Client wants to end this session
+ session:close();