rokucommunity / roku-debug

A compatibility wrapper around the BrightScript debug protocol https://developer.roku.com/en-ca/docs/developer-program/debugging/socket-based-debugger.md
MIT License
13 stars 9 forks source link

Better debug protocol launch handling #102

Closed TwitchBronBron closed 2 years ago

TwitchBronBron commented 2 years ago

Fixes some stability issues when interacting with the debug protocol.

The previous code assumed that we would always get the handshake response first, then the IO_PORT_OPENED update next, and then the rest of the debug protocol was active. However, this is incorrect. The IO_PORT_OPENED could happen at any point throughout the debug session, and should not be assumed to open at the start.

This code properly decouples the IO_PORT_OPENED from the startup logic. now the IO port can be opened at any point, and the connection is considered "open" the moment the handshake is complete.