Skip to content

Commit

Permalink
fix panic
Browse files Browse the repository at this point in the history
Signed-off-by: He Xian <[email protected]>
  • Loading branch information
hexian000 committed Sep 17, 2024
1 parent 0eb60be commit 17ba4e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func (h *ForwardHandler) Serve(ctx context.Context, accepted net.Conn) {

// TunnelHandler forwards connections over the tunnel
type TunnelHandler struct {
l net.Listener
s *Server
t *Tunnel
}
Expand All @@ -136,7 +137,7 @@ func (h *TunnelHandler) Serve(ctx context.Context, accepted net.Conn) {
ioClose(dialed)
return
}
slog.Debugf("%v -> %q: forward established", h.t.l.Addr(), h.t.name)
slog.Debugf("%v -> %q: forward established", h.l.Addr(), h.t.name)
}

// EmptyHandler rejects all connections
Expand Down
2 changes: 1 addition & 1 deletion v2/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (t *Tunnel) Start() error {
return err
}
slog.Noticef("forward listen: %v", l.Addr())
h := &TunnelHandler{s: t.s, t: t}
h := &TunnelHandler{l: l, s: t.s, t: t}
if err := t.s.g.Go(func() {
t.s.Serve(l, h)
}); err != nil {
Expand Down

0 comments on commit 17ba4e6

Please sign in to comment.