修改logic 长时间后无法登录问题
This commit is contained in:
@@ -84,8 +84,8 @@ func (s *Server) OnTraffic(c gnet.Conn) (action gnet.Action) {
|
||||
|
||||
ws := c.Context().(*player.ClientData).Wsmsg
|
||||
if ws.Tcp { //升级失败时候防止缓冲区溢出
|
||||
FF := s.handleTcp(c)
|
||||
return FF
|
||||
return s.handleTcp(c)
|
||||
|
||||
}
|
||||
|
||||
tt, len1 := ws.ReadBufferBytes(c)
|
||||
@@ -95,14 +95,16 @@ func (s *Server) OnTraffic(c gnet.Conn) (action gnet.Action) {
|
||||
}
|
||||
|
||||
ok, action := ws.Upgrade(c)
|
||||
if !ok { //升级失败,说明是tcp连接
|
||||
s.handleTcp(c)
|
||||
if action != gnet.None { //连接断开
|
||||
return action
|
||||
} else {
|
||||
// fmt.Println(ws.Buf.Bytes())
|
||||
c.Read(make([]byte, len1))
|
||||
}
|
||||
if !ok { //升级失败,说明是tcp连接
|
||||
|
||||
return s.handleTcp(c)
|
||||
|
||||
}
|
||||
// fmt.Println(ws.Buf.Bytes())
|
||||
c.Read(make([]byte, len1))
|
||||
if ws.Buf.Len() <= 0 {
|
||||
return gnet.None
|
||||
}
|
||||
@@ -144,7 +146,6 @@ func (s *Server) handleTcp(conn gnet.Conn) (action gnet.Action) {
|
||||
s.parser(conn, data)
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if conn.InboundBuffered() > 0 {
|
||||
|
||||
Reference in New Issue
Block a user