Skip to content

Commit b074462

Browse files
feat: wait for channel to open before triggering initial state updates (#963)
1 parent 5fb4c62 commit b074462

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

webrtc.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,13 @@ func newSession(config SessionConfig) (*Session, error) {
286286
// Enqueue to ensure ordered processing
287287
session.rpcQueue <- msg
288288
})
289-
triggerOTAStateUpdate()
290-
triggerVideoStateUpdate()
291-
triggerUSBStateUpdate()
292-
notifyFailsafeMode(session)
289+
// Wait for channel to be open before sending initial state
290+
d.OnOpen(func() {
291+
triggerOTAStateUpdate()
292+
triggerVideoStateUpdate()
293+
triggerUSBStateUpdate()
294+
notifyFailsafeMode(session)
295+
})
293296
case "terminal":
294297
handleTerminalChannel(d)
295298
case "serial":

0 commit comments

Comments
 (0)