8000 feat: update DAVE session ready handling and dependencies by topi314 · Pull Request #561 · disgoorg/disgo · GitHub
[go: up one dir, main page]

Skip to content

feat: update DAVE session ready handling and dependencies - #561

Merged
topi314 merged 3 commits into
masterfrom
feat/dave-ready-check
Jul 2, 2026
Merged

topi314 merged 3 commits into
masterfrom
feat/dave-ready-check

Conversation

@topi314
@topi314 topi314 commented Jun 29, 2026
Copy link
Copy Markdown
Member

No description provided.

@topi314
topi314 marked this pull request as ready for review July 2, 2026 16:21
@topi314
topi314 merged commit f4ccace into master Jul 2, 2026
7 checks passed
@topi314
topi314 deleted the feat/dave-ready-check branch July 2, 2026 16:22
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant

0