rafthttp: fix "unconvert" warnings
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>release-3.4
parent
eae30a6c9b
commit
53ade5e872
|
@ -86,12 +86,12 @@ func (enc *msgAppV2Encoder) encode(m *raftpb.Message) error {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
switch {
|
switch {
|
||||||
case isLinkHeartbeatMessage(m):
|
case isLinkHeartbeatMessage(m):
|
||||||
enc.uint8buf[0] = byte(msgTypeLinkHeartbeat)
|
enc.uint8buf[0] = msgTypeLinkHeartbeat
|
||||||
if _, err := enc.w.Write(enc.uint8buf); err != nil {
|
if _, err := enc.w.Write(enc.uint8buf); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case enc.index == m.Index && enc.term == m.LogTerm && m.LogTerm == m.Term:
|
case enc.index == m.Index && enc.term == m.LogTerm && m.LogTerm == m.Term:
|
||||||
enc.uint8buf[0] = byte(msgTypeAppEntries)
|
enc.uint8buf[0] = msgTypeAppEntries
|
||||||
if _, err := enc.w.Write(enc.uint8buf); err != nil {
|
if _, err := enc.w.Write(enc.uint8buf); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ func (dec *msgAppV2Decoder) decode() (raftpb.Message, error) {
|
||||||
if _, err := io.ReadFull(dec.r, dec.uint8buf); err != nil {
|
if _, err := io.ReadFull(dec.r, dec.uint8buf); err != nil {
|
||||||
return m, err
|
return m, err
|
||||||
}
|
}
|
||||||
typ = uint8(dec.uint8buf[0])
|
typ = dec.uint8buf[0]
|
||||||
switch typ {
|
switch typ {
|
||||||
case msgTypeLinkHeartbeat:
|
case msgTypeLinkHeartbeat:
|
||||||
return linkHeartbeatMessage, nil
|
return linkHeartbeatMessage, nil
|
||||||
|
|
|
@ -256,7 +256,7 @@ func (p *peer) send(m raftpb.Message) {
|
||||||
zap.String("message-type", m.Type.String()),
|
zap.String("message-type", m.Type.String()),
|
||||||
zap.String("local-member-id", p.localID.String()),
|
zap.String("local-member-id", p.localID.String()),
|
||||||
zap.String("from", types.ID(m.From).String()),
|
zap.String("from", types.ID(m.From).String()),
|
||||||
zap.String("remote-peer-id", types.ID(p.id).String()),
|
zap.String("remote-peer-id", p.id.String()),
|
||||||
zap.Bool("remote-peer-active", p.status.isActive()),
|
zap.Bool("remote-peer-active", p.status.isActive()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -269,7 +269,7 @@ func (p *peer) send(m raftpb.Message) {
|
||||||
zap.String("message-type", m.Type.String()),
|
zap.String("message-type", m.Type.String()),
|
||||||
zap.String("local-member-id", p.localID.String()),
|
zap.String("local-member-id", p.localID.String()),
|
||||||
zap.String("from", types.ID(m.From).String()),
|
zap.String("from", types.ID(m.From).String()),
|
||||||
zap.String("remote-peer-id", types.ID(p.id).String()),
|
zap.String("remote-peer-id", p.id.String()),
|
||||||
zap.Bool("remote-peer-active", p.status.isActive()),
|
zap.Bool("remote-peer-active", p.status.isActive()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -62,7 +62,7 @@ func (g *remote) send(m raftpb.Message) {
|
||||||
zap.String("message-type", m.Type.String()),
|
zap.String("message-type", m.Type.String()),
|
||||||
zap.String("local-member-id", g.localID.String()),
|
zap.String("local-member-id", g.localID.String()),
|
||||||
zap.String("from", types.ID(m.From).String()),
|
zap.String("from", types.ID(m.From).String()),
|
||||||
zap.String("remote-peer-id", types.ID(g.id).String()),
|
zap.String("remote-peer-id", g.id.String()),
|
||||||
zap.Bool("remote-peer-active", g.status.isActive()),
|
zap.Bool("remote-peer-active", g.status.isActive()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,7 +75,7 @@ func (g *remote) send(m raftpb.Message) {
|
||||||
zap.String("message-type", m.Type.String()),
|
zap.String("message-type", m.Type.String()),
|
||||||
zap.String("local-member-id", g.localID.String()),
|
zap.String("local-member-id", g.localID.String()),
|
||||||
zap.String("from", types.ID(m.From).String()),
|
zap.String("from", types.ID(m.From).String()),
|
||||||
zap.String("remote-peer-id", types.ID(g.id).String()),
|
zap.String("remote-peer-id", g.id.String()),
|
||||||
zap.Bool("remote-peer-active", g.status.isActive()),
|
zap.Bool("remote-peer-active", g.status.isActive()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue