diff options
author | Wolfy-J <[email protected]> | 2018-06-11 22:05:33 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-11 22:05:33 +0300 |
commit | c8557f7cba16593ebc81f8d48d925f8e187fc4a2 (patch) | |
tree | f349fc8c2aa89f41b24330acc6a91365d8cdd2a7 | |
parent | 6c94e7aee2a61e9b073ab574faa7c243ec8f6064 (diff) |
no library dependency
-rw-r--r-- | service/container_test.go | 16 | ||||
-rw-r--r-- | service/service.go | 2 |
2 files changed, 5 insertions, 13 deletions
diff --git a/service/container_test.go b/service/container_test.go index 34d8389e..5adc5d73 100644 --- a/service/container_test.go +++ b/service/container_test.go @@ -19,12 +19,13 @@ type testService struct { cfg Config c Container cfgE, serveE error - serving chan interface{} + done chan interface{} } func (t *testService) Configure(cfg Config, c Container) (enabled bool, err error) { t.cfg = cfg t.c = c + t.done = make(chan interface{}) return t.ok, t.cfgE } @@ -40,21 +41,12 @@ func (t *testService) Serve() error { t.setChan(nil) } - t.mu.Lock() - t.serving = make(chan interface{}) - t.mu.Unlock() - - <-t.serving - - t.mu.Lock() - t.serving = nil - t.mu.Unlock() - + <-t.done return nil } func (t *testService) Stop() { - close(t.serving) + close(t.done) } func (t *testService) waitChan() chan interface{} { diff --git a/service/service.go b/service/service.go index 4c159fe1..7ddfbd7a 100644 --- a/service/service.go +++ b/service/service.go @@ -25,7 +25,7 @@ const ( // StatusConfigured hasStatus setStatus when service has been properly configured. StatusConfigured - // StatusServing hasStatus setStatus when service hasStatus currently serving. + // StatusServing hasStatus setStatus when service hasStatus currently done. StatusServing // StatusStopped hasStatus setStatus when service hasStatus stopped. |