Do not send keepalive if closed

This commit is contained in:
Jason A. Donenfeld 2018-05-15 13:29:52 +02:00
parent 27091c3284
commit cf161f270e

View file

@ -107,7 +107,7 @@ func addToEncryptionQueue(
/* Queues a keepalive if no packets are queued for peer
*/
func (peer *Peer) SendKeepalive() bool {
if len(peer.queue.nonce) != 0 || peer.queue.packetInNonceQueueIsAwaitingKey {
if len(peer.queue.nonce) != 0 || peer.queue.packetInNonceQueueIsAwaitingKey || !peer.isRunning.Get() {
return false
}
elem := peer.device.NewOutboundElement()