aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-24 08:18:19 +0000
committerKim Alvefur <zash@zash.se>2019-03-24 08:18:19 +0000
commitee0fd8f1d90b736597baff3d7e1fd7dd1d28240b (patch)
treec72f82595364871f9f685c183b084603bb5c90ca
parent5ba20f8a9b1e93a99e38aedf9ec83a4f18f330f3 (diff)
downloadprosody-ee0fd8f1d90b736597baff3d7e1fd7dd1d28240b.tar.gz
prosody-ee0fd8f1d90b736597baff3d7e1fd7dd1d28240b.zip
sessionmanager: Split byte-level sending into separate session.rawsend
-rw-r--r--core/sessionmanager.lua22
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