Browse Source

Fix: failed_tunnel not reported by Tunnel.Activate

Rod Hynes 6 years ago
parent
commit
04549ffac3
1 changed files with 3 additions and 2 deletions
  1. 3 2
      psiphon/tunnel.go

+ 3 - 2
psiphon/tunnel.go

@@ -168,12 +168,13 @@ func ConnectTunnel(
 func (tunnel *Tunnel) Activate(
 	ctx context.Context, tunnelOwner TunnelOwner) (retErr error) {
 
-	// Ensure that, unless the context is cancelled, any replayed dial
+	// Ensure that, unless the base context is cancelled, any replayed dial
 	// parameters are cleared, no longer to be retried, if the tunnel fails to
 	// activate.
 	activationSucceeded := false
+	baseCtx := ctx
 	defer func() {
-		if !activationSucceeded && ctx.Err() == nil {
+		if !activationSucceeded && baseCtx.Err() == nil {
 			tunnel.dialParams.Failed(tunnel.config)
 			_ = RecordFailedTunnelStat(tunnel.config, tunnel.dialParams, retErr)
 		}