Browse Source

当前方法调用GetTcpConnetion改为直接取属性c.Conn

master
aceld 6 years ago
parent
commit
556f938c8d
  1. 4
      znet/connection.go

4
znet/connection.go

@ -101,7 +101,7 @@ func (c *Connection) StartReader() {
//读取客户端的Msg head
headData := make([]byte, dp.GetHeadLen())
if _, err := io.ReadFull(c.GetTCPConnection(), headData); err != nil {
if _, err := io.ReadFull(c.Conn, headData); err != nil {
fmt.Println("read msg head error ", err)
break
}
@ -118,7 +118,7 @@ func (c *Connection) StartReader() {
var data []byte
if msg.GetDataLen() > 0 {
data = make([]byte, msg.GetDataLen())
if _, err := io.ReadFull(c.GetTCPConnection(), data); err != nil {
if _, err := io.ReadFull(c.Conn, data); err != nil {
fmt.Println("read msg data error ", err)
break
}

Loading…
Cancel
Save