mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 20:45:29 +00:00
improve & document logging for unix sockets
This commit is contained in:
parent
f266de8a16
commit
965f804146
2 changed files with 18 additions and 10 deletions
15
src/main.rs
15
src/main.rs
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue