Comparison

plugins/mod_s2s/s2sout.lib.lua @ 7561:ab8324d3b899

mod_s2s: Set read mode for s2sout sockets to the same as s2sins
author Kim Alvefur <zash@zash.se>
date Fri, 12 Aug 2016 01:38:40 +0200
parent 7098:5286e79c6829
child 7685:8e43a05e2374
comparison
equal deleted inserted replaced
7548:69d8e1477c43 7561:ab8324d3b899
19 local dns = require "net.dns"; 19 local dns = require "net.dns";
20 local t_insert, t_sort, ipairs = table.insert, table.sort, ipairs; 20 local t_insert, t_sort, ipairs = table.insert, table.sort, ipairs;
21 local local_addresses = require "util.net".local_addresses; 21 local local_addresses = require "util.net".local_addresses;
22 22
23 local s2s_destroy_session = require "core.s2smanager".destroy_session; 23 local s2s_destroy_session = require "core.s2smanager".destroy_session;
24
25 local default_mode = module:get_option("network_default_read_size", 4096);
24 26
25 local log = module._log; 27 local log = module._log;
26 28
27 local sources = {}; 29 local sources = {};
28 local has_ipv4, has_ipv6; 30 local has_ipv4, has_ipv6;
280 if not success and err ~= "timeout" then 282 if not success and err ~= "timeout" then
281 log("warn", "s2s connect() to %s (%s:%d) failed: %s", host_session.to_host, connect_host.addr, connect_port, err); 283 log("warn", "s2s connect() to %s (%s:%d) failed: %s", host_session.to_host, connect_host.addr, connect_port, err);
282 return false, err; 284 return false, err;
283 end 285 end
284 286
285 conn = wrapclient(conn, connect_host.addr, connect_port, s2s_listener, "*a"); 287 conn = wrapclient(conn, connect_host.addr, connect_port, s2s_listener, default_mode);
286 host_session.conn = conn; 288 host_session.conn = conn;
287 289
288 -- Register this outgoing connection so that xmppserver_listener knows about it 290 -- Register this outgoing connection so that xmppserver_listener knows about it
289 -- otherwise it will assume it is a new incoming connection 291 -- otherwise it will assume it is a new incoming connection
290 s2s_listener.register_outgoing(conn, host_session); 292 s2s_listener.register_outgoing(conn, host_session);