Browse Source

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

Mathias Gottschlag 5 years ago
parent
commit
a053a262c8
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/bin/client.rs

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

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

Loading…
Cancel
Save