File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-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,8 +127,10 @@ 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 . Load () {
132131 return errOnlyStartOnce
132+ } else {
133+ d .started .Store (true )
133134 }
134135
135136 network := lndclient .Network (d .cfg .Network )
@@ -190,8 +191,10 @@ func (d *Daemon) StartAsSubserver(lndGrpc *lndclient.GrpcLndServices,
190191 // There should be no reason to start the daemon twice. Therefore,
191192 // return an error if that's tried. This is mostly to guard against
192193 // Start and StartAsSubserver both being called.
193- if atomic . AddInt32 ( & d .started , 1 ) != 1 {
194+ if d .started . Load () {
194195 return errOnlyStartOnce
196+ } else {
197+ d .started .Store (true )
195198 }
196199
197200 // When starting as a subserver, we get passed in an already established
You can’t perform that action at this time.
0 commit comments