diff options
author | Wolfy-J <[email protected]> | 2019-05-04 19:31:06 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-04 19:31:06 +0300 |
commit | 2afa417f4f46b31b79043e3e56513d51e4ad2fde (patch) | |
tree | e3939afb104647e82bd8bbed85f75616c1faf0eb /service/http/service.go | |
parent | 2efc533f2aac215d487a80020b0f9bf4ae5209c3 (diff) |
renamings
Diffstat (limited to 'service/http/service.go')
-rw-r--r-- | service/http/service.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/service/http/service.go b/service/http/service.go index b76d8893..1239acca 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -27,21 +27,21 @@ type middleware func(f http.HandlerFunc) http.HandlerFunc // Services manages rr, http servers. type Service struct { - cfg *Config - env env.Environment - lsns []func(event int, ctx interface{}) - mdwr []middleware - mu sync.Mutex - rr *roadrunner.Server - watcher roadrunner.Controller - handler *Handler - http *http.Server - https *http.Server + cfg *Config + env env.Environment + lsns []func(event int, ctx interface{}) + mdwr []middleware + mu sync.Mutex + rr *roadrunner.Server + controller roadrunner.Controller + handler *Handler + http *http.Server + https *http.Server } -// Watch attaches watcher. -func (s *Service) Watch(w roadrunner.Controller) { - s.watcher = w +// AddController attaches controller. Currently only one controller is supported. +func (s *Service) AddController(w roadrunner.Controller) { + s.controller = w } // AddMiddleware adds new net/http mdwr. @@ -49,7 +49,7 @@ func (s *Service) AddMiddleware(m middleware) { s.mdwr = append(s.mdwr, m) } -// AddListener attaches server event watcher. +// AddListener attaches server event controller. func (s *Service) AddListener(l func(event int, ctx interface{})) { s.lsns = append(s.lsns, l) } @@ -84,8 +84,8 @@ func (s *Service) Serve() error { s.rr = roadrunner.NewServer(s.cfg.Workers) s.rr.Listen(s.throw) - if s.watcher != nil { - s.rr.Watch(s.watcher) + if s.controller != nil { + s.rr.Watch(s.controller) } s.handler = &Handler{cfg: s.cfg, rr: s.rr} |