Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/srv/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ func (s *Server) handleConnection(conn net.Conn) (func(), error) {
return nil, trace.Wrap(err)
}

ctx = authz.ContextWithUser(s.closeContext, user)
ctx = authz.ContextWithUser(ctx, user)
ctx = authz.ContextWithClientSrcAddr(ctx, conn.RemoteAddr())
authCtx, _, err := s.authorizeContext(ctx)

Expand Down Expand Up @@ -750,12 +750,15 @@ func (s *Server) handleConnection(conn net.Conn) (func(), error) {
// differently than HTTP requests from web apps.
if app.IsTCP() {
identity := authCtx.Identity.GetIdentity()
return nil, s.handleTCPApp(ctx, tlsConn, &identity, app)
defer cancel(nil)
return nil, trace.Wrap(s.handleTCPApp(ctx, tlsConn, &identity, app))
}

return func() {
cleanup := func() {
cancel(nil)
s.deleteConnAuth(tlsConn)
}, s.handleHTTPApp(ctx, tlsConn)
}
return cleanup, trace.Wrap(s.handleHTTPApp(ctx, tlsConn))
}

// handleTCPApp handles connection for a TCP application.
Expand Down
1 change: 0 additions & 1 deletion lib/srv/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ func (w *Monitor) start(lockWatch types.Watcher) {
lockWatchDoneC = nil

case <-w.Context.Done():
w.Entry.Debugf("Releasing associated resources - context has been closed.")
return
}
}
Expand Down