mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Merge 1876 from trunk.
* src/web/ejabberd_http_poll.erl: Allow configuration of session timeout, using new global option http_poll_timeout (EJAB-135) * doc/guide.tex: Document new option * doc/guide.html: Likewise SVN Revision: 1941
This commit is contained in:
parent
c13ed8c625
commit
b0f29b20db
@ -1,5 +1,10 @@
|
|||||||
2009-03-03 Badlop <badlop@process-one.net>
|
2009-03-03 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/web/ejabberd_http_poll.erl: Allow configuration of session
|
||||||
|
timeout, using new global option http_poll_timeout (EJAB-135)
|
||||||
|
* doc/guide.tex: Document new option
|
||||||
|
* doc/guide.html: Likewise
|
||||||
|
|
||||||
* src/ejabberd_system_monitor.erl: Allow parametrizable watchdog
|
* src/ejabberd_system_monitor.erl: Allow parametrizable watchdog
|
||||||
threshold: option watchdog_large_heap or chatting with the
|
threshold: option watchdog_large_heap or chatting with the
|
||||||
watchdog bot (EJAB-545)
|
watchdog bot (EJAB-545)
|
||||||
|
@ -712,8 +712,11 @@ do not allow outgoing sockets on port 5222.<P>If HTTP Polling is enabled, it wil
|
|||||||
<CODE>http://server:port/http-poll/</CODE>. Be aware that support for HTTP Polling
|
<CODE>http://server:port/http-poll/</CODE>. Be aware that support for HTTP Polling
|
||||||
is also needed in the Jabber client. Remark also that HTTP Polling can be
|
is also needed in the Jabber client. Remark also that HTTP Polling can be
|
||||||
interesting to host a web-based Jabber client such as
|
interesting to host a web-based Jabber client such as
|
||||||
<A HREF="http://jwchat.sourceforge.net/">JWChat</A>.
|
<A HREF="http://jwchat.sourceforge.net/">JWChat</A>.</P><P>The maximum period of time to keep a client session active without
|
||||||
</P></DD><DT CLASS="dt-description"><B><TT>{max_stanza_size, Size}</TT></B></DT><DD CLASS="dd-description">
|
an incoming POST request can be configured with the global option
|
||||||
|
<TT>http_poll_timeout</TT>. The default value is five minutes.
|
||||||
|
The option can be defined in <TT>ejabberd.cfg</TT>, expressing the time
|
||||||
|
in seconds: <CODE>{http_poll_timeout, 300}.</CODE></P></DD><DT CLASS="dt-description"><B><TT>{max_stanza_size, Size}</TT></B></DT><DD CLASS="dd-description">
|
||||||
This option specifies an
|
This option specifies an
|
||||||
approximate maximum size in bytes of XML stanzas. Approximate,
|
approximate maximum size in bytes of XML stanzas. Approximate,
|
||||||
because it is calculated with the precision of one block of readed
|
because it is calculated with the precision of one block of readed
|
||||||
@ -3370,7 +3373,8 @@ If a process in the <TT>ejabberd</TT> server consumes more memory than the confi
|
|||||||
a message is sent to the Jabber accounts defined with the option
|
a message is sent to the Jabber accounts defined with the option
|
||||||
<TT>watchdog_admins</TT>
|
<TT>watchdog_admins</TT>
|
||||||
in the <TT>ejabberd</TT> configuration file.</P><P>The memory consumed is measured in <TT>words</TT>:
|
in the <TT>ejabberd</TT> configuration file.</P><P>The memory consumed is measured in <TT>words</TT>:
|
||||||
a word on 32-bit architecture is 4 bytes, and a word on 64-bit architecture 8 bytes.
|
a word on 32-bit architecture is 4 bytes,
|
||||||
|
and a word on 64-bit architecture is 8 bytes.
|
||||||
The threshold by default is 1000000 words.
|
The threshold by default is 1000000 words.
|
||||||
This value can be configured with the option <TT>watchdog_large_heap</TT>,
|
This value can be configured with the option <TT>watchdog_large_heap</TT>,
|
||||||
or in a conversation with the watchdog alert bot.</P><P>Example configuration:
|
or in a conversation with the watchdog alert bot.</P><P>Example configuration:
|
||||||
|
@ -851,6 +851,13 @@ This is a detailed description of each option allowed by the listening modules:
|
|||||||
is also needed in the \Jabber{} client. Remark also that HTTP Polling can be
|
is also needed in the \Jabber{} client. Remark also that HTTP Polling can be
|
||||||
interesting to host a web-based \Jabber{} client such as
|
interesting to host a web-based \Jabber{} client such as
|
||||||
\footahref{http://jwchat.sourceforge.net/}{JWChat}.
|
\footahref{http://jwchat.sourceforge.net/}{JWChat}.
|
||||||
|
|
||||||
|
The maximum period of time to keep a client session active without
|
||||||
|
an incoming POST request can be configured with the global option
|
||||||
|
\term{http\_poll\_timeout}. The default value is five minutes.
|
||||||
|
The option can be defined in \term{ejabberd.cfg}, expressing the time
|
||||||
|
in seconds: \verb|{http_poll_timeout, 300}.|
|
||||||
|
|
||||||
\titem{\{max\_stanza\_size, Size\}}
|
\titem{\{max\_stanza\_size, Size\}}
|
||||||
\ind{options!max\_stanza\_size}This option specifies an
|
\ind{options!max\_stanza\_size}This option specifies an
|
||||||
approximate maximum size in bytes of XML stanzas. Approximate,
|
approximate maximum size in bytes of XML stanzas. Approximate,
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
input = "",
|
input = "",
|
||||||
waiting_input = false, %% {ReceiverPid, Tag}
|
waiting_input = false, %% {ReceiverPid, Tag}
|
||||||
last_receiver,
|
last_receiver,
|
||||||
|
http_poll_timeout,
|
||||||
timer}).
|
timer}).
|
||||||
|
|
||||||
%-define(DBGFSM, true).
|
%-define(DBGFSM, true).
|
||||||
@ -187,12 +188,20 @@ init([ID, Key, IP]) ->
|
|||||||
%% connector.
|
%% connector.
|
||||||
Opts = ejabberd_c2s_config:get_c2s_limits(),
|
Opts = ejabberd_c2s_config:get_c2s_limits(),
|
||||||
|
|
||||||
|
HTTPPollTimeout = case ejabberd_config:get_local_option({http_poll_timeout,
|
||||||
|
?MYNAME}) of
|
||||||
|
%% convert seconds of option into milliseconds
|
||||||
|
Int when is_integer(Int) -> Int*1000;
|
||||||
|
undefined -> ?HTTP_POLL_TIMEOUT
|
||||||
|
end,
|
||||||
|
|
||||||
Socket = {http_poll, self(), IP},
|
Socket = {http_poll, self(), IP},
|
||||||
ejabberd_socket:start(ejabberd_c2s, ?MODULE, Socket, Opts),
|
ejabberd_socket:start(ejabberd_c2s, ?MODULE, Socket, Opts),
|
||||||
Timer = erlang:start_timer(?HTTP_POLL_TIMEOUT, self(), []),
|
Timer = erlang:start_timer(HTTPPollTimeout, self(), []),
|
||||||
{ok, loop, #state{id = ID,
|
{ok, loop, #state{id = ID,
|
||||||
key = Key,
|
key = Key,
|
||||||
socket = Socket,
|
socket = Socket,
|
||||||
|
http_poll_timeout = HTTPPollTimeout,
|
||||||
timer = Timer}}.
|
timer = Timer}}.
|
||||||
|
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
@ -284,7 +293,7 @@ handle_sync_event({http_put, Key, NewKey, Packet},
|
|||||||
Receiver ! {tcp, StateData#state.socket,
|
Receiver ! {tcp, StateData#state.socket,
|
||||||
list_to_binary(Packet)},
|
list_to_binary(Packet)},
|
||||||
cancel_timer(StateData#state.timer),
|
cancel_timer(StateData#state.timer),
|
||||||
Timer = erlang:start_timer(?HTTP_POLL_TIMEOUT, self(), []),
|
Timer = erlang:start_timer(StateData#state.http_poll_timeout, self(), []),
|
||||||
Reply = ok,
|
Reply = ok,
|
||||||
{reply, Reply, StateName,
|
{reply, Reply, StateName,
|
||||||
StateData#state{waiting_input = false,
|
StateData#state{waiting_input = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user