From 58873fa7e2e90cb026938b4cb4a05bcc7007b3bf Mon Sep 17 00:00:00 2001 From: Spike Curtis Date: Fri, 5 Jan 2024 08:15:42 +0400 Subject: [PATCH] chore: remove unused context/cancel in tailnet Conn (#11399) Spotted during code read; unused fields --- tailnet/conn.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tailnet/conn.go b/tailnet/conn.go index 3620cc5244..34712ee0ff 100644 --- a/tailnet/conn.go +++ b/tailnet/conn.go @@ -282,12 +282,9 @@ func NewConn(options *Options) (conn *Conn, err error) { Logger(options.Logger.Named("net.packet-filter")), )) - dialContext, dialCancel := context.WithCancel(context.Background()) server := &Conn{ blockEndpoints: options.BlockEndpoints, derpForceWebSockets: options.DERPForceWebSockets, - dialContext: dialContext, - dialCancel: dialCancel, closed: make(chan struct{}), logger: options.Logger, magicConn: magicConn, @@ -392,8 +389,6 @@ func IPFromUUID(uid uuid.UUID) netip.Addr { // Conn is an actively listening Wireguard connection. type Conn struct { - dialContext context.Context - dialCancel context.CancelFunc mutex sync.Mutex closed chan struct{} logger slog.Logger @@ -789,7 +784,6 @@ func (c *Conn) Close() error { _ = c.netStack.Close() c.logger.Debug(context.Background(), "closed netstack") - c.dialCancel() _ = c.wireguardMonitor.Close() _ = c.dialer.Close() // Stops internals, e.g. tunDevice, magicConn and dnsManager.