fix(volume-rust): resolve gRPC bind address from hostname
SocketAddr::parse() only accepts numeric IPs, so binding the gRPC server to "localhost:18833" panicked. Use tokio::net::lookup_host() to resolve hostnames before passing to tonic's serve_with_shutdown.
This commit is contained in:
@@ -606,7 +606,11 @@ async fn run(
|
|||||||
let grpc_tls_acceptor = grpc_tls_acceptor.clone();
|
let grpc_tls_acceptor = grpc_tls_acceptor.clone();
|
||||||
let mut shutdown_rx = shutdown_tx.subscribe();
|
let mut shutdown_rx = shutdown_tx.subscribe();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let addr = grpc_addr.parse().expect("Invalid gRPC address");
|
let addr = tokio::net::lookup_host(&grpc_addr)
|
||||||
|
.await
|
||||||
|
.expect("Failed to resolve gRPC address")
|
||||||
|
.next()
|
||||||
|
.expect("No addresses found for gRPC bind address");
|
||||||
let grpc_service = VolumeGrpcService {
|
let grpc_service = VolumeGrpcService {
|
||||||
state: grpc_state.clone(),
|
state: grpc_state.clone(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user