Skip to content

Commit

Permalink
feat(pd): specific error msg for auto https
Browse files Browse the repository at this point in the history
Adding a specific error message for a failure mode of `pd` when using
`--grpc-auto-https`: if run as a normal user, the bind to 443 will fail.
That's OK, but state clearly what operation failed. Without this change,
the error message is simply "Permission denied", with no mention of the
attempted bind on 443.
  • Loading branch information
conorsch committed Oct 12, 2023
1 parent ac2d3de commit 5d4371e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/bin/pd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ async fn main() -> anyhow::Result<()> {
.parse()
.context("failed to parse grpc_bind address")?,
);
let listener = TcpListenerStream::new(TcpListener::bind(grpc_bind).await?);
let bound_listener = TcpListener::bind(grpc_bind)
.await
.context(format!("Failed to bind HTTPS listener on {}", grpc_bind))?;
let listener = TcpListenerStream::new(bound_listener);
// Configure HTTP2 support for the TLS negotiation; we also permit HTTP1.1
// for backwards-compatibility, specifically for grpc-web.
let alpn_config = vec!["h2".into(), "http/1.1".into()];
Expand Down

0 comments on commit 5d4371e

Please sign in to comment.