Skip to content

Commit 7a8c052

Browse files
authored
Merge pull request #736 from hieblmi/daemon-chore
daemon: fix wrapped errors and typos
2 parents e5dd7ad + 636f8b6 commit 7a8c052

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

loopd/daemon.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type ListenerCfg struct {
5151
// on the passed TLS configuration.
5252
restListener func(*tls.Config) (net.Listener, error)
5353

54-
// getLnd returns a grpc connection to an lnd instance.
54+
// getLnd returns a grpc connection to a lnd instance.
5555
getLnd func(lndclient.Network, *lndConfig) (*lndclient.GrpcLndServices,
5656
error)
5757
}
@@ -118,9 +118,9 @@ func New(config *Config, lisCfg *ListenerCfg) *Daemon {
118118
// Start starts loopd in daemon mode. It will listen for grpc connections,
119119
// execute commands and pass back swap status information.
120120
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.
124124
if atomic.AddInt32(&d.started, 1) != 1 {
125125
return errOnlyStartOnce
126126
}
@@ -135,7 +135,7 @@ func (d *Daemon) Start() error {
135135

136136
// With lnd connected, initialize everything else, such as the swap
137137
// 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,
139139
// and we can just return the error.
140140
err = d.initialize(true)
141141
if errors.Is(err, bbolt.ErrTimeout) {
@@ -322,7 +322,7 @@ func (d *Daemon) startWebServers() error {
322322
err := d.restServer.Serve(d.restListener)
323323
// ErrServerClosed is always returned when the proxy is
324324
// shut down, so don't log it.
325-
if err != nil && err != http.ErrServerClosed {
325+
if err != nil && !errors.Is(err, http.ErrServerClosed) {
326326
// Notify the main error handler goroutine that
327327
// we exited unexpectedly here. We don't have to
328328
// worry about blocking as the internal error
@@ -341,7 +341,7 @@ func (d *Daemon) startWebServers() error {
341341

342342
log.Infof("RPC server listening on %s", d.grpcListener.Addr())
343343
err = d.grpcServer.Serve(d.grpcListener)
344-
if err != nil && err != grpc.ErrServerStopped {
344+
if err != nil && !errors.Is(err, grpc.ErrServerStopped) {
345345
// Notify the main error handler goroutine that
346346
// we exited unexpectedly here. We don't have to
347347
// worry about blocking as the internal error
@@ -680,9 +680,9 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
680680
var runtimeErr error
681681

682682
// 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.
686686
select {
687687
case runtimeErr = <-d.internalErrChan:
688688
log.Errorf("Runtime error in daemon, shutting down: "+
@@ -691,7 +691,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
691691
case <-d.quit:
692692
}
693693

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,
695695
// otherwise a caller might exit the process too early.
696696
d.stop()
697697
cleanupMacaroonStore()
@@ -722,7 +722,7 @@ func (d *Daemon) stop() {
722722
d.mainCtxCancel()
723723
}
724724

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
726726
// gRPC and HTTP servers now.
727727
log.Infof("Stopping gRPC server")
728728
if d.grpcServer != nil {

0 commit comments

Comments
 (0)