Skip to content

Commit

Permalink
reduction stack usage on match filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Oct 22, 2023
1 parent bee73a8 commit af28cc0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/inputs/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,15 @@ export default class Input {
};


_filterIgnoreMorespecifics = (prefix, includeIgnoredMorespecifics) => {

return i => {
return includeIgnoredMorespecifics
|| !i.ignoreMorespecifics
|| ipUtils._isEqualPrefix(i.prefix, prefix); // last piece says "or it is not a more specific"
}
_filterIgnoreMorespecifics = (i, prefix, includeIgnoredMorespecifics) => {
return includeIgnoredMorespecifics
|| !i.ignoreMorespecifics
|| ipUtils._isEqualPrefix(i.prefix, prefix); // last piece says "or it is not a more specific"
}

getMoreSpecificMatches = (prefix, includeIgnoredMorespecifics=false) => {
return this.index.getMatch(prefix, false)
.filter(this._filterIgnoreMorespecifics(prefix, includeIgnoredMorespecifics));
.filter(i => this._filterIgnoreMorespecifics(i, prefix, includeIgnoredMorespecifics));
}

getMonitoredASns = () => {
Expand Down

0 comments on commit af28cc0

Please sign in to comment.