From 57708ec822be51984ededad64ae84cb6cdfb6f57 Mon Sep 17 00:00:00 2001 From: duanhf2012 Date: Mon, 13 Apr 2020 16:20:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=85=E5=A4=B4len?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network/tcp_msg.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/network/tcp_msg.go b/network/tcp_msg.go index a9f9361..cd42234 100644 --- a/network/tcp_msg.go +++ b/network/tcp_msg.go @@ -97,8 +97,7 @@ func (p *MsgParser) Read(conn *TCPConn) ([]byte, error) { } else if msgLen < p.minMsgLen { return nil, errors.New("message too short") } - - msgLen -= 2 + // data msgData := make([]byte, msgLen) if _, err := io.ReadFull(conn, msgData); err != nil {