Mercurial > prosody-hg
comparison plugins/mod_c2s.lua @ 7542:0f92dc8e8b88
Merge 0.10->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 08 Aug 2016 16:41:09 +0200 |
| parents | 9a73c85baffe e69df8093387 |
| children | 03aa330562ed |
comparison
equal
deleted
inserted
replaced
| 7536:3f8520b59677 | 7542:0f92dc8e8b88 |
|---|---|
| 259 | 259 |
| 260 local filter = session.filter; | 260 local filter = session.filter; |
| 261 function session.data(data) | 261 function session.data(data) |
| 262 -- Parse the data, which will store stanzas in session.pending_stanzas | 262 -- Parse the data, which will store stanzas in session.pending_stanzas |
| 263 if data then | 263 if data then |
| 264 data = filter("bytes/in", data); | 264 data = filter("bytes/in", data); |
| 265 if data then | 265 if data then |
| 266 local ok, err = stream:feed(data); | 266 local ok, err = stream:feed(data); |
| 267 if not ok then | 267 if not ok then |
| 268 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); | 268 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); |
| 269 session:close("not-well-formed"); | 269 session:close("not-well-formed"); |
| 270 end | 270 end |
| 271 end | 271 end |
| 307 return (hosts[session.host] or prosody).events.fire_event("c2s-read-timeout", { session = session }); | 307 return (hosts[session.host] or prosody).events.fire_event("c2s-read-timeout", { session = session }); |
| 308 end | 308 end |
| 309 end | 309 end |
| 310 | 310 |
| 311 local function keepalive(event) | 311 local function keepalive(event) |
| 312 return event.session.send(' '); | 312 local session = event.session; |
| 313 if not session.notopen then | |
| 314 return event.session.send(' '); | |
| 315 end | |
| 313 end | 316 end |
| 314 | 317 |
| 315 function listener.associate_session(conn, session) | 318 function listener.associate_session(conn, session) |
| 316 sessions[conn] = session; | 319 sessions[conn] = session; |
| 317 end | 320 end |
