change the listened address

pull/104/head
Minh Doan 6 years ago
parent 29a5cc563e
commit dbe474a25c
  1. 6
      benchmark.go
  2. 19
      node/node.go

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

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

Loading…
Cancel
Save