aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/main.rs
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2021-03-26 01:23:57 +0100
committerEskil Queseth <eskilq@kth.se>2021-03-26 01:23:57 +0100
commitb0034ec3e344030274c98cf81f75789d80ce6211 (patch)
tree3d6b91d21f81135bd301ea0a7c37aa5950f676dc /mumd/src/main.rs
parent0f677fff3f48d4d17ece37060323ce19a41d87ad (diff)
downloadmum-b0034ec3e344030274c98cf81f75789d80ce6211.tar.gz
use constant string for socket path
Diffstat (limited to 'mumd/src/main.rs')
-rw-r--r--mumd/src/main.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/mumd/src/main.rs b/mumd/src/main.rs
index c596b8f..5b71ae0 100644
--- a/mumd/src/main.rs
+++ b/mumd/src/main.rs
@@ -24,7 +24,7 @@ async fn main() {
notify::init();
// check if another instance is live
- let connection = UnixStream::connect("/tmp/mumd").await;
+ let connection = UnixStream::connect(mumlib::SOCKET_PATH).await;
match connection {
Ok(stream) => {
let (reader, writer) = stream.into_split();
@@ -41,12 +41,12 @@ async fn main() {
}
}
debug!("a dead socket was found, removing");
- tokio::fs::remove_file("/tmp/mumd").await.unwrap();
+ tokio::fs::remove_file(mumlib::SOCKET_PATH).await.unwrap();
}
Err(e) => {
if matches!(e.kind(), std::io::ErrorKind::ConnectionRefused) {
debug!("a dead socket was found, removing");
- tokio::fs::remove_file("/tmp/mumd").await.unwrap();
+ tokio::fs::remove_file(mumlib::SOCKET_PATH).await.unwrap();
}
}
}
@@ -65,7 +65,7 @@ async fn receive_commands(
oneshot::Sender<mumlib::error::Result<Option<CommandResponse>>>,
)>,
) {
- let socket = UnixListener::bind("/tmp/mumd").unwrap();
+ let socket = UnixListener::bind(mumlib::SOCKET_PATH).unwrap();
loop {
if let Ok((incoming, _)) = socket.accept().await {