change the listened address

pull/104/head^2
Minh Doan 6 years ago
parent 45e0eeb728
commit c2263ed53d
  1. 6
      benchmark.go
  2. 19
      node/node.go

@ -230,8 +230,6 @@ func main() {
}
}
go currentNode.StartServer(*port)
go currentNode.StartHelpSyncing()
// Keep waiting.
<-make(chan struct{})
go currentNode.SupportSyncing()
currentNode.StartServer(*port)
}

@ -50,7 +50,7 @@ const (
TimeToSleepForSyncing = time.Second * 30
)
// NetworkNode is TODO(leo)
// NetworkNode ...
type NetworkNode struct {
SelfPeer p2p.Peer
IDCPeer p2p.Peer
@ -351,17 +351,10 @@ func (node *Node) JoinShard(leader p2p.Peer) {
}
}
// StartHelpSyncing keeps sleeping until it's doing consensus or it's a leader.
func (node *Node) StartHelpSyncing() {
for {
time.Sleep(TimeToSleepForSyncing)
//
if node.State == NodeDoingConsensus || node.State == NodeLeader {
node.InitSyncingServer()
node.StartHelpSyncing()
break
}
}
// SupportSyncing keeps sleeping until it's doing consensus or it's a leader.
func (node *Node) SupportSyncing() {
node.InitSyncingServer()
node.StartSyncingServer()
}
// InitSyncingServer starts downloader server.
@ -372,7 +365,7 @@ func (node *Node) InitSyncingServer() {
// StartSyncingServer starts syncing server.
func (node *Node) StartSyncingServer() {
// Handles returned grpcServer??
node.downloaderServer.Start("localhost", downloader.DefaultDownloadPort)
node.downloaderServer.Start(node.SelfPeer.Ip, downloader.DefaultDownloadPort)
}
// CalculateResponse implements DownloadInterface on Node object.

Loading…
Cancel
Save