[pingpong] remove hardcoded delay in sending pong message

Signed-off-by: Leo Chen <leo@harmony.one>
pull/1001/head
Leo Chen 6 years ago
parent 83ade75005
commit 6a7dcc5d7e
  1. 4
      node/node_handler.go

@ -539,14 +539,12 @@ func (node *Node) SendPongMessage() {
utils.GetLogInstance().Info("[PONG] sent pong message to", "group", node.NodeConfig.GetShardGroupID(), "# nodes", numPeersNow)
}
sentMessage = true
// wait a bit until all validators received pong message
time.Sleep(200 * time.Millisecond)
// only need to notify consensus leader once to start the consensus
if firstTime {
// Leader stops sending ping message
time.Sleep(5 * time.Second)
node.serviceManager.TakeAction(&service.Action{Action: service.Stop, ServiceType: service.PeerDiscovery})
utils.GetLogInstance().Info("[PONG] startConsensus")
node.startConsensus <- struct{}{}
firstTime = false
}

Loading…
Cancel
Save