Commit Graph

60 Commits

Author SHA1 Message Date
Evgeny Khramtsov 0545e0a797 Ignore late arrival of an already cancelled timer 2019-07-08 19:32:37 +03:00
Evgeny Khramtsov f68da70f3e Avoid last handled stanzas cache to grow indefinitely 2019-07-01 20:43:57 +03:00
Evgeny Khramtsov a2a061c1c8 Avoid using broad p1_queue:queue() type wherever possible 2019-06-28 22:16:29 +03:00
Evgeny Khramtsov 2abca350e0 Fix type specs 2019-06-27 11:32:54 +03:00
Evgeny Khramtsov 4e5daf4d72 Make sure queue bouncing doesn't yield into infinite recursion 2019-06-26 11:56:25 +03:00
Evgeny Khramtsov 6697a3e3f1 Use proper loglevel to log resumption failures 2019-06-25 20:42:54 +03:00
Evgeny Khramtsov 8b300d734b Don't propagate downstream already handled message 2019-06-25 14:36:17 +03:00
Evgeny Khramtsov a3e0cbbdd8 Make logging messages more consistent 2019-06-24 20:32:34 +03:00
Evgeny Khramtsov 00f2a736eb Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro.
The macro itself is defined in include/translate.hrl.
Example:

-module(foo).
-export([bar/1]).
-include("translate.hrl").

bar(Lang) ->
    translate:translate(Lang, ?T("baz")).
2019-06-22 17:08:45 +03:00
Evgeny Khramtsov a205ebad2b Get rid of "well-known" type 2019-06-15 12:53:16 +03:00
Evgeny Khramtsov a02cff0e78 Use new configuration validator 2019-06-14 12:33:26 +03:00
Holger Weiss 274a507590 mod_stream_mgmt: Drop unused code
Revert the changes applied to mod_stream_mgmt in commit
b76f90fe39, as the new implementation of
mod_offline's 'use_mam_for_storage' feature doesn't need them.
2019-05-29 00:30:59 +02:00
Paweł Chmielowski b76f90fe39 Add mod_offline option for fetching data from mam instead of from spool table
This commit introduces `use_mam_for_storage` option that take boolean
argument. Enabling it will make mod_offline not use spool table for storing
offline message, but instead will use mam archive to retrieve messages
stored when offline.

Enabling this option have couple drawback currently, only messages that
were stored in mam will be available, most of flexible message retrieval
queries don't work (those that allow retrieval/deletion of messages by id).
2019-04-26 19:59:06 +02:00
Paweł Chmielowski 538f35d05a Replace code using p1_time_compat wrapper with native functions
Since we now require R19, we shouldn't need that anymore.

There are still couple places where p1_time_compat:unique_timestamp() is
used as there is no direct equivalent.
2019-02-27 09:56:31 +01:00
Badlop 55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Evgeny Khramtsov 59ce0ba6c8 Apply new cache options on mod_stream_mgmt reload 2018-11-30 18:12:27 +03:00
Evgeny Khramtsov 5d27c975dc Keep last handled stanzas number in cache rather than session table 2018-11-30 16:19:00 +03:00
Holger Weiss a8b11b6474 Move some functions from xmpp back into ejabberd 2018-10-25 01:05:45 +02:00
Evgeny Khramtsov 08f3d066b1 Switch more log message to warning level
The commit is supposed to improve logging at loglevel 3, which
is the recommended level for high loaded ejabberd servers
2018-09-19 23:12:14 +03:00
Holger Weiss 68c9328a9c Move cancel_timer/1 function into 'misc' module 2018-07-17 20:50:58 +02:00
Holger Weiss 3a566e3cdf mod_stream_mgmt: Remove dead case clauses 2018-07-10 00:52:27 +02:00
Holger Weiss b915469f5e mod_stream_mgmt: Add descriptive text to errors
Closes #2485.
2018-07-10 00:46:48 +02:00
Evgeniy Khramtsov 6b8bc811ac Don't crash on most common gen_server:call errors 2018-07-01 14:26:49 +03:00
Evgeniy Khramtsov 499ae96254 Don't use 'unsupported-version' inside SM <failed/> element
This error condition is defined within stream errors, however,
XEP-0198 says:

> This element SHOULD contain an error condition, which MUST
> be one of the **stanza** error conditions defined in RFC 6120.
2018-06-25 09:56:44 +03:00
Evgeniy Khramtsov fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Holger Weiss 332567693c mod_push_keepalive: Reset timeout on messages only
Some mobile apps might only be notified on actual chat messages with
a body, so don't let mod_push_keepalive reset the stream management
timeout on other types of traffic.
2018-04-17 00:27:07 +02:00
Holger Weiss bc808ffcde mod_stream_mgmt: Clean up on timed out resumption
During resumption, make sure the old process and the corresponding
session entry are disposed also in the case where the call that queries
the old process times out.
2018-03-06 21:03:31 +01:00
Evgeniy Khramtsov d9bf5a6865 Don't forget to remove mgmt_force_enqueue flag 2018-03-06 16:18:03 +03:00
Holger Weiss 22e43ebd8a mod_stream_mgmt: Cope with exit during resumption
Don't crash if the old process exits while it is queried for the session
state.
2018-02-24 21:50:54 +01:00
Evgeniy Khramtsov ec0f0f7c72 Move some log messages to debug level 2018-02-21 17:12:50 +03:00
Evgeniy Khramtsov e070e6bccb Replace ?MYLANG with connection's language wherever possible 2018-02-19 21:47:20 +03:00
Evgeniy Khramtsov c102a45fac Rename some keys and functions for clarity 2018-02-15 15:50:20 +03:00
Evgeniy Khramtsov 52ded14b7f Update incoming stanzas counter on invalid XML 2018-02-15 15:42:55 +03:00
Evgeniy Khramtsov e5ba7c3f3c Better solution for a previous fix 2018-02-15 10:48:59 +03:00
Evgeniy Khramtsov 51aa9d98a7 Don't forget to add invalid XML responses to sending queue 2018-02-15 10:18:06 +03:00
Holger Weiss 9fb2253aa9 mod_stream_mgmt: Abort connection on count error
If the client acknowledged more stanzas than the server sent, close the
connection with a stream error rather than hiding client bugs by silently
adjusting the server's count.
2018-02-10 00:06:19 +01:00
Evgeniy Khramtsov ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov 2d43c07c62 Get rid of ejabberd receiver
ejabberd receivers were meant to serve connections from frontends
to backends. However, this approach was not popular and frontend
related code was removed in previous releases. Now, ejabberd receiver's
code was also removed, making the code shorter and cleaner. Also, in
stress tests ejabberd now handles load more robustly, without
c2s processes overload (even with disabled shapers).

ejabberd_socket.erl is renamed to xmpp_socket.erl: it's supposed to
be finally moved into stand-alone xmpp library.
2017-12-26 18:55:57 +03:00
Holger Weiss af49472373 mod_stream_mgmt: Improve logging on timeout
Produce a better error message if a pending stream management session
times out.
2017-11-15 01:11:37 +01:00
Holger Weiss 532aba993b mod_stream_mgmt: Increase 'max_ack_queue' default
Users with large rosters and/or certain transports might receive a very
large number of (e.g.) presence and/or PEP stanzas after logging in.
Clients might take some time to acknowledge them, especially over slow
(mobile) connections.
2017-10-03 01:37:10 +02:00
Holger Weiss b8d2a72333 mod_stream_mgmt: Delete 'c2s_init' hook
Delete the 'c2s_init' hook when the last 'mod_stream_mgmt' instance is
stopped.
2017-08-17 18:25:06 +02:00
Holger Weiss 0760c7273c mod_stream_mgmt: Remove outdated TODO comment
The CSI queue is now flushed from mod_client_state.
2017-08-17 18:19:04 +02:00
Holger Weiss 66510c1d78 Add mod_push_keepalive
This module tries to keep pending stream management sessions of push
clients alive (as long as the disconnected clients are reachable via
push notifications).
2017-07-21 01:07:36 +02:00
Holger Weiss 985b0a1933 mod_stream_mgmt: Add missing function specs 2017-06-21 01:00:29 +02:00
Evgeniy Khramtsov f2dc8c0442 Emit deprecation warning for SM related listening options 2017-05-05 12:31:17 +03:00
Evgeniy Khramtsov fddd6110e0 Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
  gen_mod:get_opt() and gen_mod:get_module_opt() functions,
  because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
  introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
  If the functions are still called, the "function" argument is
  simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
  listening options at startup.
2017-04-30 19:01:47 +03:00
Holger Weiss 56a4bf8f3c mod_stream_mgmt: Fix typo in variable name 2017-04-25 22:37:27 +02:00
Holger Weiss 9cc332d6b3 mod_stream_mgmt: Fix 'if_offline' detection 2017-04-25 22:32:03 +02:00
Holger Weiss 3682888655 mod_stream_mgmt: Preserve stanza count on timeout
If a pending stream management session times out, call
ejabberd_c2s:process_terminated/2 *before* storing the incoming stanza
count.  Without this change, the session table entry that holds the
stanza count was purged while closing the session.
2017-04-19 23:04:20 +02:00