File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,7 @@ type Daemon struct {
7070 // same process.
7171 swapClientServer
7272
73- // To be used atomically.
74- started int32
73+ started atomic.Bool
7574
7675 // ErrChan is an error channel that users of the Daemon struct must use
7776 // to detect runtime errors and also whether a shutdown is fully
@@ -128,7 +127,7 @@ func (d *Daemon) Start() error {
128127 // There should be no reason to start the daemon twice. Therefore,
129128 // return an error if that's tried. This is mostly to guard against
130129 // Start and StartAsSubserver both being called.
131- if atomic . AddInt32 ( & d .started , 1 ) != 1 {
130+ if ! d .started . CompareAndSwap ( false , true ) {
132131 return errOnlyStartOnce
133132 }
134133
@@ -190,7 +189,7 @@ func (d *Daemon) StartAsSubserver(lndGrpc *lndclient.GrpcLndServices,
190189 // There should be no reason to start the daemon twice. Therefore,
191190 // return an error if that's tried. This is mostly to guard against
192191 // Start and StartAsSubserver both being called.
193- if atomic . AddInt32 ( & d .started , 1 ) != 1 {
192+ if ! d .started . CompareAndSwap ( false , true ) {
194193 return errOnlyStartOnce
195194 }
196195
You can’t perform that action at this time.
0 commit comments