Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

NC-1936 discovery wiring for --node-whitelist #365

Merged
merged 10 commits into from
Dec 6, 2018
Merged

NC-1936 discovery wiring for --node-whitelist #365

merged 10 commits into from
Dec 6, 2018

Conversation

macfarla
Copy link
Contributor

@macfarla macfarla commented Dec 5, 2018

PR description

If --node-whitelist is set, discard any messages from non-whitelisted peers.

Fixed Issue(s)

NC-1936

@@ -106,6 +107,7 @@

private final PeerDiscoveryAgent agent;
private final PeerBlacklist peerBlacklist;
private final NodeWhitelistController nodeWhitelistController;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: s/nodeWhiteListController/nodeWhitelist
Reason being, the term Controller is unnecessary, brings no additional contextual meaning.

}

public static boolean isNodeWhitelistSet() {
return nodeWhitelistSet;
public boolean isNodeWhitelisted(final Peer node) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: s/isNodeWhiteListed/contains
Reason: as a public scoped method, it would reduce repetition in context when calling the method i.e. nodeWhiteList.contains() vs nodeWhitelist.isNodeWhiteListed()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method also returns true if the whitelist is not set - in which case it doesn't 'contain' anything. contains() doesn't really cover both cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no white list, then everything is whitelisted. The whitelist contains the node, as it is the set of all nodes.

Copy link
Contributor

@CjHare CjHare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@macfarla macfarla merged commit c8e1c07 into PegaSysEng:master Dec 6, 2018
@macfarla macfarla deleted the NC-1936-discovery-wiring branch December 6, 2018 01:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants