Permalink
Browse files

inspector: restore 9229 as a default port

Some tools are now relying on 9229 to be node.js "inspector" port (I
see Chrome extensions, some online blog posts, etc.) Also, having same
default port values for old and new protocols may lead to some
confusion, e.g. when tools are trying to autodiscover debuggable Node
instances.

This is a partial revert of 9f1f7e2. This commit preserves the fix for
issue #8201 bringing back the behavior that the old and new protocols
run on different ports.run on different ports.

PR-URL: #8550
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information...
Eugene Ostroukhov authored and ofrobots committed Sep 15, 2016
1 parent b4a249f commit 626a07df5bae2b32f88863edb9f4404b42de1ad6
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/node.cc
@@ -147,7 +147,9 @@ static const bool use_inspector = false;
static bool use_debug_agent = false;
static bool debug_wait_connect = false;
static std::string* debug_host; // coverity[leaked_storage]
static int debug_port = 5858;
static const int default_debugger_port = 5858;
static const int default_inspector_port = 9229;
static int debug_port = -1;
static const int v8_default_thread_pool_size = 4;
static int v8_thread_pool_size = v8_default_thread_pool_size;
static bool prof_process = false;
@@ -2874,7 +2876,10 @@ static Local<Object> GetFeatures(Environment* env) {
static void DebugPortGetter(Local<Name> property,
const PropertyCallbackInfo<Value>& info) {
info.GetReturnValue().Set(debug_port);
int port = debug_port;
if (port < 0)
port = use_inspector ? default_inspector_port : default_debugger_port;
info.GetReturnValue().Set(port);
}
@@ -3765,15 +3770,17 @@ static void DispatchMessagesDebugAgentCallback(Environment* env) {
static void StartDebug(Environment* env, const char* path, bool wait) {
CHECK(!debugger_running);
if (use_inspector) {
debugger_running = v8_platform.StartInspector(env, path, debug_port, wait);
debugger_running = v8_platform.StartInspector(env, path,
debug_port >= 0 ? debug_port : default_inspector_port, wait);
} else {
env->debugger_agent()->set_dispatch_handler(
DispatchMessagesDebugAgentCallback);
const char* host = debug_host ? debug_host->c_str() : "127.0.0.1";
int port = debug_port >= 0 ? debug_port : default_debugger_port;
debugger_running =
env->debugger_agent()->Start(host, debug_port, wait);
env->debugger_agent()->Start(host, port, wait);
if (debugger_running == false) {
fprintf(stderr, "Starting debugger on %s:%d failed\n", host, debug_port);
fprintf(stderr, "Starting debugger on %s:%d failed\n", host, port);
fflush(stderr);
return;
}

0 comments on commit 626a07d

Please sign in to comment.