Log when command-line peer list overridden by persisted list
Reworked interface to router so we split setting up the initial list from beginning to make connections - we shouldn't do that until after router.Start().
This commit is contained in:
1 parent
ba8926a6ea
commit
b064bcce49
4 files changed
+46
-21
No files matched your search
+2
-4
@@ -14,18 +14,16 @@ func (router *NetworkRouter) HandleHTTP(muxRouter *mux.Router) {
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, fmt.Sprint("unable to parse form: ", err), http.StatusBadRequest)
|
||||
}
|
||||
if errors := router.ConnectionMaker.InitiateConnections(r.Form["peer"], r.FormValue("replace") == "true"); len(errors) > 0 {
|
||||
if errors := router.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) {
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, fmt.Sprint("unable to parse form: ", err), http.StatusBadRequest)
|
||||
}
|
||||
router.ConnectionMaker.ForgetConnections(r.Form["peer"])
|
||||
router.persistPeers()
|
||||
router.ForgetConnections(r.Form["peer"])
|
||||
})
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user