diff options
author | Dan Gudmundsson <[email protected]> | 2015-02-20 10:06:56 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2015-02-20 10:06:56 +0100 |
commit | aa1fe3b7fe53118439d0dd33f5dae5eeb7db9275 (patch) | |
tree | 8d7f62f55ab963921cb3cc611e5463a24fd37d23 /lib/observer | |
parent | fce4113b4f450b3af458b6ad46cf6121836bff85 (diff) | |
download | otp-aa1fe3b7fe53118439d0dd33f5dae5eeb7db9275.tar.gz otp-aa1fe3b7fe53118439d0dd33f5dae5eeb7db9275.tar.bz2 otp-aa1fe3b7fe53118439d0dd33f5dae5eeb7db9275.zip |
observer: Cleanup io server parts
Diffstat (limited to 'lib/observer')
-rw-r--r-- | lib/observer/src/observer_procinfo.erl | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/lib/observer/src/observer_procinfo.erl b/lib/observer/src/observer_procinfo.erl index a8512894f9..2a840dc49e 100644 --- a/lib/observer/src/observer_procinfo.erl +++ b/lib/observer/src/observer_procinfo.erl @@ -338,7 +338,7 @@ init_log_page(Parent, Pid, Table) -> Update = fun() -> Fd = spawn_link(fun() -> io_server() end), rpc:call(node(Pid), rb, rescan, [[{start_log, Fd}]]), - rpc:call(node(Pid), rb , grep, [local_pid_str(Pid)]), + rpc:call(node(Pid), rb, grep, [local_pid_str(Pid)]), Logs = io_get_data(Fd), %% Replace remote local pid notation to global notation Pref = global_pid_node_pref(Pid), @@ -453,7 +453,7 @@ global_pid_node_pref(Pid) -> io_get_data(Pid) -> Pid ! {self(), get_data_and_close}, receive - {Pid, data, Data} -> lists:flatten(Data) + {Pid, data, Data} -> lists:flatten(Data) end. io_server() -> @@ -461,29 +461,25 @@ io_server() -> io_server(State) -> receive - {io_request, From, ReplyAs, Request} -> - case io_request(Request,State) of - {Tag, Reply, NewState} when Tag =:= ok; Tag =:= error -> - From ! {io_reply, ReplyAs, Reply}, - io_server(NewState); - {stop, Reply, _NewState} -> - From ! {io_reply, ReplyAs, Reply}, - exit(Reply) - end; - {Pid, get_data_and_close} -> - Pid ! {self(), data, lists:reverse(State#io.rdata)}, - normal; - _Unknown -> - io:format("~p: Unknown msg: ~p ~n",[?LINE, _Unknown]), - io_server(State) + {io_request, From, ReplyAs, Request} -> + {_, Reply, NewState} = io_request(Request,State), + From ! {io_reply, ReplyAs, Reply}, + io_server(NewState); + {Pid, get_data_and_close} -> + Pid ! {self(), data, lists:reverse(State#io.rdata)}, + normal; + _Unknown -> + io_server(State) end. io_request({put_chars, _Encoding, Chars}, State = #io{rdata=Data}) -> {ok, ok, State#io{rdata=[Chars|Data]}}; io_request({put_chars, Encoding, Module, Function, Args}, State) -> - try io_request({put_chars, Encoding, apply(Module, Function, Args)}, State) - catch _:_ -> {error, {error,Function}, State} + try + io_request({put_chars, Encoding, apply(Module, Function, Args)}, State) + catch _:_ -> + {error, {error, Function}, State} end; -io_request(Req, State) -> - io:format("~p: Unknown req: ~p ~n",[?LINE, Req]), - State. +io_request(_Req, State) -> + %% io:format("~p: Unknown req: ~p ~n",[?LINE, _Req]), + {ok, {error, request}, State}. |