Browse Source

rafthttp: fix "unconvert" warnings

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
53ade5e872
3 changed files with 7 additions and 7 deletions
  1. 3 3
      rafthttp/msgappv2_codec.go
  2. 2 2
      rafthttp/peer.go
  3. 2 2
      rafthttp/remote.go

+ 3 - 3
rafthttp/msgappv2_codec.go

@@ -86,12 +86,12 @@ func (enc *msgAppV2Encoder) encode(m *raftpb.Message) error {
 	start := time.Now()
 	switch {
 	case isLinkHeartbeatMessage(m):
-		enc.uint8buf[0] = byte(msgTypeLinkHeartbeat)
+		enc.uint8buf[0] = msgTypeLinkHeartbeat
 		if _, err := enc.w.Write(enc.uint8buf); err != nil {
 			return err
 		}
 	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 {
 			return err
 		}
@@ -179,7 +179,7 @@ func (dec *msgAppV2Decoder) decode() (raftpb.Message, error) {
 	if _, err := io.ReadFull(dec.r, dec.uint8buf); err != nil {
 		return m, err
 	}
-	typ = uint8(dec.uint8buf[0])
+	typ = dec.uint8buf[0]
 	switch typ {
 	case msgTypeLinkHeartbeat:
 		return linkHeartbeatMessage, nil

+ 2 - 2
rafthttp/peer.go

@@ -256,7 +256,7 @@ func (p *peer) send(m raftpb.Message) {
 					zap.String("message-type", m.Type.String()),
 					zap.String("local-member-id", p.localID.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()),
 				)
 			} else {
@@ -269,7 +269,7 @@ func (p *peer) send(m raftpb.Message) {
 					zap.String("message-type", m.Type.String()),
 					zap.String("local-member-id", p.localID.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()),
 				)
 			} else {

+ 2 - 2
rafthttp/remote.go

@@ -62,7 +62,7 @@ func (g *remote) send(m raftpb.Message) {
 					zap.String("message-type", m.Type.String()),
 					zap.String("local-member-id", g.localID.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()),
 				)
 			} else {
@@ -75,7 +75,7 @@ func (g *remote) send(m raftpb.Message) {
 					zap.String("message-type", m.Type.String()),
 					zap.String("local-member-id", g.localID.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()),
 				)
 			} else {