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

Method Start

agent/boundarylogproxy/proxy.go:77–96  ·  view source on GitHub ↗

Start begins listening for connections on the Unix socket, and handles new connections in a separate goroutine. Incoming logs from connections are buffered until RunForwarder drains them.

()

Source from the content-addressed store, hash-verified

75// connections in a separate goroutine. Incoming logs from connections are
76// buffered until RunForwarder drains them.
77func (s *Server) Start() error {
78 if err := os.Remove(s.socketPath); err != nil && !os.IsNotExist(err) {
79 return xerrors.Errorf("remove existing socket: %w", err)
80 }
81
82 listener, err := net.Listen("unix", s.socketPath)
83 if err != nil {
84 return xerrors.Errorf("listen on socket: %w", err)
85 }
86
87 s.listener = listener
88 ctx, cancel := context.WithCancel(context.Background())
89 s.cancel = cancel
90
91 s.wg.Add(1)
92 go s.acceptLoop(ctx)
93
94 s.logger.Info(ctx, "boundary log proxy started", slog.F("socket_path", s.socketPath))
95 return nil
96}
97
98// RunForwarder drains the log buffer and forwards logs to coderd.
99// It blocks until ctx is canceled.

Calls 6

acceptLoopMethod · 0.95
RemoveMethod · 0.65
ListenMethod · 0.65
AddMethod · 0.65
ErrorfMethod · 0.45
InfoMethod · 0.45