aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2016-06-01 01:01:54 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2016-06-01 01:01:54 +0200
commitbbb90b9928b29b38573f65c7b411e2089ac7cfb8 (patch)
tree8d869b30b49b81abe125afacde7a22e7d82cac28 /src
parentProcess cover information on travis only if cover support is enabled (diff)
Ignore offline sessions
Let mod_admin_extra and mod_configure ignore offline sessions when querying the session table.
Diffstat (limited to 'src')
-rw-r--r--src/mod_admin_extra.erl11
-rw-r--r--src/mod_configure.erl10
2 files changed, 13 insertions, 8 deletions
diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl
index 87cd158db..5aebd3ff2 100644
--- a/src/mod_admin_extra.erl
+++ b/src/mod_admin_extra.erl
@@ -863,9 +863,10 @@ connected_users_vhost(Host) ->
dirty_get_sessions_list2() ->
mnesia:dirty_select(
session,
- [{#session{usr = '$1', sid = '$2', priority = '$3', info = '$4', _ = '_'},
- [],
- [['$1', '$2', '$3', '$4']]}]).
+ [{#session{usr = '$1', sid = {'$2', '$3'}, priority = '$4', info = '$5',
+ _ = '_'},
+ [{is_pid, '$3'}],
+ [['$1', {{'$2', '$3'}}, '$4', '$5']]}]).
%% Make string more print-friendly
stringize(String) ->
@@ -900,7 +901,9 @@ user_sessions_info(User, Host) ->
{'EXIT', _Reason} ->
[];
Ss ->
- Ss
+ lists:filter(fun(#session{sid = {_, Pid}}) ->
+ is_pid(Pid)
+ end, Ss)
end,
lists:map(
fun(Session) ->
diff --git a/src/mod_configure.erl b/src/mod_configure.erl
index a836c33bd..515127684 100644
--- a/src/mod_configure.erl
+++ b/src/mod_configure.erl
@@ -1917,17 +1917,19 @@ set_form(From, Host, ?NS_ADMINL(<<"end-user-session">>),
case JID#jid.lresource of
<<>> ->
SIDs = mnesia:dirty_select(session,
- [{#session{sid = '$1',
+ [{#session{sid = {'$1', '$2'},
usr = {LUser, LServer, '_'},
_ = '_'},
- [], ['$1']}]),
+ [{is_pid, '$2'}],
+ [{{'$1', '$2'}}]}]),
[Pid ! {kick, kicked_by_admin, Xmlelement} || {_, Pid} <- SIDs];
R ->
[{_, Pid}] = mnesia:dirty_select(session,
- [{#session{sid = '$1',
+ [{#session{sid = {'$1', '$2'},
usr = {LUser, LServer, R},
_ = '_'},
- [], ['$1']}]),
+ [{is_pid, '$2'}],
+ [{{'$1', '$2'}}]}]),
Pid ! {kick, kicked_by_admin, Xmlelement}
end,
{result, []};