Skip to content

Commit 0d48b35

Browse files
committed
update msgpack
1 parent b02637c commit 0d48b35

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

message.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Message struct {
1515
Data []byte
1616
}
1717

18-
// NewMessage returns a message typed `*Message`.
18+
// NewMessage returns a message typed *Message.
1919
func NewMessage(id, datalen uint32, data []byte) *Message {
2020
return &Message{
2121
Id: id,
@@ -24,17 +24,17 @@ func NewMessage(id, datalen uint32, data []byte) *Message {
2424
}
2525
}
2626

27-
// GetDataLen returns DataLen typed `uint32`.
27+
// GetDataLen returns DataLen typed uint32.
2828
func (msg *Message) GetDataLen() uint32 {
2929
return msg.DataLen
3030
}
3131

32-
// GetMsgId returns Id typed `uint32`.
32+
// GetMsgId returns Id typed uint32.
3333
func (msg *Message) GetMsgId() uint32 {
3434
return msg.Id
3535
}
3636

37-
// GetMsgData returns Data typed `[]byte`.
37+
// GetMsgData returns Data typed []byte.
3838
func (msg *Message) GetMsgData() []byte {
3939
return msg.Data
4040
}

msgpack.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package msgpack
33
import (
44
"bytes"
55
"encoding/binary"
6-
"fmt"
76
"io"
87
"log"
98
"net"
@@ -27,7 +26,7 @@ type MsgPack struct {
2726
conn net.Conn
2827
}
2928

30-
// NewMsgPack returns a packager `*MsgPack`
29+
// NewMsgPack returns a packager *MsgPack.
3130
func NewMsgPack(headlen uint32, conn net.Conn) *MsgPack {
3231
return &MsgPack{
3332
HeadLen: headlen,
@@ -71,7 +70,6 @@ func (mp *MsgPack) Unpack() (Imessage, error) {
7170
if err := binary.Read(buffer, binary.LittleEndian, &msg.Id); err != nil {
7271
return nil, err
7372
}
74-
fmt.Println("msg.GetDataLen():", msg.GetDataLen())
7573
if msg.GetDataLen() > 0 {
7674
msg.Data = make([]byte, msg.GetDataLen())
7775
_, err := io.ReadFull(mp.conn, msg.Data)

0 commit comments

Comments
 (0)