Changeset View
Changeset View
Standalone View
Standalone View
apps/kolab_guam/src/kolab_guam_listener.erl
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | listen_options(Iface, Hostname, ImplicitTLS, TLSConfig) -> | ||||
{ ok, Ifaces } = inet:getifaddrs(), | { ok, Ifaces } = inet:getifaddrs(), | ||||
case proplists:get_value(Iface, Ifaces) of | case proplists:get_value(Iface, Ifaces) of | ||||
undefined -> listen_options(none, Hostname, ImplicitTLS, TLSConfig); | undefined -> listen_options(none, Hostname, ImplicitTLS, TLSConfig); | ||||
Info -> Addr = proplists:get_value(addr, Info, none), | Info -> Addr = proplists:get_value(addr, Info, none), | ||||
lager:info("YEAH! ~p", [Addr]), | lager:info("YEAH! ~p", [Addr]), | ||||
listen_options(none, Addr, ImplicitTLS, TLSConfig) | listen_options(none, Addr, ImplicitTLS, TLSConfig) | ||||
end. | end. | ||||
default_listen_options(true, TLSConfig) -> [ { reuseaddr, true }, {active, once } | TLSConfig ]; | default_listen_options(true, TLSConfig) -> default_listen_options() ++ TLSConfig; | ||||
default_listen_options(_ImplicitTLS, _Config) -> [ { active, once }, { reuseaddr, true } ]. | default_listen_options(_ImplicitTLS, _Config) -> default_listen_options(). | ||||
default_listen_options() -> [ { reuseaddr, true }, {active, once } ]. | |||||
create_initial_listeners(PID) when is_pid(PID) -> | create_initial_listeners(PID) when is_pid(PID) -> | ||||
lager:debug("Creating session pool for listener ~p", [PID]), | lager:debug("Creating session pool for listener ~p", [PID]), | ||||
[ supervisor:start_child(PID, []) || _ <- lists:seq(1, 20) ]. | [ supervisor:start_child(PID, []) || _ <- lists:seq(1, 20) ]. | ||||
cleanup(Socket) -> | cleanup(Socket) -> | ||||
process_flag(trap_exit, true), | process_flag(trap_exit, true), | ||||
receive | receive | ||||
Show All 10 Lines |