mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-10-05 16:47:02 +08:00
device: do not attach finalizer to non-returned object
Before, the code attached a finalizer to an object that wasn't returned, resulting in immediate garbage collection. Instead return the actual pointer. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -317,7 +317,7 @@ top:
|
||||
|
||||
// add to parallel and sequential queue
|
||||
if peer.isRunning.Get() {
|
||||
peer.queue.outbound <- elem
|
||||
peer.queue.outbound.c <- elem
|
||||
peer.device.queue.encryption.c <- elem
|
||||
} else {
|
||||
peer.device.PutMessageBuffer(elem.buffer)
|
||||
@@ -410,7 +410,7 @@ func (peer *Peer) RoutineSequentialSender() {
|
||||
}()
|
||||
device.log.Verbosef("%v - Routine: sequential sender - started", peer)
|
||||
|
||||
for elem := range peer.queue.outbound {
|
||||
for elem := range peer.queue.outbound.c {
|
||||
if elem == nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user