perf: 移除向连接发送数据时的空包处理

移除之后将允许发送空的数据包,否则在收到空数据包时将导致连接被关闭
This commit is contained in:
kercylan98 2023-07-05 13:53:34 +08:00
parent 2513714ac4
commit e0571c7ed1
1 changed files with 7 additions and 7 deletions

View File

@ -184,13 +184,13 @@ func (slf *Conn) writeLoop(wait *sync.WaitGroup) {
slf.mutex.Unlock()
for i := 0; i < len(packets); i++ {
data := packets[i]
if len(data.packet) == 0 {
for _, packet := range packets {
slf.packetPool.Release(packet)
}
slf.Close()
return
}
//if len(data.packet) == 0 {
// for _, packet := range packets {
// slf.packetPool.Release(packet)
// }
// slf.Close()
// return
//}
var err error
if slf.IsWebsocket() {
if data.websocketMessageType <= 0 {