Skip to content

Commit

Permalink
revert packet concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
sekaiwish committed Nov 9, 2024
1 parent 366ec83 commit 7bf2fd5
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions server/channelserver/sys_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7bf2fd5

Please sign in to comment.