ignore empty packet buffer

This commit is contained in:
wish
2024-10-08 21:06:52 +11:00
parent 1432e8f2b8
commit 34e84f31df

View File

@@ -162,11 +162,13 @@ func (s *Session) sendLoop() {
pkt = <-s.sendPackets
buffer = append(buffer, pkt.data...)
}
if len(buffer) > 0 {
err := s.cryptConn.SendPacket(append(buffer, []byte{0x00, 0x10}...))
if err != nil {
s.logger.Warn("Failed to send packet")
}
buffer = buffer[:0]
}
time.Sleep(100 * time.Millisecond)
}
}