Simplify TcpReassembly connection purge to use multimap.#2104
Open
Dimi1010 wants to merge 1 commit intoseladb:devfrom
Open
Simplify TcpReassembly connection purge to use multimap.#2104Dimi1010 wants to merge 1 commit intoseladb:devfrom
Dimi1010 wants to merge 1 commit intoseladb:devfrom
Conversation
…p<K, list<V>>. The change removes the need to create a list for situations where only 1 connection will be purged at time T. Instead the additional flow keys at time T will be directly inserted into the multimap as additional nodes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2104 +/- ##
==========================================
- Coverage 83.93% 83.92% -0.01%
==========================================
Files 316 316
Lines 57024 57010 -14
Branches 11790 12082 +292
==========================================
- Hits 47863 47848 -15
+ Misses 8006 7967 -39
- Partials 1155 1195 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tigercosmos
reviewed
Apr 13, 2026
|
|
||
| using ConnectionList = std::unordered_map<uint32_t, TcpReassemblyData>; | ||
| using CleanupList = std::map<time_t, std::list<uint32_t>>; | ||
| using CleanupList = std::multimap<time_t, uint32_t>; |
Collaborator
There was a problem hiding this comment.
Maybe rename it to CleanupMultiMap. The original naming is misleading.
tigercosmos
reviewed
Apr 13, 2026
| // removed from storage. | ||
|
|
||
| auto expireTime = time(nullptr) + m_ClosedConnectionDelay; | ||
| m_CleanupList.insert(std::make_pair(expireTime, flowKey)); |
Collaborator
There was a problem hiding this comment.
I wonder if emplace is better.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The change removes the need to create a list for situations where only 1 connection will be purged at time T.
Instead the additional flow keys at time T will be directly inserted into the multimap as additional nodes.
The change also simplifies the purge code down to a single loop over the range of nodes
[beginIt, upperBound(T)).Since
multimap<K, V>is an ordered container, the connections are purged in the order: oldest expire time -> oldest insertion.