summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-06 16:01:06 +0300
committerWolfy-J <[email protected]>2018-06-06 16:01:06 +0300
commitc0abdf657a0a5de02b63683a60bf13b88895ef79 (patch)
treeb497e98a7c2cf73f7a8377de7566a3f7b4b72a5e /server.go
parente863c6cdcf7c318fb251e096bf92812ed98ea03c (diff)
better server re-configuration
Diffstat (limited to 'server.go')
-rw-r--r--server.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/server.go b/server.go
index 08d96a6b..fb3c737f 100644
--- a/server.go
+++ b/server.go
@@ -46,8 +46,11 @@ type Server struct {
}
// NewServer creates new router. Make sure to call configure before the usage.
-func NewServer(cfg *ServerConfig) *Server {
- return &Server{cfg: cfg}
+func NewServer(cfg *ServerConfig, o func(event int, ctx interface{})) *Server {
+ return &Server{
+ cfg: cfg,
+ observer: o,
+ }
}
// Reconfigure re-configures underlying pool and destroys it's previous version if any.
@@ -94,11 +97,6 @@ func (srv *Server) Reset() error {
return srv.Reconfigure(srv.cfg)
}
-// Observe attaches event watcher to the router.
-func (srv *Server) Observe(o func(event int, ctx interface{})) {
- srv.observer = o
-}
-
// Start underlying worker pool, configure factory and command provider.
func (srv *Server) Start() (err error) {
srv.mu.Lock()