improve & document logging for unix sockets

This commit is contained in:
Johann150 2023-03-17 19:29:18 +01:00
parent f266de8a16
commit 965f804146
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 18 additions and 10 deletions

View file

@ -458,13 +458,14 @@ impl RequestHandle<UnixStream> {
stream: UnixStream,
metadata: Arc<Mutex<FileOptions>>,
) -> Result<Self, String> {
let log_line = match stream.local_addr() {
Ok(a) => match a.as_pathname() {
Some(p) => format!("{} -", p.display()),
None => "<unnamed socket> -".to_string(),
},
Err(_) => "<unnamed socket> -".to_string(),
};
let log_line = format!(
"unix:{} -",
stream
.local_addr()
.ok()
.and_then(|addr| Some(addr.as_pathname()?.to_string_lossy().into_owned()))
.unwrap_or_default()
);
match TLS.accept(stream).await {
Ok(stream) => Ok(Self {