Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 5522:3912c9264ef0
mod_s2s: Obey tcp_keepalives option for s2s too, and make it individually configurable through s2s_tcp_keepalives (thanks yeled)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 26 Apr 2013 12:25:25 +0100 |
parent | 5505:0b6a99e6c1b1 |
child | 5533:df3c78221f26 |
comparison
equal
deleted
inserted
replaced
5520:75230be5be58 | 5522:3912c9264ef0 |
---|---|
31 | 31 |
32 local s2sout = module:require("s2sout"); | 32 local s2sout = module:require("s2sout"); |
33 | 33 |
34 local connect_timeout = module:get_option_number("s2s_timeout", 90); | 34 local connect_timeout = module:get_option_number("s2s_timeout", 90); |
35 local stream_close_timeout = module:get_option_number("s2s_close_timeout", 5); | 35 local stream_close_timeout = module:get_option_number("s2s_close_timeout", 5); |
36 | 36 local opt_keepalives = module:get_option_boolean("s2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true)); |
37 local secure_auth = module:get_option_boolean("s2s_secure_auth", false); -- One day... | 37 local secure_auth = module:get_option_boolean("s2s_secure_auth", false); -- One day... |
38 local secure_domains, insecure_domains = | 38 local secure_domains, insecure_domains = |
39 module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items; | 39 module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items; |
40 local require_encryption = module:get_option_boolean("s2s_require_encryption", secure_auth); | 40 local require_encryption = module:get_option_boolean("s2s_require_encryption", secure_auth); |
41 | 41 |
561 session:close("connection-timeout"); | 561 session:close("connection-timeout"); |
562 end); | 562 end); |
563 end | 563 end |
564 | 564 |
565 function listener.onconnect(conn) | 565 function listener.onconnect(conn) |
566 conn:setoption("keepalive", opt_keepalives); | |
566 local session = sessions[conn]; | 567 local session = sessions[conn]; |
567 if not session then -- New incoming connection | 568 if not session then -- New incoming connection |
568 session = s2s_new_incoming(conn); | 569 session = s2s_new_incoming(conn); |
569 sessions[conn] = session; | 570 sessions[conn] = session; |
570 session.log("debug", "Incoming s2s connection"); | 571 session.log("debug", "Incoming s2s connection"); |