Browse Source

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 10 years ago
parent
commit
8637a4bf69
1 changed files with 3 additions and 1 deletions
  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