MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / Stop

Method Stop

internal/vnc/server.go:228–257  ·  view source on GitHub ↗

Stop stops the embedded HTTP server.

()

Source from the content-addressed store, hash-verified

226
227// Stop stops the embedded HTTP server.
228func (s *Server) Stop() error {
229 s.mu.Lock()
230 defer s.mu.Unlock()
231
232 if !s.running || s.httpServer == nil {
233 s.logger.Debug("HTTP server not running, no action needed")
234
235 return nil
236 }
237
238 s.logger.Info("Stopping HTTP server on port %d", s.port)
239
240 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
241 defer cancel()
242
243 err := s.httpServer.Shutdown(ctx)
244 if err != nil {
245 s.logger.Error("Failed to shutdown HTTP server gracefully: %v", err)
246 } else {
247 s.logger.Debug("HTTP server shutdown gracefully")
248 }
249
250 s.running = false
251 s.httpServer = nil
252 s.proxy = nil
253
254 s.logger.Info("HTTP server stopped successfully")
255
256 return err
257}
258
259// GetPort returns the port the server is running on.
260func (s *Server) GetPort() int {

Callers 13

stopHealthCheckLockedMethod · 0.45
NewBadgerCacheFunction · 0.45
NewConfigWizardPageFunction · 0.45
LaunchConfigWizardFunction · 0.45
showQuitConfirmationMethod · 0.45
animateLoadingMethod · 0.45
startAutoRefreshMethod · 0.45
stopLoadingAnimationMethod · 0.45
HandleWebSocketProxyMethod · 0.45
ShutdownMethod · 0.45
ShutdownMethod · 0.45

Calls 4

DebugMethod · 0.65
InfoMethod · 0.65
ShutdownMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected