mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
lnd: simplify listener creation
This commit is contained in:
9
lnd.go
9
lnd.go
@@ -224,10 +224,8 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||||||
|
|
||||||
// If we have chosen to start with a dedicated listener for the
|
// If we have chosen to start with a dedicated listener for the
|
||||||
// rpc server, we set it directly.
|
// rpc server, we set it directly.
|
||||||
var grpcListeners []*ListenerWithSignal
|
grpcListeners := append([]*ListenerWithSignal{}, lisCfg.RPCListeners...)
|
||||||
if len(lisCfg.RPCListeners) > 0 {
|
if len(grpcListeners) == 0 {
|
||||||
grpcListeners = append(grpcListeners, lisCfg.RPCListeners...)
|
|
||||||
} else {
|
|
||||||
// Otherwise we create listeners from the RPCListeners defined
|
// Otherwise we create listeners from the RPCListeners defined
|
||||||
// in the config.
|
// in the config.
|
||||||
for _, grpcEndpoint := range cfg.RPCListeners {
|
for _, grpcEndpoint := range cfg.RPCListeners {
|
||||||
@@ -245,7 +243,8 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||||||
grpcListeners, &ListenerWithSignal{
|
grpcListeners, &ListenerWithSignal{
|
||||||
Listener: lis,
|
Listener: lis,
|
||||||
Ready: make(chan struct{}),
|
Ready: make(chan struct{}),
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user