Repository navigation
feat: update DAVE session ready handling and dependencies - #561
Merged
Merged
Conversation
topi314
marked this pull request as ready for review
July 2, 2026 16:21
This was referenced Aug 25, 2026
phpboyscout
added a commit
to phpboyscout/disgo
that referenced
this pull request
Aug 25, 2026
udpConnImpl.conn is established in Open, but a UDPConn is reachable before that: Conn.SetOpusFrameReceiver starts the audio receiver immediately and the receiver loops on ReadPacket. Registering a receiver before opening the connection therefore panics with a SIGSEGV rather than returning an error. Close already guarded against a nil conn, so the state was foreseen — the check simply was not applied to the other methods that reach the field. The Ready() gate added to the receive loop in disgoorg#561 hides this for callers who supply a real DAVE session, because Ready stays false until the handshake and the handshake cannot complete before the connection exists. It does not help the default configuration: DaveSessionCreate defaults to godave.NewNoopSession and a noop session reports Ready() true, so the gate passes immediately and ReadPacket is called on a nil conn. Adds ErrUDPConnNotOpen, following ErrGatewayNotConnected in the same package, and returns it from Write, ReadPacket and the three deadline setters. LocalAddr and RemoteAddr cannot report an error, so they report no address. The audio receiver treats the new error like the not-ready case and waits, rather than logging on every iteration — turning a crash into a log flood would not be much of an improvement. Tests cover every guarded path. On unguarded master the ReadPacket case reproduces the original panic, SIGSEGV at addr=0x28.
topi314
pushed a commit
to phpboyscout/disgo
that referenced
this pull request
Aug 25, 2026
udpConnImpl.conn is established in Open, but a UDPConn is reachable before that: Conn.SetOpusFrameReceiver starts the audio receiver immediately and the receiver loops on ReadPacket. Registering a receiver before opening the connection therefore panics with a SIGSEGV rather than returning an error. Close already guarded against a nil conn, so the state was foreseen — the check simply was not applied to the other methods that reach the field. The Ready() gate added to the receive loop in disgoorg#561 hides this for callers who supply a real DAVE session, because Ready stays false until the handshake and the handshake cannot complete before the connection exists. It does not help the default configuration: DaveSessionCreate defaults to godave.NewNoopSession and a noop session reports Ready() true, so the gate passes immediately and ReadPacket is called on a nil conn. Adds ErrUDPConnNotOpen, following ErrGatewayNotConnected in the same package, and returns it from Write, ReadPacket and the three deadline setters. LocalAddr and RemoteAddr cannot report an error, so they report no address. The audio receiver treats the new error like the not-ready case and waits, rather than logging on every iteration — turning a crash into a log flood would not be much of an improvement. Tests cover every guarded path. On unguarded master the ReadPacket case reproduces the original panic, SIGSEGV at addr=0x28.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.