Skip to content

fix(rtmp): treat non-Start onStatus as rejection during PublishPending#517

Open
staging-devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1779719244-fix-rtmp-badname-onstatus
Open

fix(rtmp): treat non-Start onStatus as rejection during PublishPending#517
staging-devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1779719244-fix-rtmp-badname-onstatus

Conversation

@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor

@staging-devin-ai-integration staging-devin-ai-integration Bot commented May 25, 2026

Summary

  • handle_on_status() now treats any onStatus code that is not NetStream.Publish.Start as a terminal rejection when the connection is in PublishPending state, emitting DisconnectedByPeer and transitioning to Disconnecting.
  • Previously, codes like NetStream.Publish.BadName fell through to the catch-all arm, leaving the connection stuck in PublishPending until the 10s handshake timeout in rtmp.rs.
  • Explicit error/failed/rejected codes still match first and work as before regardless of state.
  • Unknown status codes are still ignored when the connection is not in PublishPending (e.g. NetStream.Play.Start while already Publishing).

Closes #507

Review & Validation

  • Verify the new catch-all arm only fires in PublishPending — codes received in other states still fall through to the no-op _ => {}.
  • handle_on_status_bad_name_rejects_publish — asserts BadName transitions to Disconnecting with a DisconnectedByPeer event containing the description.
  • handle_on_status_unknown_code_rejects_while_publish_pending — asserts Denied (arbitrary non-Start code) also rejects.
  • handle_on_status_non_start_ignored_when_already_publishing — asserts unrelated codes are harmlessly ignored when already Publishing.

Link to Devin session: https://staging.itsdev.in/sessions/6a120b5ffe5a4acdae5dd10b3e629d4f
Requested by: @streamer45


Devin Review

Status Commit
🟢 Reviewed a45ca91
Open in Devin Review (Staging)

Any onStatus code that is not NetStream.Publish.Start is now treated as
a terminal rejection when the connection is in PublishPending state.
Previously, codes like NetStream.Publish.BadName fell through to the
catch-all arm, leaving the connection stuck in PublishPending until the
10s handshake timeout.

Signed-off-by: streamkit-devin <devin@streamkit.dev>
@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review (Staging)
Debug

Playground

Comment on lines +1520 to +1524
_ if self.state == RtmpConnectionState::PublishPending => {
let desc =
extract_info_description(payload).unwrap_or_else(|| code_str.to_string());
self.events.push_back(RtmpConnectionEvent::DisconnectedByPeer { reason: desc });
self.set_state(RtmpConnectionState::Disconnecting);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: PublishPending now fails fast for any non-start publish status

The changed arm makes PublishPending terminal for all status codes other than the exact NetStream.Publish.Start. In the handshake driver, Disconnecting is converted into an immediate handshake error rather than waiting for the 10s timeout (crates/nodes/src/transport/rtmp.rs:493-498), and during the media loop DisconnectedByPeer causes an exit through drain_events (crates/nodes/src/transport/rtmp.rs:607-620). This is an intentional behavior change, not a bug, but reviewers should note it broadens rejection handling beyond codes containing Error, Failed, or Rejected.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.43%. Comparing base (b2d01c2) to head (a45ca91).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
+ Coverage   79.39%   79.43%   +0.04%     
==========================================
  Files         232      232              
  Lines       66904    67006     +102     
  Branches     1909     1909              
==========================================
+ Hits        53117    53229     +112     
+ Misses      13781    13771      -10     
  Partials        6        6              
Flag Coverage Δ
backend 79.17% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 85.27% <ø> (ø)
engine 83.59% <ø> (-0.10%) ⬇️
api 89.98% <ø> (ø)
nodes 75.48% <100.00%> (+0.14%) ⬆️
server 80.26% <ø> (ø)
plugin-native 83.47% <ø> (ø)
plugin-wasm 91.90% <ø> (ø)
ui-services 84.67% <ø> (ø)
ui-components 60.49% <ø> (ø)
Files with missing lines Coverage Δ
crates/nodes/src/transport/rtmp_client.rs 91.34% <100.00%> (+0.52%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: handle_on_status does not treat NetStream.Publish.BadName as terminal

2 participants