Skip to content

Feature Request: Resynchronization in BeginEndMarkPipelineFilter<T> #785

@bsagal

Description

@bsagal

Summary

The current BeginEndMarkPipelineFilter<T> requires the beginMark to be aligned at the current reader position. If the stream contains garbage or misaligned data before the valid marker, the filter fails to recover and the connection may be closed. This makes it unsuitable for real-world scenarios where streams may contain noise or become desynchronized.

Request

Add an option to BeginEndMarkPipelineFilter<T> to enable automatic resynchronization by scanning the stream for the next occurrence of beginMark when the current position does not match.

Behavior

When enabled, the filter would search for the beginMark using SequenceReader<byte>.TryReadTo(...) or similar efficient logic. Once found, it would resume normal packet framing using the existing endMark.

This would allow the filter to recover from misaligned or corrupted data without requiring a manual reimplementation.

Workaround

Currently, the only way to achieve this behavior is to manually reimplement the pipeline filter using PipelineFilterBase<T> with custom resynchronization logic.

Impact

This change would make BeginEndMarkPipelineFilter<T> more robust and suitable for production use in environments where clean alignment cannot be guaranteed.

Thank you for considering this improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions