1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-27 14:20:27 +08:00

fix(tcp): close invalid conn

This commit is contained in:
源文雨
2024-07-17 00:23:38 +09:00
parent 1c665c68fb
commit 8fa23be251
2 changed files with 31 additions and 2 deletions

View File

@@ -163,6 +163,12 @@ func (conn *Conn) receive(ep *EndPoint) {
if err != nil {
logrus.Debugln("[tcp] recv from", ep, "err:", err)
_ = tcpconn.CloseRead()
return
}
if r.pckt.typ >= packetTypeTop {
logrus.Debugln("[tcp] close reading invalid conn from", ep, "typ", r.pckt.typ, "len", r.pckt.len)
_ = tcpconn.CloseRead()
return
}
logrus.Debugln("[tcp] dispatch packet from", ep, "typ", r.pckt.typ, "len", r.pckt.len)