diff options
author | Eugene Ostroukhov <eostroukhov@chromium.org> | 2017-11-10 16:01:00 -0800 |
---|---|---|
committer | Eugene Ostroukhov <eostroukhov@google.com> | 2017-12-11 15:53:21 -0800 |
commit | 73ad3f9bea3993b486621aaf9e61484dc37741d4 (patch) | |
tree | 259b21142e6c4ceedde66deb1eb37a110e317d9e /src/inspector_io.h | |
parent | e51fb90a6db53588ab2b884e4309d4eea9e37bbd (diff) | |
download | android-node-v8-73ad3f9bea3993b486621aaf9e61484dc37741d4.tar.gz android-node-v8-73ad3f9bea3993b486621aaf9e61484dc37741d4.tar.bz2 android-node-v8-73ad3f9bea3993b486621aaf9e61484dc37741d4.zip |
inspector: Fix crash for WS connection
Attaching WS session will now include a roundtrip onto the main thread
to make sure there is no other session (e.g. JS bindings)
This change also required refactoring WS socket implementation to better
support scenarios like this.
Fixes: https://github.com/nodejs/node/issues/16852
PR-URL: https://github.com/nodejs/node/pull/17085
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'src/inspector_io.h')
-rw-r--r-- | src/inspector_io.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/inspector_io.h b/src/inspector_io.h index 7c15466eed..79ccc6095f 100644 --- a/src/inspector_io.h +++ b/src/inspector_io.h @@ -36,6 +36,7 @@ class InspectorIoDelegate; enum class InspectorAction { kStartSession, + kStartSessionUnconditionally, // First attach with --inspect-brk kEndSession, kSendMessage }; @@ -44,7 +45,9 @@ enum class InspectorAction { enum class TransportAction { kKill, kSendMessage, - kStop + kStop, + kAcceptSession, + kDeclineSession }; class InspectorIo { @@ -61,7 +64,6 @@ class InspectorIo { void Stop(); bool IsStarted(); - bool IsConnected(); void WaitForDisconnect(); // Called from thread to queue an incoming message and trigger @@ -124,6 +126,8 @@ class InspectorIo { void WaitForFrontendMessageWhilePaused(); // Broadcast incoming_message_cond_ void NotifyMessageReceived(); + // Attach session to an inspector. Either kAcceptSession or kDeclineSession + TransportAction Attach(int session_id); const DebugOptions options_; |