summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-06 19:35:00 +0300
committerWolfy-J <[email protected]>2018-06-06 19:35:00 +0300
commit7dcc900c37fa1b3cbcf41e211d7280171329587d (patch)
tree2e0852b8603d162880ba15341608a1d6bc7ad359 /server.go
parent7c591f79fa097c9fe0557021214d8fd20b825cc4 (diff)
dead functions
Diffstat (limited to 'server.go')
-rw-r--r--server.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/server.go b/server.go
index 52cc7349..16c9d39f 100644
--- a/server.go
+++ b/server.go
@@ -8,10 +8,13 @@ import (
const (
// EventNewPool triggered when server creates new pool.
- EventStart = iota + 128
+ EventServerStart = iota + 128
// EventNewPool triggered when server creates new pool.
- EventStop
+ EventServerStop
+
+ // EventServerFailure triggered when server is unable to replace dead pool.
+ EventServerFailure
// EventNewPool triggered when server creates new pool.
EventNewPool
@@ -110,6 +113,8 @@ func (srv *Server) Start() (err error) {
srv.pool.Observe(srv.poolObserver)
srv.started = true
+ srv.throw(EventServerStart, srv)
+
return nil
}
@@ -130,6 +135,7 @@ func (srv *Server) Stop() error {
srv.factory = nil
srv.pool = nil
srv.started = false
+ srv.throw(EventServerStop, srv)
return nil
}
@@ -169,7 +175,10 @@ func (srv *Server) poolObserver(event int, ctx interface{}) {
if event == EventPoolError {
// pool failure, rebuilding
- srv.Reset()
+ if err := srv.Reset(); err != nil {
+ // everything is dead
+ srv.throw(EventServerFailure, srv)
+ }
}
}