mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
* src/ejabberd_sm.erl: Optimized check_max_sessions (thanks to
Christophe Romain) SVN Revision: 975
This commit is contained in:
parent
1415fa4b1c
commit
65a7bb7d2a
@ -1,3 +1,8 @@
|
|||||||
|
2007-11-25 Alexey Shchepin <alexey@process-one.net>
|
||||||
|
|
||||||
|
* src/ejabberd_sm.erl: Optimized check_max_sessions (thanks to
|
||||||
|
Christophe Romain)
|
||||||
|
|
||||||
2007-11-22 Mickael Remond <mremond@process-one.net>
|
2007-11-22 Mickael Remond <mremond@process-one.net>
|
||||||
|
|
||||||
* src/ejabberd_config.erl: Improved error message when ejabberd
|
* src/ejabberd_config.erl: Improved error message when ejabberd
|
||||||
|
@ -542,10 +542,13 @@ check_max_sessions(LUser, LServer) ->
|
|||||||
%% first one
|
%% first one
|
||||||
SIDs = mnesia:dirty_select(
|
SIDs = mnesia:dirty_select(
|
||||||
session,
|
session,
|
||||||
[{#session{sid = '$1', usr = {LUser, LServer, '_'}, _ = '_'}, [], ['$1']}]),
|
[{#session{us = {LUser, LServer}, _ = '_'}, [], [[]]}]),
|
||||||
MaxSessions = get_max_user_sessions(LUser, LServer),
|
MaxSessions = get_max_user_sessions(LUser, LServer),
|
||||||
if length(SIDs) =< MaxSessions -> ok;
|
if
|
||||||
true -> {_, Pid} = lists:min(SIDs),
|
length(SIDs) =< MaxSessions ->
|
||||||
|
ok;
|
||||||
|
true ->
|
||||||
|
{_, Pid} = lists:min(SIDs),
|
||||||
Pid ! replaced
|
Pid ! replaced
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user