ptun-diff.go

· erock's pastes · raw

expires: 2025-07-23

 1diff --git a/pkg/tunkit/ptun.go b/pkg/tunkit/ptun.go
 2index 5ed3cd8..d590340 100644
 3--- a/pkg/tunkit/ptun.go
 4+++ b/pkg/tunkit/ptun.go
 5@@ -1,6 +1,7 @@
 6 package tunkit
 7 
 8 import (
 9+	"context"
10 	"errors"
11 	"io"
12 	"log/slog"
13@@ -51,9 +52,12 @@ func LocalForwardHandler(handler Tunnel) pssh.SSHServerChannelMiddleware {
14 			return err
15 		}
16 
17+		origCtx, cancel := context.WithCancel(context.Background())
18 		ctx := &pssh.SSHServerConnSession{
19 			Channel:       ch,
20 			SSHServerConn: sc,
21+			Ctx:           origCtx,
22+			CancelFunc:    cancel,
23 		}
24 
25 		go ssh.DiscardRequests(reqs)