Skip to content

inspector: change default port #7212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class V8NodeInspector : public blink::V8Inspector {
bool running_nested_loop_;
};

Agent::Agent(Environment* env) : port_(9229),
Agent::Agent(Environment* env) : port_(0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So before the instance is started it will have a port of 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from @Trott: #7206, does this apply here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port value is actually provided at the time Agent::Start is called. This happened to be the default initialization of the field and the value of 9229 was never getting used. This clean it up to be zero-initialized instead.

wait_(false),
connected_(false),
shutting_down_(false),
Expand Down
23 changes: 14 additions & 9 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ static bool use_inspector = false;
static bool use_debug_agent = false;
static bool debug_wait_connect = false;
static int debug_port = 5858;
static int inspector_port = 9229;
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;
Expand Down Expand Up @@ -3351,12 +3352,17 @@ static bool ParseDebugOpt(const char* arg) {
}

if (port != nullptr) {
debug_port = atoi(port);
if (debug_port < 1024 || debug_port > 65535) {
int port_int = atoi(port);
if (port_int < 1024 || port_int > 65535) {
fprintf(stderr, "Debug port must be in range 1024 to 65535.\n");
PrintHelp();
exit(12);
}
if (use_inspector) {
inspector_port = port_int;
} else {
debug_port = port_int;
}
}

return true;
Expand Down Expand Up @@ -3618,22 +3624,21 @@ static void StartDebug(Environment* env, bool wait) {
CHECK(!debugger_running);
#if HAVE_INSPECTOR
if (use_inspector) {
env->inspector_agent()->Start(default_platform, debug_port, wait);
env->inspector_agent()->Start(default_platform, inspector_port, wait);
debugger_running = true;
} else {
#endif
env->debugger_agent()->set_dispatch_handler(
DispatchMessagesDebugAgentCallback);
debugger_running = env->debugger_agent()->Start(debug_port, wait);
if (debugger_running == false) {
fprintf(stderr, "Starting debugger on port %d failed\n", debug_port);
fflush(stderr);
return;
}
#if HAVE_INSPECTOR
}
#endif

if (debugger_running == false) {
fprintf(stderr, "Starting debugger on port %d failed\n", debug_port);
fflush(stderr);
return;
}
}


Expand Down