Comparison

clix.lua @ 169:4e67d34c1298

clix: Remove Tigase COMPAT The bufferlen method is specific to server_select, so this breaks on server_epoll
author Kim Alvefur <zash@zash.se>
date Sat, 24 Jun 2023 09:49:03 +0200
parent 168:75e8ca131178
child 171:eb7625161d76
comparison
equal deleted inserted replaced
168:75e8ca131178 169:4e67d34c1298
127 clientkey, serverkey = nil, nil; 127 clientkey, serverkey = nil, nil;
128 end 128 end
129 129
130 -- Connect! 130 -- Connect!
131 conn:connect_client(account.jid, account.password, clientkey, serverkey); 131 conn:connect_client(account.jid, account.password, clientkey, serverkey);
132
133 -- COMPAT: Tigase discards stanzas sent at the same time as </stream:stream>
134 local _real_close = conn.close;
135 function conn:close()
136 conn:debug("Delaying close...");
137 local function close_conn()
138 local function do_close()
139 if _real_close then
140 conn:debug("Closing now...");
141 local close = _real_close;
142 _real_close = nil;
143 close(conn);
144 end
145 end
146 local close_delay = tonumber(opts.close_delay) or 0;
147 if close_delay > 0 then
148 verse.add_task(close_delay, do_close);
149 else
150 do_close();
151 end
152 end
153 if conn.conn:bufferlen() == 0 then
154 close_conn();
155 else
156 conn:hook("drained", close_conn);
157 end
158 end
159 -- /COMPAT
160
161
162 if type(opts.resource) == "string" then 132 if type(opts.resource) == "string" then
163 conn.resource = opts.resource; 133 conn.resource = opts.resource;
164 end 134 end
165 135
166 local ok, ret = pcall(verse.loop); 136 local ok, ret = pcall(verse.loop);