Merge pull request #504 from LeoHChen/parallel_message_processing

process each message using a goroutine
pull/505/head
Leo Chen 6 years ago committed by GitHub
commit 0171262ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      node/node_handler.go

@ -65,7 +65,7 @@ func (node *Node) ReceiveGroupMessage() {
// utils.GetLogInstance().Info("[PUBSUB]", "received group msg", len(msg), "sender", sender) // utils.GetLogInstance().Info("[PUBSUB]", "received group msg", len(msg), "sender", sender)
if err == nil { if err == nil {
// skip the first 5 bytes, 1 byte is p2p type, 4 bytes are message size // skip the first 5 bytes, 1 byte is p2p type, 4 bytes are message size
node.messageHandler(msg[5:], string(sender)) go node.messageHandler(msg[5:], string(sender))
} }
} }
} }
@ -85,7 +85,7 @@ func (node *Node) ReceiveClientGroupMessage() {
utils.GetLogInstance().Info("[CLIENT]", "received group msg", len(msg), "sender", sender) utils.GetLogInstance().Info("[CLIENT]", "received group msg", len(msg), "sender", sender)
if err == nil { if err == nil {
// skip the first 5 bytes, 1 byte is p2p type, 4 bytes are message size // skip the first 5 bytes, 1 byte is p2p type, 4 bytes are message size
node.messageHandler(msg[5:], string(sender)) go node.messageHandler(msg[5:], string(sender))
} }
} }
} }

Loading…
Cancel
Save