Skip to content

Commit 0eb01c2

Browse files
committed
code review improvements
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent 578a928 commit 0eb01c2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

agent/agentssh/agentssh.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (s *Server) sessionHandler(session ssh.Session) {
186186
if !s.trackSession(session, true) {
187187
// See (*Server).Close() for why we call Close instead of Exit.
188188
_ = session.Close()
189-
logger.Info(ctx, "closed session; server closing")
189+
logger.Info(ctx, "unable to accept new session, server is closing")
190190
return
191191
}
192192
defer s.trackSession(session, false)
@@ -197,7 +197,7 @@ func (s *Server) sessionHandler(session ssh.Session) {
197197
handled := s.x11Handler(session.Context(), x11)
198198
if !handled {
199199
_ = session.Exit(1)
200-
logger.Warn(ctx, "x11 handler failed")
200+
logger.Error(ctx, "x11 handler failed")
201201
return
202202
}
203203
extraEnv = append(extraEnv, fmt.Sprintf("DISPLAY=:%d.0", x11.ScreenNumber))
@@ -593,19 +593,19 @@ func (s *Server) handleConn(l net.Listener, c net.Conn) {
593593
slog.F("remote_addr", c.RemoteAddr()),
594594
slog.F("local_addr", c.LocalAddr()),
595595
slog.F("listen_addr", l.Addr()))
596-
logger.Info(context.Background(), "started serving connection")
597-
defer func() {
598-
logger.Info(context.Background(), "stopped serving connection")
599-
}()
600596
defer c.Close()
601597

602598
if !s.trackConn(l, c, true) {
603599
// Server is closed or we no longer want
604600
// connections from this listener.
605-
s.logger.Debug(context.Background(), "received connection after server closed")
601+
logger.Info(context.Background(), "received connection after server closed")
606602
return
607603
}
608604
defer s.trackConn(l, c, false)
605+
logger.Info(context.Background(), "started serving connection")
606+
defer func() {
607+
logger.Info(context.Background(), "stopped serving connection")
608+
}()
609609

610610
s.srv.HandleConn(c)
611611
}

0 commit comments

Comments
 (0)