Merge pull request #2959 from halseth/err-router-shutting-down

[trivial] routing/router: define ErrRouterShuttingDown
This commit is contained in:
Johan T. Halseth 2019-04-16 15:30:22 +02:00 committed by GitHub
commit 58ec9efed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,6 +44,10 @@ var (
// construct a new sphinx packet, but provides an empty set of hops for // construct a new sphinx packet, but provides an empty set of hops for
// each route. // each route.
ErrNoRouteHopsProvided = fmt.Errorf("empty route hops provided") ErrNoRouteHopsProvided = fmt.Errorf("empty route hops provided")
// ErrRouterShuttingDown is returned if the router is in the process of
// shutting down.
ErrRouterShuttingDown = fmt.Errorf("router shutting down")
) )
// ChannelGraphSource represents the source of information about the topology // ChannelGraphSource represents the source of information about the topology
@ -1686,7 +1690,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
) )
case <-r.quit: case <-r.quit:
return [32]byte{}, nil, fmt.Errorf("router shutting down") return [32]byte{}, nil, ErrRouterShuttingDown
default: default:
// Fall through if we haven't hit our time limit, or // Fall through if we haven't hit our time limit, or
@ -2108,10 +2112,10 @@ func (r *ChannelRouter) AddNode(node *channeldb.LightningNode) error {
case err := <-rMsg.err: case err := <-rMsg.err:
return err return err
case <-r.quit: case <-r.quit:
return errors.New("router has been shut down") return ErrRouterShuttingDown
} }
case <-r.quit: case <-r.quit:
return errors.New("router has been shut down") return ErrRouterShuttingDown
} }
} }
@ -2132,10 +2136,10 @@ func (r *ChannelRouter) AddEdge(edge *channeldb.ChannelEdgeInfo) error {
case err := <-rMsg.err: case err := <-rMsg.err:
return err return err
case <-r.quit: case <-r.quit:
return errors.New("router has been shut down") return ErrRouterShuttingDown
} }
case <-r.quit: case <-r.quit:
return errors.New("router has been shut down") return ErrRouterShuttingDown
} }
} }
@ -2155,10 +2159,10 @@ func (r *ChannelRouter) UpdateEdge(update *channeldb.ChannelEdgePolicy) error {
case err := <-rMsg.err: case err := <-rMsg.err:
return err return err
case <-r.quit: case <-r.quit:
return errors.New("router has been shut down") return ErrRouterShuttingDown
} }
case <-r.quit: case <-r.quit:
return errors.New("router has been shut down") return ErrRouterShuttingDown
} }
} }