Pārlūkot izejas kodu

rafthttp: only close streamMsgApp when updating term

In all stream types, streamMsgApp needs to be closed when
updating term because its stream connection can only be used under
a certain term. But there is no need to close other streams, which
may waste time and reduce performance.
Yicheng Qin 11 gadi atpakaļ
vecāks
revīzija
8637a4bf69
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      rafthttp/stream.go

+ 3 - 1
rafthttp/stream.go

@@ -324,7 +324,9 @@ func (cr *streamReader) updateMsgAppTerm(term uint64) {
 		return
 	}
 	cr.msgAppTerm = term
-	cr.close()
+	if cr.t == streamTypeMsgApp {
+		cr.close()
+	}
 }
 
 // TODO: always cancel in-flight dial and decode