nodechan

decentralized peer-to-peer anonymous messageboard client
git clone git://squid-tech.com/nodechan.git
Log | Files | Refs | README

commit dc6d841f5ba846a8fad2f45016c170a96433ed65
parent 452b95846d79fdd383e022e0dd4f9b1e3e90ae86
Author: joshiemoore <jxm5210@g.rit.edu>
Date:   Fri,  9 Aug 2019 22:27:55 -0400

Prevent user from adding a blocked user, or getting a blocked user from the peer tracker

Diffstat:
Msrc/NodeChan.java | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/NodeChan.java b/src/NodeChan.java @@ -321,11 +321,9 @@ public class NodeChan { Peer newPeer = new Peer(readIP); // check to make sure that we haven't already blocked this peer - for (Peer p : peers) { - if (p.equalsAddress(newPeer.getAddress())) { - System.out.println("Cannot add a blocked user as a peer."); - continue; - } + if (checkBlocked(newPeer.getAddress())) { + System.out.println("Cannot add a blocked user as a peer."); + continue; } if (!newPeer.isResolved()) { @@ -511,6 +509,13 @@ public class NodeChan { return false; } + // check if peer is blocked + if (checkBlocked(retrieved.getAddress())) { + // we will not add a blocked peer, but we will still return true, + // since we would have been able to add this peer + return true; + } + // check if we already have this peer // if so, update the peer's time for (Peer p : peers) {