MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Stop

Method Stop

internal/auth/codex/oauth_server.go:116–135  ·  view source on GitHub ↗

Stop gracefully stops the OAuth callback server. It performs a graceful shutdown of the HTTP server with a timeout. Parameters: - ctx: The context for controlling the shutdown process Returns: - error: An error if the server fails to stop gracefully

(ctx context.Context)

Source from the content-addressed store, hash-verified

114// Returns:
115// - error: An error if the server fails to stop gracefully
116func (s *OAuthServer) Stop(ctx context.Context) error {
117 s.mu.Lock()
118 defer s.mu.Unlock()
119
120 if !s.running || s.server == nil {
121 return nil
122 }
123
124 log.Debug("Stopping OAuth callback server")
125
126 // Create a context with timeout for shutdown
127 shutdownCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
128 defer cancel()
129
130 err := s.server.Shutdown(shutdownCtx)
131 s.running = false
132 s.server = nil
133
134 return err
135}
136
137// WaitForCallback waits for the OAuth callback with a timeout.
138// It blocks until either an OAuth result is received, an error occurs,

Callers 2

LoginMethod · 0.95
LoginMethod · 0.95

Calls 1

ShutdownMethod · 0.65

Tested by

no test coverage detected