Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.

Commit 08d86d5

Browse files
committed
- correct the stop sequence
1 parent 3820273 commit 08d86d5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/prometheus/client_golang v1.2.1 // indirect
88
github.com/sirupsen/logrus v1.4.2
99
github.com/spf13/cobra v0.0.5 // indirect
10-
github.com/spiral/broadcast v0.0.0-20191205145228-118503a8d0e1
10+
github.com/spiral/broadcast v0.0.0-20191206140608-766959683e74
1111
github.com/spiral/roadrunner v1.5.2
1212
github.com/stretchr/testify v1.3.0
1313
)

service.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func (s *Service) Init(
4747
s.cfg = cfg
4848
s.client = broadcast.NewClient()
4949
s.connPool = newPool(s.client, s.reportError)
50+
s.stopped = 0
5051

5152
if err := rpc.Register(ID, &rpcService{svc: s}); err != nil {
5253
return false, err
@@ -81,7 +82,7 @@ func (s *Service) Stop() {
8182
s.mu.Lock()
8283
defer s.mu.Unlock()
8384

84-
if !atomic.CompareAndSwapInt32(&s.stopped, 0, 1) {
85+
if atomic.CompareAndSwapInt32(&s.stopped, 0, 1) {
8586
close(s.stop)
8687
}
8788
}

0 commit comments

Comments
 (0)