Skip to content

Refactor PushClient to improve robustness and error handling#3

Closed
nglmercer wants to merge 15 commits into
RustLangES:mainfrom
nglmercer:reconnect
Closed

Refactor PushClient to improve robustness and error handling#3
nglmercer wants to merge 15 commits into
RustLangES:mainfrom
nglmercer:reconnect

Conversation

@nglmercer

Copy link
Copy Markdown
Contributor

The client state handling and network tasks have been significantly refactored to prevent resource deadlocks and unbounded memory growth. This includes proper buffering of media before publication, graceful shutdown procedures, and enhanced logging for connection status.

Key changes:

  • Added bounded media buffers with LRU eviction for video/audio frames to prevent memory leaks
  • Implemented structured background tasks for TCP reading/writing with proper cancellation
  • Added sequence header caching and pre-publication buffering to ensure stream continuity
  • Enhanced RTMP event handling to detect connection failures and reject streams appropriately
  • Improved logging for connection status, errors, and shutdown events
  • Simplified TLS connection setup and error propagation

The client state handling and network tasks have been significantly refactored to prevent
resource deadlocks and unbounded memory growth. This includes proper buffering of media
before publication, graceful shutdown procedures, and enhanced logging for connection status.

Key changes:
- Added bounded media buffers with LRU eviction for video/audio frames to prevent memory leaks
- Implemented structured background tasks for TCP reading/writing with proper cancellation
- Added sequence header caching and pre-publication buffering to ensure stream continuity
- Enhanced RTMP event handling to detect connection failures and reject streams appropriately
- Improved logging for connection status, errors, and shutdown events
- Simplified TLS connection setup and error propagation
@gg0074x gg0074x requested a review from SergioRibera January 18, 2026 23:20
@Juanperias

Copy link
Copy Markdown
Member

i feel that this code is ai-generated but i cant prove it

@Juanperias Juanperias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are a lot of comments that simply clutter up the code and add nothing (I know these comments are made with AI).

Example:

        // FIXED: Collapsed nested if let
        if let Some(meta) = &state.prepublish_metadata
            && let Ok(res) = state.session.publish_metadata(meta)
        {
            Self::send_packet(tx, res);
        }

        // FIXED: Collapsed nested if let
       // ...

@Juanperias

Juanperias commented Jan 19, 2026

Copy link
Copy Markdown
Member

My opinion is no, this should not be merged! As long as the code is still riddled with AI slop. If the solution is correct, then fine, but there wasn't human intervention, which makes reviewing the PR extremely tedious, not to mention that the AI tends to break the codebase.

Even so, @SergioRibera is the one managing the project, so the final decision is up to him

nglmercer and others added 13 commits May 27, 2026 21:45
Create reestream-srt with listener and sender implementations,
configuration, and error handling. Update workspace and roadmap to
reflect new protocol support.
Introduce graceful shutdown, rate limiting, and connection pooling in
reestream-core. Add webhook module to reestream-server for stream event
notifications. Enable SRT feature in main crate with proper dependency
management.
- Simplify error responses in stop_recording and delete_recording
- Clone input and path for async task ownership in RecordingManager
- Adjust build_ffmpeg_args to accept &Path instead of &PathBuf
@nglmercer nglmercer closed this May 29, 2026
@Phosphorus-M

Copy link
Copy Markdown
Member

Lo lograron. Finalmente lo rompieron. Finalmente ganaron. Destrozaron a alguien. A alguien que siempre estaba feliz, que siempre estaba sonriendo. A alguien que no merecía el odio. A alguien que no hacía nada más que ayudar a las personas. A alguien que amó con todo su corazón. Finalmente lo lograron.

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.

3 participants