mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-03 20:46:04 +02:00
lnd: pass ctx to rest proxy
This commit is contained in:
6
lnd.go
6
lnd.go
@@ -379,7 +379,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||||||
// wildcard to prevent certificate issues when accessing the proxy
|
// wildcard to prevent certificate issues when accessing the proxy
|
||||||
// externally.
|
// externally.
|
||||||
stopProxy, err := startRestProxy(
|
stopProxy, err := startRestProxy(
|
||||||
cfg, rpcServer, restDialOpts, restListen,
|
ctx, cfg, rpcServer, restDialOpts, restListen,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return mkErr("error starting REST proxy: %v", err)
|
return mkErr("error starting REST proxy: %v", err)
|
||||||
@@ -921,7 +921,8 @@ func startGrpcListen(cfg *Config, grpcServer *grpc.Server,
|
|||||||
|
|
||||||
// startRestProxy starts the given REST proxy on the listeners found in the
|
// startRestProxy starts the given REST proxy on the listeners found in the
|
||||||
// config.
|
// config.
|
||||||
func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialOption,
|
func startRestProxy(ctx context.Context, cfg *Config, rpcServer *rpcServer,
|
||||||
|
restDialOpts []grpc.DialOption,
|
||||||
restListen func(net.Addr) (net.Listener, error)) (func(), error) {
|
restListen func(net.Addr) (net.Listener, error)) (func(), error) {
|
||||||
|
|
||||||
// We use the first RPC listener as the destination for our REST proxy.
|
// We use the first RPC listener as the destination for our REST proxy.
|
||||||
@@ -948,7 +949,6 @@ func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialO
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start a REST proxy for our gRPC server.
|
// Start a REST proxy for our gRPC server.
|
||||||
ctx := context.Background()
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
shutdownFuncs = append(shutdownFuncs, cancel)
|
shutdownFuncs = append(shutdownFuncs, cancel)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user