Explorar el Código

rafthttp: add remote in pipeline and snapshot handler when corresponding peer or remote do not exist

Fixes: #8506
blueblue hace 8 años
padre
commit
a0361ea3f9
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      rafthttp/http.go

+ 2 - 2
rafthttp/http.go

@@ -91,7 +91,7 @@ func (h *pipelineHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	if from, err := types.IDFromString(r.Header.Get("X-Server-From")); err != nil {
+	if from, err := types.IDFromString(r.Header.Get("X-Server-From")); err == nil {
 		if urls := r.Header.Get("X-PeerURLs"); urls != "" {
 			h.tr.AddRemote(from, strings.Split(urls, ","))
 		}
@@ -176,7 +176,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	if from, err := types.IDFromString(r.Header.Get("X-Server-From")); err != nil {
+	if from, err := types.IDFromString(r.Header.Get("X-Server-From")); err == nil {
 		if urls := r.Header.Get("X-PeerURLs"); urls != "" {
 			h.tr.AddRemote(from, strings.Split(urls, ","))
 		}