From 7bf2fd5b8fceefc64c1414d114f984c375204fa9 Mon Sep 17 00:00:00 2001 From: wish Date: Sat, 9 Nov 2024 17:22:43 +1100 Subject: [PATCH] revert packet concatenation --- server/channelserver/sys_session.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/server/channelserver/sys_session.go b/server/channelserver/sys_session.go index 86552f611..d7f41c071 100644 --- a/server/channelserver/sys_session.go +++ b/server/channelserver/sys_session.go @@ -154,21 +154,13 @@ func (s *Session) QueueAck(ackHandle uint32, data []byte) { func (s *Session) sendLoop() { var pkt packet - var buffer []byte for { if s.closed { return } - for len(s.sendPackets) > 0 { - 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] + err := s.cryptConn.SendPacket(append(pkt.data, []byte{0x00, 0x10}...)) + if err != nil { + s.logger.Warn("Failed to send packet") } time.Sleep(time.Duration(_config.ErupeConfig.LoopDelay) * time.Millisecond) }