Skip to content

Commit 3fe2352

Browse files
committed
Remove http from struct
1 parent 90dd205 commit 3fe2352

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

internal/server/server.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type Server struct {
2323
cfg *config.Config
2424
registry *toolsets.Registry
2525
mcp *mcp.Server
26-
http *http.Server
2726
}
2827

2928
// NewServer creates a new MCP server instance
@@ -89,7 +88,7 @@ func (s *Server) Start(ctx context.Context) error {
8988
)
9089

9190
addr := fmt.Sprintf("%s:%d", s.cfg.Server.Address, s.cfg.Server.Port)
92-
s.http = &http.Server{
91+
httpServer := &http.Server{
9392
Addr: addr,
9493
Handler: handler,
9594
}
@@ -103,7 +102,7 @@ func (s *Server) Start(ctx context.Context) error {
103102
// Start server in a goroutine
104103
errChan := make(chan error, 1)
105104
go func() {
106-
if err := s.http.ListenAndServe(); err != nil && err != http.ErrServerClosed {
105+
if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
107106
errChan <- fmt.Errorf("HTTP server error: %w", err)
108107
}
109108
}()
@@ -115,7 +114,7 @@ func (s *Server) Start(ctx context.Context) error {
115114
// Create a context with timeout for graceful shutdown
116115
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), shutdownTimeout*time.Second)
117116
defer shutdownCancel()
118-
return errors.Wrap(s.http.Shutdown(shutdownCtx), "server shutting down failed")
117+
return errors.Wrap(httpServer.Shutdown(shutdownCtx), "server shutting down failed")
119118
case err := <-errChan:
120119
return err
121120
}

0 commit comments

Comments
 (0)