@@ -51,7 +51,7 @@ type ListenerCfg struct {
51
51
// on the passed TLS configuration.
52
52
restListener func (* tls.Config ) (net.Listener , error )
53
53
54
- // getLnd returns a grpc connection to an lnd instance.
54
+ // getLnd returns a grpc connection to a lnd instance.
55
55
getLnd func (lndclient.Network , * lndConfig ) (* lndclient.GrpcLndServices ,
56
56
error )
57
57
}
@@ -118,9 +118,9 @@ func New(config *Config, lisCfg *ListenerCfg) *Daemon {
118
118
// Start starts loopd in daemon mode. It will listen for grpc connections,
119
119
// execute commands and pass back swap status information.
120
120
func (d * Daemon ) Start () error {
121
- // There should be no reason to start the daemon twice. Therefore return
122
- // an error if that's tried. This is mostly to guard against Start and
123
- // StartAsSubserver both being called.
121
+ // There should be no reason to start the daemon twice. Therefore,
122
+ // return an error if that's tried. This is mostly to guard against
123
+ // Start and StartAsSubserver both being called.
124
124
if atomic .AddInt32 (& d .started , 1 ) != 1 {
125
125
return errOnlyStartOnce
126
126
}
@@ -135,7 +135,7 @@ func (d *Daemon) Start() error {
135
135
136
136
// With lnd connected, initialize everything else, such as the swap
137
137
// server client, the swap client RPC server instance and our main swap
138
- // and error handlers. If this fails, then nothing has been started yet
138
+ // and error handlers. If this fails, then nothing has been started yet,
139
139
// and we can just return the error.
140
140
err = d .initialize (true )
141
141
if errors .Is (err , bbolt .ErrTimeout ) {
@@ -322,7 +322,7 @@ func (d *Daemon) startWebServers() error {
322
322
err := d .restServer .Serve (d .restListener )
323
323
// ErrServerClosed is always returned when the proxy is
324
324
// shut down, so don't log it.
325
- if err != nil && err != http .ErrServerClosed {
325
+ if err != nil && ! errors . Is ( err , http .ErrServerClosed ) {
326
326
// Notify the main error handler goroutine that
327
327
// we exited unexpectedly here. We don't have to
328
328
// worry about blocking as the internal error
@@ -341,7 +341,7 @@ func (d *Daemon) startWebServers() error {
341
341
342
342
log .Infof ("RPC server listening on %s" , d .grpcListener .Addr ())
343
343
err = d .grpcServer .Serve (d .grpcListener )
344
- if err != nil && err != grpc .ErrServerStopped {
344
+ if err != nil && ! errors . Is ( err , grpc .ErrServerStopped ) {
345
345
// Notify the main error handler goroutine that
346
346
// we exited unexpectedly here. We don't have to
347
347
// worry about blocking as the internal error
@@ -680,9 +680,9 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
680
680
var runtimeErr error
681
681
682
682
// There are only two ways this goroutine can exit. Either there
683
- // is an internal error or the caller requests shutdown. In both
684
- // cases we wait for the stop to complete before we signal the
685
- // caller that we're done.
683
+ // is an internal error or the caller requests a shutdown.
684
+ // In both cases we wait for the stop to complete before we
685
+ // signal the caller that we're done.
686
686
select {
687
687
case runtimeErr = <- d .internalErrChan :
688
688
log .Errorf ("Runtime error in daemon, shutting down: " +
@@ -691,7 +691,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
691
691
case <- d .quit :
692
692
}
693
693
694
- // We need to shutdown before sending the error on the channel,
694
+ // We need to shut down before sending the error on the channel,
695
695
// otherwise a caller might exit the process too early.
696
696
d .stop ()
697
697
cleanupMacaroonStore ()
@@ -722,7 +722,7 @@ func (d *Daemon) stop() {
722
722
d .mainCtxCancel ()
723
723
}
724
724
725
- // As there is no swap activity anymore, we can forcefully shutdown the
725
+ // As there is no swap activity anymore, we can forcefully shut down the
726
726
// gRPC and HTTP servers now.
727
727
log .Infof ("Stopping gRPC server" )
728
728
if d .grpcServer != nil {
0 commit comments