You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A floating-point JSON number (e.g., 2.0) will be stringified as "2.0" and then fail to parse as a CPU index inside insert_cpu. Restrict the numeric arm to integers so invalid values are rejected with the clear "Invalid CPU" message instead of a confusing parse error.
let s = match item {
- Value::Number(n) => n.to_string(),+ Value::Number(n) if n.is_u64() => n.to_string(),
Value::String(s) => s.clone(),
u => panic!("Invalid CPU {:?}.", u)
};
Suggestion importance[1-10]: 3
__
Why: Adding the n.is_u64() guard correctly prevents floats like 2.0 from being stringified and producing a confusing downstream parse error in insert_cpu. It is a valid but minor robustness/readability improvement to error handling.
Low
Name the hotfix multiplier constant
*The bare 4.0 is an undocumented hotfix multiplier that significantly changes the computed defrag_memcap. Extract it into a named constant with a comment referencing the open analysis item in ISSUES.md so its purpose and temporary nature are clear to future maintainers.
- hashsize*DEFRAG_TRACKER_HASHROW+(max_defrag_tracker_active+(self.get_ippair_host_defrag_stream_reassembly_prealloc(answers, &HashType::Defrag) as f64)*MULTIPLIER)*DEFRAG_TRACKER*4.0+ // Temporary hotfix multiplier for defrag_memcap; accounts for unmodeled memory+ // components. Needs further analysis (see ISSUES.md).+ const DEFRAG_MEMCAP_HOTFIX_MULTIPLIER: f64 = 4.0;+ hashsize*DEFRAG_TRACKER_HASHROW+(max_defrag_tracker_active+(self.get_ippair_host_defrag_stream_reassembly_prealloc(answers, &HashType::Defrag) as f64)*MULTIPLIER)*DEFRAG_TRACKER*DEFRAG_MEMCAP_HOTFIX_MULTIPLIER
Suggestion importance[1-10]: 2
__
Why: Replacing the magic number *4.0 with a named, commented constant slightly improves readability given the hotfix note in ISSUES.md. However, it is a purely cosmetic/documentation change with no functional impact on the PR's correctness.
Low
Author self-review: I have reviewed the PR code suggestions, and addressed the relevant ones.
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
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.
PR Type
Bug fix, Documentation
Description
Fix CPU affinity module to parse CPU set ranges
Apply 4x correction factor to defrag memcap
Increase Suricata shutdown timeout to 60s
Bump version to 1.1.0-dev.2, update docs
Diagram Walkthrough
File Walkthrough
3 files
Add CPU set range parsing for max_cpu_usage_vecApply 4x correction factor to defrag memcapIncrease Suricata shutdown timeout to 60 seconds1 files
Make CPU range parsing helpers public2 files
Bump version to 1.1.0-dev.2Update version and CPU vector example range2 files
Update known issues listUpdate version references to 1.1.0-dev.2