mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: msgApp{Reader/Writer} -> msgAppV2{Reader/Writer}
To make what it serves more clear.
This commit is contained in:
parent
5060b2f322
commit
b61eaf3335
@ -148,7 +148,7 @@ func newServerStats() *stats.ServerStats {
|
||||
func waitStreamWorking(p *peer) bool {
|
||||
for i := 0; i < 1000; i++ {
|
||||
time.Sleep(time.Millisecond)
|
||||
if _, ok := p.msgAppWriter.writec(); !ok {
|
||||
if _, ok := p.msgAppV2Writer.writec(); !ok {
|
||||
continue
|
||||
}
|
||||
if _, ok := p.writer.writec(); !ok {
|
||||
|
@ -91,11 +91,11 @@ type peer struct {
|
||||
|
||||
status *peerStatus
|
||||
|
||||
msgAppWriter *streamWriter
|
||||
msgAppV2Writer *streamWriter
|
||||
writer *streamWriter
|
||||
pipeline *pipeline
|
||||
snapSender *snapshotSender // snapshot sender to send v3 snapshot messages
|
||||
msgAppReader *streamReader
|
||||
msgAppV2Reader *streamReader
|
||||
|
||||
sendc chan raftpb.Message
|
||||
recvc chan raftpb.Message
|
||||
@ -118,7 +118,7 @@ func startPeer(streamRt, pipelineRt http.RoundTripper, urls types.URLs, local, t
|
||||
r: r,
|
||||
v3demo: v3demo,
|
||||
status: status,
|
||||
msgAppWriter: startStreamWriter(to, status, fs, r),
|
||||
msgAppV2Writer: startStreamWriter(to, status, fs, r),
|
||||
writer: startStreamWriter(to, status, fs, r),
|
||||
pipeline: newPipeline(pipelineRt, picker, local, to, cid, status, fs, r, errorc),
|
||||
snapSender: newSnapshotSender(pipelineRt, picker, local, to, cid, status, snapst, r, errorc),
|
||||
@ -148,7 +148,7 @@ func startPeer(streamRt, pipelineRt http.RoundTripper, urls types.URLs, local, t
|
||||
}
|
||||
}()
|
||||
|
||||
p.msgAppReader = startStreamReader(streamRt, picker, streamTypeMsgAppV2, local, to, cid, status, p.recvc, p.propc, errorc)
|
||||
p.msgAppV2Reader = startStreamReader(streamRt, picker, streamTypeMsgAppV2, local, to, cid, status, p.recvc, p.propc, errorc)
|
||||
reader := startStreamReader(streamRt, picker, streamTypeMessage, local, to, cid, status, p.recvc, p.propc, errorc)
|
||||
go func() {
|
||||
var paused bool
|
||||
@ -188,11 +188,11 @@ func startPeer(streamRt, pipelineRt http.RoundTripper, urls types.URLs, local, t
|
||||
paused = false
|
||||
case <-p.stopc:
|
||||
cancel()
|
||||
p.msgAppWriter.stop()
|
||||
p.msgAppV2Writer.stop()
|
||||
p.writer.stop()
|
||||
p.pipeline.stop()
|
||||
p.snapSender.stop()
|
||||
p.msgAppReader.stop()
|
||||
p.msgAppV2Reader.stop()
|
||||
reader.stop()
|
||||
close(p.done)
|
||||
return
|
||||
@ -221,7 +221,7 @@ func (p *peer) attachOutgoingConn(conn *outgoingConn) {
|
||||
var ok bool
|
||||
switch conn.t {
|
||||
case streamTypeMsgAppV2:
|
||||
ok = p.msgAppWriter.attach(conn)
|
||||
ok = p.msgAppV2Writer.attach(conn)
|
||||
case streamTypeMessage:
|
||||
ok = p.writer.attach(conn)
|
||||
default:
|
||||
@ -264,7 +264,7 @@ func (p *peer) pick(m raftpb.Message) (writec chan<- raftpb.Message, picked stri
|
||||
// stream for a long time, only use one of the N pipelines to send MsgSnap.
|
||||
if isMsgSnap(m) {
|
||||
return p.pipeline.msgc, pipelineMsg
|
||||
} else if writec, ok = p.msgAppWriter.writec(); ok && isMsgApp(m) {
|
||||
} else if writec, ok = p.msgAppV2Writer.writec(); ok && isMsgApp(m) {
|
||||
return writec, streamAppV2
|
||||
} else if writec, ok = p.writer.writec(); ok {
|
||||
return writec, streamMsg
|
||||
|
@ -75,7 +75,7 @@ func TestPeerPick(t *testing.T) {
|
||||
}
|
||||
for i, tt := range tests {
|
||||
peer := &peer{
|
||||
msgAppWriter: &streamWriter{working: tt.msgappWorking},
|
||||
msgAppV2Writer: &streamWriter{working: tt.msgappWorking},
|
||||
writer: &streamWriter{working: tt.messageWorking},
|
||||
pipeline: &pipeline{},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user