Selaa lähdekoodia

rafthttp: stop masking errMemberRemoved in pipeline

It makes logic more straightforward and readable. Also, it makes the
handle method consistent with stream and snapshot sender.
Yicheng Qin 10 vuotta sitten
vanhempi
commit
84d7825a77
2 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 0 1
      rafthttp/pipeline.go
  2. 1 0
      rafthttp/transport_test.go

+ 0 - 1
rafthttp/pipeline.go

@@ -159,7 +159,6 @@ func (p *pipeline) post(data []byte) (err error) {
 		// always be stopped. So we use reportCriticalError to report it to errorc.
 		// always be stopped. So we use reportCriticalError to report it to errorc.
 		if err == errMemberRemoved {
 		if err == errMemberRemoved {
 			reportCriticalError(err, p.errorc)
 			reportCriticalError(err, p.errorc)
-			return nil
 		}
 		}
 		return err
 		return err
 	}
 	}

+ 1 - 0
rafthttp/transport_test.go

@@ -128,6 +128,7 @@ func TestTransportUpdate(t *testing.T) {
 func TestTransportErrorc(t *testing.T) {
 func TestTransportErrorc(t *testing.T) {
 	errorc := make(chan error, 1)
 	errorc := make(chan error, 1)
 	tr := &Transport{
 	tr := &Transport{
+		Raft:        &fakeRaft{},
 		LeaderStats: stats.NewLeaderStats(""),
 		LeaderStats: stats.NewLeaderStats(""),
 		ErrorC:      errorc,
 		ErrorC:      errorc,
 		streamRt:    newRespRoundTripper(http.StatusForbidden, nil),
 		streamRt:    newRespRoundTripper(http.StatusForbidden, nil),