couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [3/19] git commit: Associate the debugging port with the view server proc
Date Mon, 11 Feb 2013 13:51:16 GMT
Associate the debugging port with the view server proc


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/63c59c7f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/63c59c7f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/63c59c7f

Branch: refs/heads/nodejs_couchdb
Commit: 63c59c7f6acaf0bfc57c9d1f4c626eef7546b9a9
Parents: b5ddad2
Author: Jason Smith (work) <jhs@iriscouch.com>
Authored: Sun Feb 3 14:39:07 2013 +0000
Committer: Jason Smith (work) <jhs@iriscouch.com>
Committed: Sun Feb 3 14:39:07 2013 +0000

----------------------------------------------------------------------
 src/couchdb/couch_query_servers.erl |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/63c59c7f/src/couchdb/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl
index b15122b..5a394b0 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -30,6 +30,7 @@
 
 -record(proc, {
     pid,
+    debug_port,
     lang,
     ddoc_keys = [],
     prompt_fun,
@@ -480,18 +481,21 @@ new_process(Langs, LangLimits, Lang) ->
         % we are below the limit for our language, make a new one
         case ets:lookup(Langs, Lang) of
         [{Lang, Mod, Func, Arg0}] ->
-            Arg = case {Lang, Arg0} of
+            {Arg, DebugPort} = case {Lang, Arg0} of
             {<<"javascript">>, [_OneElement]} ->
-                DebugPort = 5858 + random:uniform(1000),
-                EnvOpt = {env, [{"COUCHJS_DEBUG_PORT", integer_to_list(DebugPort)}]},
-                Arg0 ++ [[], [EnvOpt]];
-            _ -> Arg0
+                DbgPort = 5858 + random:uniform(1000),
+                EnvOpt = {env, [{"COUCHJS_DEBUG_PORT", integer_to_list(DbgPort)}]},
+                AllArgs = Arg0 ++ [ [], [EnvOpt] ],
+                {AllArgs, DbgPort};
+            _ -> {Arg0, nil}
             end,
+
             {ok, Pid} = apply(Mod, Func, Arg),
             erlang:monitor(process, Pid),
             true = ets:insert(LangLimits, {Lang, Lim, Current+1}),
             {ok, #proc{lang=Lang,
                        pid=Pid,
+                       debug_port=DebugPort,
                        % Called via proc_prompt, proc_set_timeout, and proc_stop
                        prompt_fun={Mod, prompt},
                        prompt_many_fun={Mod, prompt_many},


Mime
View raw message