25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* 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
This commit is contained in:
Mickaël Rémond 2009-01-08 20:49:16 +00:00
parent a1f0ad3300
commit f0af10e600
3 changed files with 17 additions and 3 deletions

View File

@ -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-08 Christophe Romain <christophe.romain@process-one.net> 2009-01-08 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: completely support subscription using * src/mod_pubsub/mod_pubsub.erl: completely support subscription using

View File

@ -16,7 +16,7 @@
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details. %%% General Public License for more details.
%%% %%%
%%% You should have received a copy of the GNU General Public License %%% You should have received a copy of the GNU General Public License
%%% along with this program; if not, write to the Free Software %%% along with this program; if not, write to the Free Software
%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
@ -38,6 +38,9 @@
-include("ejabberd.hrl"). -include("ejabberd.hrl").
%% We do not block on send anymore.
-define(TCP_SEND_TIMEOUT, 15000).
start_link() -> start_link() ->
supervisor:start_link({local, ejabberd_listeners}, ?MODULE, []). supervisor:start_link({local, ejabberd_listeners}, ?MODULE, []).
@ -96,10 +99,11 @@ init(Port, Module, Opts) ->
end, Opts), end, Opts),
Res = gen_tcp:listen(Port, [binary, Res = gen_tcp:listen(Port, [binary,
{packet, 0}, {packet, 0},
{active, false}, {active, false},
{reuseaddr, true}, {reuseaddr, true},
{nodelay, true}, {nodelay, true},
{send_timeout, ?TCP_SEND_TIMEOUT},
{keepalive, true} | {keepalive, true} |
SockOpts]), SockOpts]),
case Res of case Res of

View File

@ -16,7 +16,7 @@
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details. %%% General Public License for more details.
%%% %%%
%%% You should have received a copy of the GNU General Public License %%% You should have received a copy of the GNU General Public License
%%% along with this program; if not, write to the Free Software %%% along with this program; if not, write to the Free Software
%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
@ -95,6 +95,9 @@
%% -define(FSMLIMITS, [{max_queue, 2000}]). %% -define(FSMLIMITS, [{max_queue, 2000}]).
-define(FSMTIMEOUT, 30000). -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. %% Maximum delay to wait before retrying to connect after a failed attempt.
%% Specified in miliseconds. Default value is 5 minutes. %% Specified in miliseconds. Default value is 5 minutes.
-define(MAX_RETRY_DELAY, 300000). -define(MAX_RETRY_DELAY, 300000).
@ -267,6 +270,7 @@ open_socket2(Type, Addr, Port) ->
Timeout = outgoing_s2s_timeout(), Timeout = outgoing_s2s_timeout(),
case (catch ejabberd_socket:connect(Addr, Port, case (catch ejabberd_socket:connect(Addr, Port,
[binary, {packet, 0}, [binary, {packet, 0},
{send_timeout, ?TCP_SEND_TIMEOUT},
{active, false}, Type], {active, false}, Type],
Timeout)) of Timeout)) of
{ok, _Socket} = R -> R; {ok, _Socket} = R -> R;