Skip to content

Commit

Permalink
expose new_uds err
Browse files Browse the repository at this point in the history
Includes-commit: 28613b6
Includes-commit: 521970a
Includes-commit: 629612b
Includes-commit: ba71fe7
Replicated-from: #217
  • Loading branch information
cospectrum authored and andrewhavck committed Jun 7, 2024
1 parent 31d7b63 commit 1c707cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a73e00f51bc6643e93abedc2a763d38122ffb21d
32b73315dbc9aa07ca121a5fde8fc58dde5b9e1b
13 changes: 9 additions & 4 deletions pingora-core/src/upstreams/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
//! Defines where to connect to and how to connect to a remote server

use ahash::AHasher;
use pingora_error::{ErrorType::InternalError, OrErr, Result};
use pingora_error::{
ErrorType::{InternalError, SocketError},
OrErr, Result,
};
use std::collections::BTreeMap;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::hash::{Hash, Hasher};
Expand Down Expand Up @@ -431,9 +434,11 @@ impl HttpPeer {
}

/// Create a new [`HttpPeer`] with the given path to Unix domain socket and TLS settings.
pub fn new_uds(path: &str, tls: bool, sni: String) -> Self {
let addr = SocketAddr::Unix(UnixSocketAddr::from_pathname(Path::new(path)).unwrap()); //TODO: handle error
Self::new_from_sockaddr(addr, tls, sni)
pub fn new_uds(path: &str, tls: bool, sni: String) -> Result<Self> {
let addr = SocketAddr::Unix(
UnixSocketAddr::from_pathname(Path::new(path)).or_err(SocketError, "invalid path")?,
);
Ok(Self::new_from_sockaddr(addr, tls, sni))
}

/// Create a new [`HttpPeer`] that uses a proxy to connect to the upstream IP and port
Expand Down
2 changes: 1 addition & 1 deletion pingora-proxy/tests/utils/server_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl ProxyHttp for ExampleProxyHttp {
"/tmp/nginx-test.sock",
false,
"".to_string(),
)));
)?));
}
let port = req
.headers
Expand Down

0 comments on commit 1c707cb

Please sign in to comment.