etcdserver: add a test to verify not to send duplicated append responses

This commit is contained in:
johncming
2019-01-08 09:56:39 +08:00
parent 577d7c0df2
commit e8f46ce341
2 changed files with 62 additions and 0 deletions

View File

@@ -1768,3 +1768,24 @@ func (s *snapTransporter) SendSnapshot(m snap.Message) {
m.CloseWithError(nil)
s.snapDoneC <- m
}
type sendMsgAppRespTransporter struct {
nopTransporter
sendC chan int
}
func newSendMsgAppRespTransporter() (rafthttp.Transporter, <-chan int) {
ch := make(chan int, 1)
tr := &sendMsgAppRespTransporter{sendC: ch}
return tr, ch
}
func (s *sendMsgAppRespTransporter) Send(m []raftpb.Message) {
var send int
for _, msg := range m {
if msg.To != 0 {
send++
}
}
s.sendC <- send
}