]> granicus.if.org Git - ejabberd/commitdiff
Reorganize get_opt() code in some modules
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 1 Jun 2015 10:19:01 +0000 (13:19 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 1 Jun 2015 12:20:49 +0000 (15:20 +0300)
src/mod_sip_registrar.erl

index a534c61ceff17a98694ff77c00ac3d8f37934b59..58ffa5029c104a95bf297c550884a8dafc9c43ca 100644 (file)
@@ -490,15 +490,18 @@ need_ob_hdrs(Contacts, _IsOutboundSupported = true) ->
       end, Contacts).
 
 get_flow_timeout(LServer, #sip_socket{type = Type}) ->
-    {Option, Default} =
-       case Type of
-           udp -> {flow_timeout_udp, ?FLOW_TIMEOUT_UDP};
-           _ -> {flow_timeout_tcp, ?FLOW_TIMEOUT_TCP}
-       end,
-    gen_mod:get_module_opt(
-      LServer, mod_sip, Option,
-      fun(I) when is_integer(I), I>0 -> I end,
-      Default).
+    case Type of
+       udp ->
+           gen_mod:get_module_opt(
+             LServer, mod_sip, flow_timeout_udp,
+             fun(I) when is_integer(I), I>0 -> I end,
+             ?FLOW_TIMEOUT_UDP);
+       _ ->
+           gen_mod:get_module_opt(
+             LServer, mod_sip, flow_timeout_tcp,
+             fun(I) when is_integer(I), I>0 -> I end,
+             ?FLOW_TIMEOUT_TCP)
+    end.
 
 update_table() ->
     Fields = record_info(fields, sip_session),