You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2019/04/23 23:08:58 UTC

[incubator-tuweni] 17/43: modifying sendGossipMessage to return the message hash

This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git

commit a3f1f7ffc02016122bbc6819f79e6c4a22049452
Author: jonny rhea <jo...@gmail.com>
AuthorDate: Mon Apr 8 13:50:24 2019 -0500

    modifying sendGossipMessage to return the message hash
---
 plumtree/src/main/java/org/apache/tuweni/plumtree/State.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/plumtree/src/main/java/org/apache/tuweni/plumtree/State.java b/plumtree/src/main/java/org/apache/tuweni/plumtree/State.java
index bc776e0..bb71818 100644
--- a/plumtree/src/main/java/org/apache/tuweni/plumtree/State.java
+++ b/plumtree/src/main/java/org/apache/tuweni/plumtree/State.java
@@ -244,10 +244,13 @@ public final class State {
    * Sends a gossip message to all peers, according to their status.
    * 
    * @param message the message to propagate
+   * @return The associated hash of the message
    */
-  public void sendGossipMessage(Bytes message) {
-    MessageHandler handler = messageHandlers.computeIfAbsent(messageHashingFunction.hash(message), MessageHandler::new);
+  public Bytes sendGossipMessage(Bytes message) {
+    Bytes messageHash = messageHashingFunction.hash(message);
+    MessageHandler handler = messageHandlers.computeIfAbsent(messageHash, MessageHandler::new);
     handler.fullMessageReceived(null, message);
+    return messageHash;
   }
 
   void processQueue() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org