mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Raise bad_node instead of node_down for consistency reason
This commit is contained in:
parent
f5f353d90a
commit
3e4ed83cb3
@ -209,7 +209,7 @@ decode_pid(PidBin, NodeBin) ->
|
|||||||
Node ->
|
Node ->
|
||||||
try set_node_id(PidStr, NodeBin)
|
try set_node_id(PidStr, NodeBin)
|
||||||
catch _:badarg ->
|
catch _:badarg ->
|
||||||
erlang:error({node_down, Node})
|
erlang:error({bad_node, Node})
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ row_to_route(Domain, {ServerHost, NodeS, PidS, LocalHintS} = Row) ->
|
|||||||
server_host = ServerHost,
|
server_host = ServerHost,
|
||||||
pid = aux:decode_pid(PidS, NodeS),
|
pid = aux:decode_pid(PidS, NodeS),
|
||||||
local_hint = dec_local_hint(LocalHintS)}]
|
local_hint = dec_local_hint(LocalHintS)}]
|
||||||
catch _:{node_down, _} ->
|
catch _:{bad_node, _} ->
|
||||||
[];
|
[];
|
||||||
E:R ->
|
E:R ->
|
||||||
?ERROR_MSG("failed to decode row from 'route' table:~n"
|
?ERROR_MSG("failed to decode row from 'route' table:~n"
|
||||||
|
@ -98,7 +98,7 @@ delete_session(_LUser, LServer, _LResource, {Now, Pid}) ->
|
|||||||
?SQL("delete from sm"
|
?SQL("delete from sm"
|
||||||
" where usec=%(TS)d and pid=%(PidS)s")),
|
" where usec=%(TS)d and pid=%(PidS)s")),
|
||||||
try {ok, row_to_session(LServer, Row)}
|
try {ok, row_to_session(LServer, Row)}
|
||||||
catch _:{node_down, _} -> {error, notfound}
|
catch _:{bad_node, _} -> {error, notfound}
|
||||||
end;
|
end;
|
||||||
{selected, []} ->
|
{selected, []} ->
|
||||||
{error, notfound};
|
{error, notfound};
|
||||||
@ -122,7 +122,7 @@ get_sessions(LServer) ->
|
|||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(Row) ->
|
fun(Row) ->
|
||||||
try [row_to_session(LServer, Row)]
|
try [row_to_session(LServer, Row)]
|
||||||
catch _:{node_down, _} -> []
|
catch _:{bad_node, _} -> []
|
||||||
end
|
end
|
||||||
end, Rows);
|
end, Rows);
|
||||||
Err ->
|
Err ->
|
||||||
@ -140,7 +140,7 @@ get_sessions(LUser, LServer) ->
|
|||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(Row) ->
|
fun(Row) ->
|
||||||
try [row_to_session(LServer, Row)]
|
try [row_to_session(LServer, Row)]
|
||||||
catch _:{node_down, _} -> []
|
catch _:{bad_node, _} -> []
|
||||||
end
|
end
|
||||||
end, Rows);
|
end, Rows);
|
||||||
Err ->
|
Err ->
|
||||||
@ -158,7 +158,7 @@ get_sessions(LUser, LServer, LResource) ->
|
|||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(Row) ->
|
fun(Row) ->
|
||||||
try [row_to_session(LServer, Row)]
|
try [row_to_session(LServer, Row)]
|
||||||
catch _:{node_down, _} -> []
|
catch _:{bad_node, _} -> []
|
||||||
end
|
end
|
||||||
end, Rows);
|
end, Rows);
|
||||||
Err ->
|
Err ->
|
||||||
|
@ -58,7 +58,7 @@ find_session(SID) ->
|
|||||||
?SQL("select @(pid)s, @(node)s from bosh where sid=%(SID)s")) of
|
?SQL("select @(pid)s, @(node)s from bosh where sid=%(SID)s")) of
|
||||||
{selected, [{Pid, Node}]} ->
|
{selected, [{Pid, Node}]} ->
|
||||||
try {ok, aux:decode_pid(Pid, Node)}
|
try {ok, aux:decode_pid(Pid, Node)}
|
||||||
catch _:{node_down, _} -> error
|
catch _:{bad_node, _} -> error
|
||||||
end;
|
end;
|
||||||
{selected, []} ->
|
{selected, []} ->
|
||||||
error;
|
error;
|
||||||
|
@ -202,7 +202,7 @@ find_online_room(ServerHost, Room, Host) ->
|
|||||||
"name=%(Room)s and host=%(Host)s")) of
|
"name=%(Room)s and host=%(Host)s")) of
|
||||||
{selected, [{PidS, NodeS}]} ->
|
{selected, [{PidS, NodeS}]} ->
|
||||||
try {ok, aux:decode_pid(PidS, NodeS)}
|
try {ok, aux:decode_pid(PidS, NodeS)}
|
||||||
catch _:{node_down, _} -> error
|
catch _:{bad_node, _} -> error
|
||||||
end;
|
end;
|
||||||
{selected, []} ->
|
{selected, []} ->
|
||||||
error;
|
error;
|
||||||
@ -232,7 +232,7 @@ get_online_rooms(ServerHost, Host, _RSM) ->
|
|||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun({Room, PidS, NodeS}) ->
|
fun({Room, PidS, NodeS}) ->
|
||||||
try [{Room, Host, aux:decode_pid(PidS, NodeS)}]
|
try [{Room, Host, aux:decode_pid(PidS, NodeS)}]
|
||||||
catch _:{node_down, _} -> []
|
catch _:{bad_node, _} -> []
|
||||||
end
|
end
|
||||||
end, Rows);
|
end, Rows);
|
||||||
Err ->
|
Err ->
|
||||||
|
Loading…
Reference in New Issue
Block a user