mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
cln-grpc: Do not exit if grpc-port is not set
Exiting doesn't mesh well with builtin plugins, so just sit there and do nothing Changelog-None
This commit is contained in:
parent
9a8bc777e5
commit
9826402c99
@ -40,19 +40,22 @@ async fn main() -> Result<()> {
|
||||
let bind_port = match plugin.option("grpc-port") {
|
||||
Some(options::Value::Integer(-1)) => {
|
||||
log::info!("`grpc-port` option is not configured, exiting.");
|
||||
return Ok(());
|
||||
None
|
||||
}
|
||||
Some(options::Value::Integer(i)) => i,
|
||||
Some(options::Value::Integer(i)) => Some(i),
|
||||
None => return Err(anyhow!("Missing 'grpc-port' option")),
|
||||
Some(o) => return Err(anyhow!("grpc-port is not a valid integer: {:?}", o)),
|
||||
};
|
||||
let bind_addr: SocketAddr = format!("0.0.0.0:{}", bind_port).parse().unwrap();
|
||||
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = run_interface(bind_addr, state).await {
|
||||
warn!("Error running the grpc interface: {}", e);
|
||||
}
|
||||
});
|
||||
if let Some(bind_port) = bind_port {
|
||||
let bind_addr: SocketAddr = format!("0.0.0.0:{}", bind_port).parse().unwrap();
|
||||
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = run_interface(bind_addr, state).await {
|
||||
warn!("Error running the grpc interface: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
plugin.join().await
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ def test_grpc_no_auto_start(node_factory):
|
||||
"plugin": str(bin_path),
|
||||
})
|
||||
|
||||
wait_for(lambda: [p for p in l1.rpc.plugin('list')['plugins'] if 'cln-grpc' in p['name']] == [])
|
||||
l1.daemon.logsearch_start = 0
|
||||
assert l1.daemon.is_in_log(r'plugin-cln-grpc: Killing plugin: exited during normal operation')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user