mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 16:34:51 +01:00
Add MSG_SYS_END to all sent packets
This commit is contained in:
@@ -93,11 +93,20 @@ func (s *Session) sendLoop() {
|
|||||||
for {
|
for {
|
||||||
// TODO(Andoryuuta): Test making this into a buffered channel and grouping the packet together before sending.
|
// TODO(Andoryuuta): Test making this into a buffered channel and grouping the packet together before sending.
|
||||||
rawPacket := <-s.sendPackets
|
rawPacket := <-s.sendPackets
|
||||||
|
|
||||||
if rawPacket == nil {
|
if rawPacket == nil {
|
||||||
s.logger.Debug("Got nil from s.SendPackets, exiting send loop")
|
s.logger.Debug("Got nil from s.SendPackets, exiting send loop")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.cryptConn.SendPacket(rawPacket)
|
|
||||||
|
// Make a copy of the data.
|
||||||
|
terminatedPacket := make([]byte, len(rawPacket))
|
||||||
|
copy(terminatedPacket, rawPacket)
|
||||||
|
|
||||||
|
// Append the MSG_SYS_END tailing opcode.
|
||||||
|
terminatedPacket = append(terminatedPacket, []byte{0x00, 0x10}...)
|
||||||
|
|
||||||
|
s.cryptConn.SendPacket(terminatedPacket)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user