]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberd_listener.erl: Define send timeout option to avoid blocking on socket...
authorMickaël Rémond <mickael.remond@process-one.net>
Thu, 8 Jan 2009 21:01:27 +0000 (21:01 +0000)
committerMickaël Rémond <mickael.remond@process-one.net>
Thu, 8 Jan 2009 21:01:27 +0000 (21:01 +0000)
* src/ejabberd_s2s_out.erl: Likewise.

SVN Revision: 1785

ChangeLog
src/ejabberd_listener.erl
src/ejabberd_s2s_out.erl

index d0818a8b91bfd874f8ef6797eb33e70f94b2dd24..2042ff30b5f8a85dff0264f78f172748719bd426 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-08  Mickael Remond  <mremond@process-one.net>
+
+       * src/ejabberd_listener.erl: Define send timeout option to avoid
+       blocking on socket send (EJAB-746).
+       * src/ejabberd_s2s_out.erl: Likewise.
+
 2009-01-06  Badlop  <badlop@process-one.net>
 
        * src/msgs/ru.msg: Fix typo (thanks to Dominges)
index e1dc140f4fccef3d8b44eadcea693eef6ae8c8cb..ecdeae07bc9357da4347cb891263a4030bfade1b 100644 (file)
@@ -16,7 +16,7 @@
 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 %%% General Public License for more details.
-%%%                         
+%%%
 %%% You should have received a copy of the GNU General Public License
 %%% along with this program; if not, write to the Free Software
 %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
@@ -38,6 +38,9 @@
 
 -include("ejabberd.hrl").
 
+%% We do not block on send anymore.
+-define(TCP_SEND_TIMEOUT, 15000).
+
 start_link() ->
     supervisor:start_link({local, ejabberd_listeners}, ?MODULE, []).
 
@@ -89,10 +92,11 @@ init(Port, Module, Opts) ->
                            end, Opts),
 
     Res = gen_tcp:listen(Port, [binary,
-                               {packet, 0}, 
+                               {packet, 0},
                                {active, false},
                                {reuseaddr, true},
                                {nodelay, true},
+                               {send_timeout, ?TCP_SEND_TIMEOUT},
                                {keepalive, true} |
                                SockOpts]),
     case Res of
index 09e44669471a605c70a5b5db1017ba0df0a56414..0601cdc1a29902190b13f769ae69ec114512c1da 100644 (file)
@@ -16,7 +16,7 @@
 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 %%% General Public License for more details.
-%%%                         
+%%%
 %%% You should have received a copy of the GNU General Public License
 %%% along with this program; if not, write to the Free Software
 %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
@@ -95,6 +95,9 @@
 %% -define(FSMLIMITS, [{max_queue, 2000}]).
 -define(FSMTIMEOUT, 30000).
 
+%% We do not block on send anymore.
+-define(TCP_SEND_TIMEOUT, 15000).
+
 %% Maximum delay to wait before retrying to connect after a failed attempt.
 %% Specified in miliseconds. Default value is 5 minutes.
 -define(MAX_RETRY_DELAY, 300000).
@@ -251,6 +254,7 @@ open_socket1(Addr, Port) ->
                  catch ejabberd_socket:connect(
                          Addr, Port,
                          [binary, {packet, 0},
+                          {send_timeout, ?TCP_SEND_TIMEOUT},
                           {active, false}, inet6]);
              {'EXIT', Reason1} ->
                  ?DEBUG("s2s_out: connect crashed ~p~n", [Reason1]),