mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-10-05 08:36:57 +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:
@@ -57,8 +57,8 @@ type Peer struct {
|
||||
|
||||
queue struct {
|
||||
staged chan *QueueOutboundElement // staged packets before a handshake is available
|
||||
outbound chan *QueueOutboundElement // sequential ordering of udp transmission
|
||||
inbound chan *QueueInboundElement // sequential ordering of tun writing
|
||||
outbound *autodrainingOutboundQueue // sequential ordering of udp transmission
|
||||
inbound *autodrainingInboundQueue // sequential ordering of tun writing
|
||||
}
|
||||
|
||||
cookieGenerator CookieGenerator
|
||||
@@ -253,8 +253,8 @@ func (peer *Peer) Stop() {
|
||||
|
||||
peer.timersStop()
|
||||
// Signal that RoutineSequentialSender and RoutineSequentialReceiver should exit.
|
||||
peer.queue.inbound <- nil
|
||||
peer.queue.outbound <- nil
|
||||
peer.queue.inbound.c <- nil
|
||||
peer.queue.outbound.c <- nil
|
||||
peer.stopping.Wait()
|
||||
peer.device.queue.encryption.wg.Done() // no more writes to encryption queue from us
|
||||
|
||||
|
Reference in New Issue
Block a user