parent
90ace6a331
commit
be2ce93a2c
|
@ -356,7 +356,7 @@ handle(info, {timeout, Timer, emit_stats},
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle(info, {shutdown, discard, {ClientId, ByPid}}, State) ->
|
handle(info, {shutdown, discard, {ClientId, ByPid}}, State) ->
|
||||||
?LOG(error, "Discarded by ~s:~p", [ClientId, ByPid]),
|
?LOG(warning, "Discarded by ~s:~p", [ClientId, ByPid]),
|
||||||
shutdown(discard, State);
|
shutdown(discard, State);
|
||||||
|
|
||||||
handle(info, {shutdown, conflict, {ClientId, NewPid}}, State) ->
|
handle(info, {shutdown, conflict, {ClientId, NewPid}}, State) ->
|
||||||
|
|
|
@ -32,7 +32,7 @@ cast(Node, Mod, Fun, Args) ->
|
||||||
filter_result(?RPC:cast(rpc_node(Node), Mod, Fun, Args)).
|
filter_result(?RPC:cast(rpc_node(Node), Mod, Fun, Args)).
|
||||||
|
|
||||||
rpc_node(Node) ->
|
rpc_node(Node) ->
|
||||||
{ok, ClientNum} = application:get_env(gen_rpc, tcp_client_num),
|
ClientNum = application:get_env(gen_rpc, tcp_client_num, 32),
|
||||||
{Node, rand:uniform(ClientNum)}.
|
{Node, rand:uniform(ClientNum)}.
|
||||||
|
|
||||||
rpc_nodes(Nodes) ->
|
rpc_nodes(Nodes) ->
|
||||||
|
|
|
@ -401,11 +401,11 @@ handle_call(stats, _From, State) ->
|
||||||
reply(stats(State), State);
|
reply(stats(State), State);
|
||||||
|
|
||||||
handle_call({discard, ByPid}, _From, State = #state{conn_pid = undefined}) ->
|
handle_call({discard, ByPid}, _From, State = #state{conn_pid = undefined}) ->
|
||||||
?LOG(warning, "Discarded by ~p", [ByPid]),
|
?LOG(notice, "Discarded by ~p", [ByPid]),
|
||||||
{stop, {shutdown, discarded}, ok, State};
|
{stop, {shutdown, discarded}, ok, State};
|
||||||
|
|
||||||
handle_call({discard, ByPid}, _From, State = #state{client_id = ClientId, conn_pid = ConnPid}) ->
|
handle_call({discard, ByPid}, _From, State = #state{client_id = ClientId, conn_pid = ConnPid}) ->
|
||||||
?LOG(warning, "Conn ~p is discarded by ~p", [ConnPid, ByPid]),
|
?LOG(notice, "Conn ~p is discarded by ~p", [ConnPid, ByPid]),
|
||||||
ConnPid ! {shutdown, discard, {ClientId, ByPid}},
|
ConnPid ! {shutdown, discard, {ClientId, ByPid}},
|
||||||
{stop, {shutdown, discarded}, ok, State};
|
{stop, {shutdown, discarded}, ok, State};
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ discard_session(ClientId, ConnPid) when is_binary(ClientId) ->
|
||||||
catch
|
catch
|
||||||
_:Error:_Stk ->
|
_:Error:_Stk ->
|
||||||
unregister_session(ClientId, SessPid),
|
unregister_session(ClientId, SessPid),
|
||||||
?LOG(warning, "Failed to discard ~p: ~p", [SessPid, Error])
|
?LOG(notice, "Failed to discard ~p: ~p", [SessPid, Error])
|
||||||
end
|
end
|
||||||
end, lookup_session_pids(ClientId)).
|
end, lookup_session_pids(ClientId)).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue