diff options
-rw-r--r-- | service/http/service.go | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/service/http/service.go b/service/http/service.go index f9bd0a90..d764e71c 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -106,7 +106,7 @@ func (s *Service) Serve() error { s.https = s.initSSL() if s.cfg.EnableHTTP2() { - if err := s.InitHTTP2(); err != nil { + if err := s.initHTTP2(); err != nil { return err } } @@ -139,7 +139,7 @@ func (s *Service) Serve() error { if s.fcgi != nil { go func() { - err <- s.ServeFCGI() + err <- s.serveFCGI() }() } @@ -172,21 +172,6 @@ func (s *Service) Server() *roadrunner.Server { return s.rr } -// ServeFCGI starts FastCGI server. -func (s *Service) ServeFCGI() error { - l, err := util.CreateListener(s.cfg.FCGI.Address) - if err != nil { - return err - } - - err = fcgi.Serve(l, s.fcgi.Handler) - if err != nil { - return err - } - - return nil -} - // ServeHTTP handles connection using set of middleware and rr PSR-7 server. func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.https != nil && r.TLS == nil && s.cfg.SSL.Redirect { @@ -219,12 +204,28 @@ func (s *Service) initSSL() *http.Server { return server } -func (s *Service) InitHTTP2() error { +// init http/2 server +func (s *Service) initHTTP2() error { return http2.ConfigureServer(s.https, &http2.Server{ MaxConcurrentStreams: s.cfg.HTTP2.MaxConcurrentStreams, }) } +// serveFCGI starts FastCGI server. +func (s *Service) serveFCGI() error { + l, err := util.CreateListener(s.cfg.FCGI.Address) + if err != nil { + return err + } + + err = fcgi.Serve(l, s.fcgi.Handler) + if err != nil { + return err + } + + return nil +} + // throw handles service, server and pool events. func (s *Service) throw(event int, ctx interface{}) { for _, l := range s.lsns { |