From a4a008e046e060eb3d0d697b2a1445a62120d91d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 14 Apr 2021 15:21:13 +0200 Subject: util.xmppstream: Send declaration in same call as stream open If network_settings.opportunistic_writes is enabled then this would previously have resulted in two socket writes, and possibly two packets being sent. This caused some issues in older versions of Gajim, which apparently expected the stream opening in the first packet, and thus it could not connect. With this change and opportunistic_writes enabled, the first packet should contain both the xml declaration and the stream open tag. Without opportunistic_writes, there should be no observable change. Tested with Gajim 1.1.2 (on same machine). Unsure if loopback behaves differently than the network here. --- util/xmppstream.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'util') diff --git a/util/xmppstream.lua b/util/xmppstream.lua index bab0f253..2763b000 100644 --- a/util/xmppstream.lua +++ b/util/xmppstream.lua @@ -268,8 +268,7 @@ local function new(session, stream_callbacks, stanza_size_limit) if session.stream_attrs then session:stream_attrs(from, to, attr) end - send(""); - send(st.stanza("stream:stream", attr):top_tag()); + send(""..st.stanza("stream:stream", attr):top_tag()); return true; end -- cgit v1.2.3