Software /
code /
prosody
Changeset
9908:7d12af856238
sessionmanager: Split byte-level sending into separate session.rawsend
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 24 Mar 2019 08:18:19 +0000 |
parents | 9907:54e36a8677bc |
children | 9909:3229be01a08a |
files | core/sessionmanager.lua |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/core/sessionmanager.lua Fri Jan 04 10:20:51 2019 +0100 +++ b/core/sessionmanager.lua Sun Mar 24 08:18:19 2019 +0000 @@ -32,20 +32,26 @@ local session = { conn = conn, type = "c2s_unauthed", conntime = gettime() }; local filter = initialize_filters(session); local w = conn.write; + + function session.rawsend(t) + t = filter("bytes/out", tostring(t)); + if t then + local ret, err = w(conn, t); + if not ret then + session.log("debug", "Error writing to connection: %s", tostring(err)); + return false, err; + end + end + return true; + end + session.send = function (t) session.log("debug", "Sending[%s]: %s", session.type, t.top_tag and t:top_tag() or t:match("^[^>]*>?")); if t.name then t = filter("stanzas/out", t); end if t then - t = filter("bytes/out", tostring(t)); - if t then - local ret, err = w(conn, t); - if not ret then - session.log("debug", "Error writing to connection: %s", tostring(err)); - return false, err; - end - end + return session.rawsend(t); end return true; end