MCPcopy Create free account
hub / github.com/rilldata/rill / ServeHTTP

Function ServeHTTP

runtime/pkg/debugserver/debugserver.go:12–31  ·  view source on GitHub ↗
(ctx context.Context, port int)

Source from the content-addressed store, hash-verified

10)
11
12func ServeHTTP(ctx context.Context, port int) error {
13 // A server without a handler will serve http.DefaultServeMux
14 addr := ":" + fmt.Sprint(port)
15 srv := &http.Server{Addr: addr}
16
17 // Run server in a goroutine
18 errCh := make(chan error, 1)
19 go func() {
20 errCh <- srv.ListenAndServe()
21 }()
22
23 // Handle errors and context cancellation
24 select {
25 case err := <-errCh:
26 return err
27 case <-ctx.Done():
28 _ = srv.Close()
29 return ctx.Err()
30 }
31}

Callers 3

ServeMethod · 0.92
StartCmdFunction · 0.92
StartCmdFunction · 0.92

Calls 3

CloseMethod · 0.95
DoneMethod · 0.80
ErrMethod · 0.65

Tested by

no test coverage detected