mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 17:51:33 +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
|
||||
// externally.
|
||||
stopProxy, err := startRestProxy(
|
||||
cfg, rpcServer, restDialOpts, restListen,
|
||||
ctx, cfg, rpcServer, restDialOpts, restListen,
|
||||
)
|
||||
if err != nil {
|
||||
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
|
||||
// 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) {
|
||||
|
||||
// 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.
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
shutdownFuncs = append(shutdownFuncs, cancel)
|
||||
|
||||
|
Reference in New Issue
Block a user