-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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.