diff options
Diffstat (limited to 'service/http')
-rw-r--r-- | service/http/service.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/service/http/service.go b/service/http/service.go index 7fad3c49..b89bfe99 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -7,7 +7,6 @@ import ( "github.com/spiral/roadrunner/service/rpc" "net/http" "sync" - "sync/atomic" ) // ID contains default svc name. @@ -21,12 +20,10 @@ type Service struct { cfg *Config lsns []func(event int, ctx interface{}) mdws []middleware - - mu sync.Mutex - rr *roadrunner.Server - inStopping int32 - srv *Handler - http *http.Server + mu sync.Mutex + rr *roadrunner.Server + srv *Handler + http *http.Server } // AddMiddleware adds new net/http middleware. @@ -103,8 +100,6 @@ func (s *Service) Stop() { return } - atomic.AddInt32(&s.inStopping, 1) - defer atomic.AddInt32(&s.inStopping, -1) s.http.Shutdown(context.Background()) } @@ -119,16 +114,12 @@ func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.srv.ServeHTTP(w, r) } -func (s *Service) stopping() bool { - return atomic.LoadInt32(&s.inStopping) != 0 -} - func (s *Service) listener(event int, ctx interface{}) { for _, l := range s.lsns { l(event, ctx) } - if event == roadrunner.EventServerFailure && !s.stopping() { + if event == roadrunner.EventServerFailure { // attempting rr server restart if err := s.rr.Start(); err != nil { s.Stop() |