优化工程结构

This commit is contained in:
boyce
2020-10-30 16:32:37 +08:00
parent 3025eaebd5
commit d2f52b382d
33 changed files with 1087 additions and 1210 deletions

View File

@@ -90,7 +90,6 @@ func (p *MsgParser) Read(conn *TCPConn) ([]byte, error) {
}
}
// check len
if msgLen > p.maxMsgLen {
return nil, errors.New("message too long")
@@ -123,8 +122,7 @@ func (p *MsgParser) Write(conn *TCPConn, args ...[]byte) error {
} else if msgLen < p.minMsgLen {
return errors.New("message too short")
}
//msgLen -= 2
//msg := make([]byte, uint32(p.lenMsgLen)+msgLen)
msg := makeByteSlice(p.lenMsgLen+int(msgLen))
// write len