summaryrefslogtreecommitdiff
path: root/src/inspector_io.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-05-27 13:31:00 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2017-05-30 12:22:02 +0200
commit399cb25f6266a17f0e5ed838b37b9c8299a87224 (patch)
tree0ef6c616fa42b20dfd1e5fdb496e15e5c1e12775 /src/inspector_io.cc
parentc420cd15403e374111150d46f209211c3289f9f4 (diff)
downloadandroid-node-v8-399cb25f6266a17f0e5ed838b37b9c8299a87224.tar.gz
android-node-v8-399cb25f6266a17f0e5ed838b37b9c8299a87224.tar.bz2
android-node-v8-399cb25f6266a17f0e5ed838b37b9c8299a87224.zip
inspector: bind to random port with --inspect=0
Allow binding to a randomly assigned port number with `--inspect=0` or `--inspect-brk=0`. PR-URL: https://github.com/nodejs/node/pull/5025 Refs: https://github.com/nodejs/node/issues/4419 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'src/inspector_io.cc')
-rw-r--r--src/inspector_io.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/inspector_io.cc b/src/inspector_io.cc
index 6dcc1e0fdd..489b1552df 100644
--- a/src/inspector_io.cc
+++ b/src/inspector_io.cc
@@ -175,7 +175,7 @@ InspectorIo::InspectorIo(Environment* env, v8::Platform* platform,
io_thread_req_(), platform_(platform),
dispatching_messages_(false), session_id_(0),
script_name_(path),
- wait_for_connect_(wait_for_connect) {
+ wait_for_connect_(wait_for_connect), port_(-1) {
main_thread_req_ = new AsyncAndAgent({uv_async_t(), env->inspector_agent()});
CHECK_EQ(0, uv_async_init(env->event_loop(), &main_thread_req_->first,
InspectorIo::MainThreadAsyncCb));
@@ -298,6 +298,7 @@ void InspectorIo::WorkerRunIO() {
uv_sem_post(&start_sem_);
return;
}
+ port_ = server.port(); // Safe, main thread is waiting on semaphore.
if (!wait_for_connect_) {
uv_sem_post(&start_sem_);
}