Skip to content

Improve fragment reassembly#591

Open
FUTURE-SL wants to merge 2 commits intoRevenantX:masterfrom
FUTURE-SL:fargmentation-update
Open

Improve fragment reassembly#591
FUTURE-SL wants to merge 2 commits intoRevenantX:masterfrom
FUTURE-SL:fargmentation-update

Conversation

@FUTURE-SL
Copy link
Contributor

@FUTURE-SL FUTURE-SL commented Mar 17, 2026

Refactor fragment reassembly logic to be safer and more memory-efficient. IncomingFragments now uses a small fixed array up to a threshold and a dictionary for larger fragment sets, and exposes helpers to Get/Set/Remove fragments and recycle packets. Added validation for FragmentsTotal/FragmentPart and metadata mismatches, an AbortReassembly helper to centralize cleanup, and more robust bounds/error checks.

Add FragmentTimeout to LiteNetManager and refactor fragment reassembly logic to be safer and more memory-efficient. IncomingFragments now uses a small fixed array up to a threshold and a dictionary for larger fragment sets, tracks LastReceivedTime, and exposes helpers to Get/Set/Remove fragments and recycle packets. Added validation for FragmentsTotal/FragmentPart and metadata mismatches, an AbortReassembly helper to centralize cleanup, and more robust bounds/error checks. Maintain an _updateTime and purge expired fragment assemblies during Update to avoid stale fragments and leaks.
@FUTURE-SL FUTURE-SL changed the title Improve fragment reassembly and timeout handling Improve fragment reassembly Mar 18, 2026
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.

1 participant