MCPcopy Index your code
hub / github.com/coder/coder / handleConn

Method handleConn

agent/agentssh/agentssh.go:1072–1089  ·  view source on GitHub ↗
(l net.Listener, c net.Conn)

Source from the content-addressed store, hash-verified

1070}
1071
1072func (s *Server) handleConn(l net.Listener, c net.Conn) {
1073 logger := s.logger.With(
1074 slog.F("remote_addr", c.RemoteAddr()),
1075 slog.F("local_addr", c.LocalAddr()),
1076 slog.F("listen_addr", l.Addr()))
1077 defer c.Close()
1078
1079 if !s.trackConn(l, c, true) {
1080 // Server is closed or we no longer want
1081 // connections from this listener.
1082 logger.Info(context.Background(), "received connection after server closed")
1083 return
1084 }
1085 defer s.trackConn(l, c, false)
1086 logger.Info(context.Background(), "started serving ssh connection")
1087 // note: srv.ConnectionCompleteCallback logs completion of the connection
1088 s.srv.HandleConn(c)
1089}
1090
1091// trackListener registers the listener with the server. If the server is
1092// closing, the function will block until the server is closed.

Callers 1

ServeMethod · 0.95

Calls 6

trackConnMethod · 0.95
CloseMethod · 0.65
RemoteAddrMethod · 0.45
LocalAddrMethod · 0.45
AddrMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected