Get the pids/ports from pid_procs, not lang_procs
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/801b7310
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/801b7310
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/801b7310
Branch: refs/heads/nodejs_couchdb
Commit: 801b7310e1ce1cb4d958b57dc6d192903df6b416
Parents: c27cef1
Author: Jason Smith (work) <jhs@iriscouch.com>
Authored: Fri Feb 8 11:28:02 2013 +0000
Committer: Jason Smith (work) <jhs@iriscouch.com>
Committed: Fri Feb 8 11:28:02 2013 +0000
----------------------------------------------------------------------
src/couchdb/couch_query_servers.erl | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/801b7310/src/couchdb/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl
index 26382d7..099fc12 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -353,18 +353,9 @@ handle_call({get_proc, Lang}, From, Server) ->
{reply, Error, Server}
end;
handle_call({get_debugging, Lang}, _From, Server) ->
- #qserver{lang_procs=LangProcs} = Server,
- case ets:lookup(LangProcs, Lang) of
- [{Lang, Procs}] ->
- Ports = lists:map(fun(#proc{pid=Pid, debug_port=Port}) ->
- [PidStr] = io_lib:format("~w", [Pid]),
- Pids = string:substr(PidStr, 2, length(PidStr) - 2),
- {?l2b(Pids), Port}
- end, Procs),
- {reply, Ports, Server};
- _ ->
- {reply, [], Server}
- end;
+ #qserver{pid_procs=PidProcs} = Server,
+ Reply = lists:map(fun pid_and_port/1, ets:tab2list(PidProcs)),
+ {reply, Reply, Server};
handle_call({unlink_proc, Pid}, _From, Server) ->
unlink(Pid),
{reply, ok, Server};
@@ -471,6 +462,11 @@ service_waiting({{Lang}, From}, Server) ->
ok
end.
+pid_and_port({Pid, #proc{debug_port=Port}}) ->
+ [PidStr] = io_lib:format("~w", [Pid]),
+ PidRepr = string:substr(PidStr, 2, length(PidStr) - 2),
+ {?l2b(PidRepr), Port}.
+
lang_proc(Lang, #qserver{
langs=Langs,
pid_procs=PidProcs,
|