mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
device: send: check packet length before freeing element
This commit is contained in:
parent
5811447b38
commit
d3dd991e4e
@ -601,6 +601,9 @@ func (peer *Peer) RoutineSequentialSender() {
|
||||
|
||||
length := uint64(len(elem.packet))
|
||||
err := peer.SendBuffer(elem.packet)
|
||||
if len(elem.packet) != MessageKeepaliveSize {
|
||||
peer.timersDataSent()
|
||||
}
|
||||
device.PutMessageBuffer(elem.buffer)
|
||||
device.PutOutboundElement(elem)
|
||||
if err != nil {
|
||||
@ -609,9 +612,6 @@ func (peer *Peer) RoutineSequentialSender() {
|
||||
}
|
||||
atomic.AddUint64(&peer.stats.txBytes, length)
|
||||
|
||||
if len(elem.packet) != MessageKeepaliveSize {
|
||||
peer.timersDataSent()
|
||||
}
|
||||
peer.keepKeyFreshSending()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user