mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
remove existing unix socket if it exists
This commit is contained in:
parent
bc52ea54f3
commit
55d40aa32d
1 changed files with 4 additions and 0 deletions
|
@ -80,6 +80,10 @@ impl Listener {
|
||||||
async fn bind(addr: &str, unix: bool) -> Result<Listener, std::io::Error> {
|
async fn bind(addr: &str, unix: bool) -> Result<Listener, std::io::Error> {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
if unix {
|
if unix {
|
||||||
|
if std::fs::metadata(addr).is_ok() {
|
||||||
|
println!("attempting to remove old socket {:?}", addr);
|
||||||
|
std::fs::remove_file(addr)?;
|
||||||
|
}
|
||||||
return Ok(Listener::Unix(UnixListener::bind(addr)?));
|
return Ok(Listener::Unix(UnixListener::bind(addr)?));
|
||||||
}
|
}
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue