Sfoglia il codice sorgente

client: Delete socket before opening it again (fixes a panic).

Mathias Gottschlag 5 anni fa
parent
commit
a053a262c8
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2
    1
      src/bin/client.rs

+ 2
- 1
src/bin/client.rs Vedi File

@@ -1,4 +1,4 @@
1
-use std::fs::create_dir_all;
1
+use std::fs::{create_dir_all, remove_file};
2 2
 use std::sync::Arc;
3 3
 use std::ffi::{OsStr, OsString};
4 4
 
@@ -75,6 +75,7 @@ async fn main() {
75 75
 
76 76
     // We create the socket before starting synchronization, so that the unwrap() below does not
77 77
     // cause corruption.
78
+    remove_file(paths::client_socket()).ok();
78 79
     let mut listener = UnixListener::bind(paths::client_socket()).unwrap();
79 80
     let mut incoming = listener.incoming();
80 81
 

Loading…
Annulla
Salva