aboutsummaryrefslogtreecommitdiffstats
path: root/src/sessions.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2022-04-27 10:44:14 +0200
committerGitHub <noreply@github.com>2022-04-27 10:44:14 +0200
commit7ba49658f7615cf62891b17155381ac65a6a5c78 (patch)
tree9a6a85788b65982c650d34a2b120bc3823cec65b /src/sessions.rs
parentdocs(changelog): grid stabilizations (diff)
downloadsl0ppij-7ba49658f7615cf62891b17155381ac65a6a5c78.tar.gz
sl0ppij-7ba49658f7615cf62891b17155381ac65a6a5c78.tar.xz
sl0ppij-7ba49658f7615cf62891b17155381ac65a6a5c78.zip
fix(ipc): empty ipc msg crash (#1351)
* fix(ipc): recover from corrupted channel state * style(fmt): rustfmt
Diffstat (limited to '')
-rw-r--r--src/sessions.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sessions.rs b/src/sessions.rs
index 20dfcc56..2d65925b 100644
--- a/src/sessions.rs
+++ b/src/sessions.rs
@@ -58,10 +58,13 @@ fn assert_socket(name: &str) -> bool {
Ok(stream) => {
let mut sender = IpcSenderWithContext::new(stream);
sender.send(ClientToServerMsg::ConnStatus);
-
let mut receiver: IpcReceiverWithContext<ServerToClientMsg> = sender.get_receiver();
- let (instruction, _) = receiver.recv();
- matches!(instruction, ServerToClientMsg::Connected)
+ match receiver.recv() {
+ Some((instruction, _)) => {
+ matches!(instruction, ServerToClientMsg::Connected)
+ }
+ None => false,
+ }
}
Err(e) if e.kind() == io::ErrorKind::ConnectionRefused => {
drop(fs::remove_file(path));