mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: handle short case in if statement
This commit is contained in:
parent
d393102e24
commit
74382f56fb
@ -143,29 +143,33 @@ func (cw *streamWriter) run() {
|
|||||||
select {
|
select {
|
||||||
case <-heartbeatc:
|
case <-heartbeatc:
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
if err := enc.encode(linkHeartbeatMessage); err != nil {
|
err := enc.encode(linkHeartbeatMessage)
|
||||||
reportSentFailure(string(t), linkHeartbeatMessage)
|
if err == nil {
|
||||||
|
flusher.Flush()
|
||||||
cw.status.deactivate(failureType{source: t.String(), action: "heartbeat"}, err.Error())
|
reportSentDuration(string(t), linkHeartbeatMessage, time.Since(start))
|
||||||
cw.close()
|
|
||||||
heartbeatc, msgc = nil, nil
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
flusher.Flush()
|
|
||||||
reportSentDuration(string(t), linkHeartbeatMessage, time.Since(start))
|
reportSentFailure(string(t), linkHeartbeatMessage)
|
||||||
|
cw.status.deactivate(failureType{source: t.String(), action: "heartbeat"}, err.Error())
|
||||||
|
cw.close()
|
||||||
|
heartbeatc, msgc = nil, nil
|
||||||
|
|
||||||
case m := <-msgc:
|
case m := <-msgc:
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
if err := enc.encode(m); err != nil {
|
err := enc.encode(m)
|
||||||
reportSentFailure(string(t), m)
|
if err == nil {
|
||||||
|
flusher.Flush()
|
||||||
cw.status.deactivate(failureType{source: t.String(), action: "write"}, err.Error())
|
reportSentDuration(string(t), m, time.Since(start))
|
||||||
cw.close()
|
|
||||||
heartbeatc, msgc = nil, nil
|
|
||||||
cw.r.ReportUnreachable(m.To)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
flusher.Flush()
|
|
||||||
reportSentDuration(string(t), m, time.Since(start))
|
reportSentFailure(string(t), m)
|
||||||
|
cw.status.deactivate(failureType{source: t.String(), action: "write"}, err.Error())
|
||||||
|
cw.close()
|
||||||
|
heartbeatc, msgc = nil, nil
|
||||||
|
cw.r.ReportUnreachable(m.To)
|
||||||
|
|
||||||
case conn := <-cw.connc:
|
case conn := <-cw.connc:
|
||||||
cw.close()
|
cw.close()
|
||||||
t = conn.t
|
t = conn.t
|
||||||
|
Loading…
x
Reference in New Issue
Block a user