Persist set of peers to connect to

This commit is contained in:
Bryan Boreham committed 2016-02-17 18:12:16 +00:00
1 parent 09cd9e091a
commit ba8926a6ea
4 files changed
+28 -5

No files matched your search

+2
View File
@@ -17,6 +17,7 @@ func (router *NetworkRouter) HandleHTTP(muxRouter *mux.Router) {
if errors := router.ConnectionMaker.InitiateConnections(r.Form["peer"], r.FormValue("replace") == "true"); len(errors) > 0 {
http.Error(w, common.ErrorMessages(errors), http.StatusBadRequest)
}
router.persistPeers()
})
muxRouter.Methods("POST").Path("/forget").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -24,6 +25,7 @@ func (router *NetworkRouter) HandleHTTP(muxRouter *mux.Router) {
http.Error(w, fmt.Sprint("unable to parse form: ", err), http.StatusBadRequest)
}
router.ConnectionMaker.ForgetConnections(r.Form["peer"])
router.persistPeers()
})
}