1
0
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:
Jason A. Donenfeld 2019-04-18 23:22:03 +09:00
parent 5811447b38
commit d3dd991e4e

View File

@ -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()
}
}