nodechan

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

commit 5b530fad1f8f8df65dcdbe8717c5db4c48a2d640
parent db980457ada15a906d3f8b1fa55f792d6b2eb2f5
Author: joshiemoore <jxm5210@g.rit.edu>
Date:   Tue,  6 Aug 2019 15:54:59 -0400

Add receiptCount to ChanPost to prevent over-propagation

Diffstat:
Msrc/ChanPost.java | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/ChanPost.java b/src/ChanPost.java @@ -24,11 +24,15 @@ public class ChanPost { /** The text of the post **/ private String text; + /** The number of times this node has received this post **/ + private int receiptCount; + public ChanPost(String tid, boolean isRoot, String title, String text) { this.tid = tid; this.isRoot = isRoot; this.title = title; this.text = text; + this.receiptCount = 0; this.postTime = System.currentTimeMillis(); @@ -44,6 +48,15 @@ public class ChanPost { this.pid = new String(pid_bytes); } + /** + * When we receive this message, increment the receipt count. + * The point of this is to avoid over-propagation of messages. Each client + * will limit the number of times they forward a single post, unless they + * are specifically requested to by another client. + */ + public void heard() { + this.receiptCount++; + } /* * getters @@ -71,4 +84,8 @@ public class ChanPost { public long getPostTime() { return this.postTime; } + + public int getReceiptCount() { + return this.receiptCount; + } }