diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-24 08:18:19 +0000 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-24 08:18:19 +0000 |
commit | ee0fd8f1d90b736597baff3d7e1fd7dd1d28240b (patch) | |
tree | c72f82595364871f9f685c183b084603bb5c90ca /core | |
parent | 5ba20f8a9b1e93a99e38aedf9ec83a4f18f330f3 (diff) | |
download | prosody-ee0fd8f1d90b736597baff3d7e1fd7dd1d28240b.tar.gz prosody-ee0fd8f1d90b736597baff3d7e1fd7dd1d28240b.zip |
sessionmanager: Split byte-level sending into separate session.rawsend
Diffstat (limited to 'core')
-rw-r--r-- | core/sessionmanager.lua | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 2843001a..9a2456f2 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -32,20 +32,26 @@ local function new_session(conn) 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 |