summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMickaël Rémond <mickael.remond@process-one.net>2009-01-08 20:49:16 +0000
committerMickaël Rémond <mickael.remond@process-one.net>2009-01-08 20:49:16 +0000
commitf0af10e600fdbaa3d46db8f96a103e6ca61964af (patch)
tree28b30cc5013d802bcdd9d854c17a83b22761ab8d /src
parentapply delete-any feature (diff)
* src/ejabberd_listener.erl: Define send timeout option to avoid blocking on socket send (EJAB-746).
* src/ejabberd_s2s_out.erl: Likewise. SVN Revision: 1784
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_listener.erl8
-rw-r--r--src/ejabberd_s2s_out.erl6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl
index 9c46f6d4..6992c6a5 100644
--- a/src/ejabberd_listener.erl
+++ b/src/ejabberd_listener.erl
@@ -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, []).
@@ -96,10 +99,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
diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl
index ab7820b9..bee85d64 100644
--- a/src/ejabberd_s2s_out.erl
+++ b/src/ejabberd_s2s_out.erl
@@ -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).
@@ -267,6 +270,7 @@ open_socket2(Type, Addr, Port) ->
Timeout = outgoing_s2s_timeout(),
case (catch ejabberd_socket:connect(Addr, Port,
[binary, {packet, 0},
+ {send_timeout, ?TCP_SEND_TIMEOUT},
{active, false}, Type],
Timeout)) of
{ok, _Socket} = R -> R;