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

Method Shutdown

agent/agentssh/agentssh.go:1254–1275  ·  view source on GitHub ↗

Shutdown stops accepting new connections. The current implementation calls Close() for simplicity instead of waiting for existing connections to close. If the context times out, Shutdown will return but Close() may not have completed.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1252// connections to close. If the context times out, Shutdown will return
1253// but Close() may not have completed.
1254func (s *Server) Shutdown(ctx context.Context) error {
1255 ch := make(chan error, 1)
1256 go func() {
1257 // TODO(mafredri): Implement shutdown, SIGHUP running commands, etc.
1258 // For now we just close the server.
1259 ch <- s.Close()
1260 }()
1261 var err error
1262 select {
1263 case <-ctx.Done():
1264 err = ctx.Err()
1265 case err = <-ch:
1266 }
1267 // Re-check for context cancellation precedence.
1268 if ctx.Err() != nil {
1269 err = ctx.Err()
1270 }
1271 if err != nil {
1272 return xerrors.Errorf("close server: %w", err)
1273 }
1274 return nil
1275}
1276
1277func isLoginShell(rawCommand string) bool {
1278 return len(rawCommand) == 0

Callers 3

mainFunction · 0.95
proxyServerMethod · 0.95

Calls 4

CloseMethod · 0.95
ErrMethod · 0.80
DoneMethod · 0.45
ErrorfMethod · 0.45

Tested by 1