Skip to content

fix(rtmp_bridge): preserve ConnState on connect, deactivate on stream switch#33

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/bug-scanning-automation-3159
Closed

fix(rtmp_bridge): preserve ConnState on connect, deactivate on stream switch#33
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/bug-scanning-automation-3159

Conversation

@cursor

@cursor cursor Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Bug scan: rtmp_bridge (2026-07-02)

Critical bugs fixed

  1. on_connect() wiped authorized publisher state

    • When a client completes handshake + publish in a single poll() tick, authorize_publish() runs before the poll-loop on_connect().
    • on_connect() used HashMap::insert, replacing the ConnState that already held the publisher row.
    • Impact: legitimate publishers rejected as unauthorized; ghost active=1 publisher row blocks future publishes to that stream.
  2. Stream switch left ghost active DB rows

    • authorize_publish() / on_play() overwrote in-memory session state without deactivating the prior publisher/player row when the same TCP connection issued a second publish/play to a different stream.
    • Impact: stale active rows in stats/API; publisher slot leak on stream switch.

Fix

  • on_connect() now uses entry().or_insert_with() to preserve existing ConnState.
  • authorize_publish() / on_play() deactivate any prior session row on the same connection before acquiring a new one.

Tests

  • on_connect_preserves_prior_authorize_publish_state
  • authorize_publish_switching_streams_deactivates_prior_publisher
  • on_play_switching_streams_deactivates_prior_player

All 13 rtmp_bridge unit tests pass.

Open in Web View Automation 

…eam switch

on_connect() used HashMap::insert which wiped publisher/player state when
authorize_publish() already ran during the same poll() tick (fast handshake +
publish). That rejected legitimate publishers and left ghost active publisher
rows blocking re-publish.

Also deactivate prior publisher/player DB rows when the same connection
switches streams via a second publish/play on the same TCP session.

Co-authored-by: Alexander Wagner <info@alexanderwagnerdev.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 47a69502-6cdb-4559-8b90-ffaab615ebc2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/bug-scanning-automation-3159

Comment @coderabbitai help to get the list of available commands.

@AlexanderWagnerDev AlexanderWagnerDev deleted the cursor/bug-scanning-automation-3159 branch July 2, 2026 12:37
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.

2 participants