summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDmitry Patsura <[email protected]>2019-06-14 16:52:18 +0300
committerDmitry Patsura <[email protected]>2019-06-14 16:52:18 +0300
commit4f908e07c5675f221c5b71380bf96fa8ad8d01a9 (patch)
treecf60b725f10f87ebb1e575788d82d662dcd36752 /service
parent15746d3706fb9ed1e4a8e7d925f033878744b6a1 (diff)
Feature: Handle error from http2.ConfigureServer
Diffstat (limited to 'service')
-rw-r--r--service/http/config.go4
-rw-r--r--service/http/service.go18
2 files changed, 16 insertions, 6 deletions
diff --git a/service/http/config.go b/service/http/config.go
index b4575914..5454f124 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -78,6 +78,10 @@ func (c *Config) EnableTLS() bool {
return c.SSL.Key != "" || c.SSL.Cert != ""
}
+func (c *Config) EnableHTTP2() bool {
+ return c.HTTP2.Enabled
+}
+
func (c *Config) EnableFCGI() bool {
return c.FCGI.Address != ""
}
diff --git a/service/http/service.go b/service/http/service.go
index 25b98a4c..00d877ec 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -104,6 +104,12 @@ func (s *Service) Serve() error {
if s.cfg.EnableTLS() {
s.https = s.initSSL()
+
+ if s.cfg.EnableHTTP2() {
+ if err := s.InitHTTP2(); err != nil {
+ return err
+ }
+ }
}
if s.cfg.EnableFCGI() {
@@ -209,15 +215,15 @@ func (s *Service) initSSL() *http.Server {
server := &http.Server{Addr: s.tlsAddr(s.cfg.Address, true), Handler: s}
s.throw(EventInitSSL, server)
- if s.cfg.HTTP2.Enabled {
- http2.ConfigureServer(server, &http2.Server{
- MaxConcurrentStreams: s.cfg.HTTP2.MaxConcurrentStreams,
- })
- }
-
return server
}
+func (s *Service) InitHTTP2() error {
+ return http2.ConfigureServer(s.https, &http2.Server{
+ MaxConcurrentStreams: s.cfg.HTTP2.MaxConcurrentStreams,
+ })
+}
+
// throw handles service, server and pool events.
func (s *Service) throw(event int, ctx interface{}) {
for _, l := range s.lsns {