]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberd_s2s_out.erl: Fixed behavior when outgoing_s2s_port
authorBadlop <badlop@process-one.net>
Sat, 29 Dec 2007 15:23:53 +0000 (15:23 +0000)
committerBadlop <badlop@process-one.net>
Sat, 29 Dec 2007 15:23:53 +0000 (15:23 +0000)
option is not defined (EJAB-487)

SVN Revision: 1130

ChangeLog
src/ejabberd_s2s_out.erl

index c135539385301b702eb0626d8c03eacefd9bb909..cb7f8bcb897f3422c53e246348da5828d9639620 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-29  Alexey Shchepin  <alexey@process-one.net>
+
+       * src/ejabberd_s2s_out.erl: Fixed behavior when outgoing_s2s_port
+       option is not defined (EJAB-487)
+
 2007-12-27  Badlop  <badlop@process-one.net>
 
        * src/mod_vcard_ldap.erl: Fix some field names (EJAB-483)
index c8094f8f989dcf2f6c80a48285065b38660961cc..bb862a91a148367dfe4682dc095d5b83628a11ff 100644 (file)
@@ -923,14 +923,13 @@ get_addr_port(Server) ->
     case Res of
        {error, Reason} ->
            ?DEBUG("srv lookup of '~s' failed: ~p~n", [Server, Reason]),
-           [{Server, ejabberd_config:get_local_option(outgoing_s2s_port)}];
+           [{Server, outgoing_s2s_port()}];
        {ok, HEnt} ->
            ?DEBUG("srv lookup of '~s': ~p~n",
                   [Server, HEnt#hostent.h_addr_list]),
            case HEnt#hostent.h_addr_list of
                [] ->
-                   [{Server,
-                     ejabberd_config:get_local_option(outgoing_s2s_port)}];
+                   [{Server, outgoing_s2s_port()}];
                AddrList ->
                    %% Probabilities are not exactly proportional to weights
                    %% for simplicity (higher weigths are overvalued)
@@ -945,8 +944,7 @@ get_addr_port(Server) ->
                                          {Priority * 65536 - N, Host, Port}
                                  end, AddrList)) of
                        {'EXIT', _Reasn} ->
-                           [{Server,
-                             ejabberd_config:get_local_option(outgoing_s2s_port)}];
+                           [{Server, outgoing_s2s_port()}];
                        SortedList ->
                            List = lists:map(
                                     fun({_, Host, Port}) ->
@@ -970,6 +968,13 @@ test_get_addr_port(Server) ->
              end
       end, [], lists:seq(1, 100000)).
 
+outgoing_s2s_port() ->
+    case ejabberd_config:get_local_option(outgoing_s2s_port) of
+       Port when is_integer(Port) ->
+           Port;
+       undefined ->
+           5269
+    end.
 
 %% Human readable S2S logging: Log only new outgoing connections as INFO
 %% Do not log dialback