|
|
@ -277,6 +277,7 @@ func (node *Node) pingMessageHandler(msgPayload []byte) int { |
|
|
|
|
|
|
|
|
|
|
|
// add to incoming peer list
|
|
|
|
// add to incoming peer list
|
|
|
|
node.host.AddIncomingPeer(*peer) |
|
|
|
node.host.AddIncomingPeer(*peer) |
|
|
|
|
|
|
|
node.host.ConnectHostPeer(*peer) |
|
|
|
|
|
|
|
|
|
|
|
if ping.Node.Role == proto_node.ClientRole { |
|
|
|
if ping.Node.Role == proto_node.ClientRole { |
|
|
|
utils.GetLogInstance().Info("Add Client Peer to Node", "Node", node.Consensus.GetNodeID(), "Client", peer) |
|
|
|
utils.GetLogInstance().Info("Add Client Peer to Node", "Node", node.Consensus.GetNodeID(), "Client", peer) |
|
|
@ -329,8 +330,6 @@ func (node *Node) pongMessageHandler(msgPayload []byte) int { |
|
|
|
return -1 |
|
|
|
return -1 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
utils.GetLogInstance().Debug("[pongMessageHandler]", "received msg", len(msgPayload)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
peers := make([]*p2p.Peer, 0) |
|
|
|
peers := make([]*p2p.Peer, 0) |
|
|
|
|
|
|
|
|
|
|
|
for _, p := range pong.Peers { |
|
|
|
for _, p := range pong.Peers { |
|
|
@ -349,6 +348,8 @@ func (node *Node) pongMessageHandler(msgPayload []byte) int { |
|
|
|
peers = append(peers, peer) |
|
|
|
peers = append(peers, peer) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils.GetLogInstance().Debug("[pongMessageHandler]", "received msg #peers", len(peers)) |
|
|
|
|
|
|
|
|
|
|
|
if len(peers) > 0 { |
|
|
|
if len(peers) > 0 { |
|
|
|
node.AddPeers(peers) |
|
|
|
node.AddPeers(peers) |
|
|
|
} |
|
|
|
} |
|
|
@ -369,6 +370,8 @@ func (node *Node) pongMessageHandler(msgPayload []byte) int { |
|
|
|
publicKeys = append(publicKeys, &key) |
|
|
|
publicKeys = append(publicKeys, &key) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils.GetLogInstance().Debug("[pongMessageHandler]", "received msg #keys", len(publicKeys)) |
|
|
|
|
|
|
|
|
|
|
|
if node.State == NodeWaitToJoin { |
|
|
|
if node.State == NodeWaitToJoin { |
|
|
|
node.State = NodeReadyForConsensus |
|
|
|
node.State = NodeReadyForConsensus |
|
|
|
// Notify JoinShard to stop sending Ping messages
|
|
|
|
// Notify JoinShard to stop sending Ping messages
|
|
|
|