Merge pull request #2509 from weaveworks/issues/2503-persist-peers-fix

Create restart.sentinel after storing the peer list
This commit is contained in:
Adam Harrison authored and GitHub committed 2016-09-21 10:09:05 +01:00
commit 69b688b357
2 files changed
+11 -6

No files matched your search

+1
View File
@@ -322,6 +322,7 @@ func main() {
if errors := router.InitiateConnections(peers, false); len(errors) > 0 {
Log.Fatal(common.ErrorMessages(errors))
}
checkFatal(router.CreateRestartSentinel())
// The weave script always waits for a status call to succeed,
// so there is no point in doing "weave launch --http-addr ''".
+10 -6
View File
@@ -239,12 +239,16 @@ func (router *NetworkRouter) InitialPeers(resume bool, peers []string) ([]string
return storedPeers, nil
}
sentinel, err := os.Create("restart.sentinel")
if err != nil {
return nil, fmt.Errorf("error creating sentinel: %v", err)
}
sentinel.Close()
log.Println("Launch detected - using supplied peer list:", peers)
return peers, nil
}
func (router *NetworkRouter) CreateRestartSentinel() error {
sentinel, err := os.Create("restart.sentinel")
if err != nil {
return fmt.Errorf("error creating sentinel: %v", err)
}
sentinel.Close()
return nil
}