split streamhandler into two functions

one is to handle the message
one is the stream handler

Signed-off-by: Leo Chen <leo@harmony.one>
pull/385/head
Leo Chen 6 years ago
parent 1d71aac6ec
commit 455bfc8f83
  1. 5
      node/node_handler.go

@ -43,6 +43,11 @@ func (node *Node) StreamHandler(s p2p.Stream) {
utils.GetLogInstance().Error("Read p2p data failed", "err", err, "node", node)
return
}
node.messageHandler(content)
}
// messageHandler parses the message and dispatch the actions
func (node *Node) messageHandler(content []byte) {
node.MaybeBroadcastAsValidator(content)
consensusObj := node.Consensus

Loading…
Cancel
Save