mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +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:
committed by
Rusty Russell
parent
9a8bc777e5
commit
9826402c99
@@ -40,12 +40,14 @@ async fn main() -> Result<()> {
|
|||||||
let bind_port = match plugin.option("grpc-port") {
|
let bind_port = match plugin.option("grpc-port") {
|
||||||
Some(options::Value::Integer(-1)) => {
|
Some(options::Value::Integer(-1)) => {
|
||||||
log::info!("`grpc-port` option is not configured, exiting.");
|
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")),
|
None => return Err(anyhow!("Missing 'grpc-port' option")),
|
||||||
Some(o) => return Err(anyhow!("grpc-port is not a valid integer: {:?}", o)),
|
Some(o) => return Err(anyhow!("grpc-port is not a valid integer: {:?}", o)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(bind_port) = bind_port {
|
||||||
let bind_addr: SocketAddr = format!("0.0.0.0:{}", bind_port).parse().unwrap();
|
let bind_addr: SocketAddr = format!("0.0.0.0:{}", bind_port).parse().unwrap();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
@@ -53,6 +55,7 @@ async fn main() -> Result<()> {
|
|||||||
warn!("Error running the grpc interface: {}", e);
|
warn!("Error running the grpc interface: {}", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
plugin.join().await
|
plugin.join().await
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ def test_grpc_no_auto_start(node_factory):
|
|||||||
"plugin": str(bin_path),
|
"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')
|
assert l1.daemon.is_in_log(r'plugin-cln-grpc: Killing plugin: exited during normal operation')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user