Skip to content

Commit

Permalink
More reliability improvements to profile switching
Browse files Browse the repository at this point in the history
  • Loading branch information
null-dev committed May 31, 2021
1 parent b7bcdbd commit 973ea94
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,25 @@ fn handle_conn(app_state: &AppState, mut conn: LocalSocketStream) {
return
}

loop {
// Read command
let mut deserializer = serde_cbor::Deserializer::from_reader(&mut conn);
match IPCCommand::deserialize(&mut deserializer) {
Ok(command) => handle_ipc_cmd(app_state, command),
Err(e) => {
log::error!("Failed to read command from IPC: {:?}", e);
return
}
// We no longer attempt to read multiple messages on a connection, blame Windows...

// Read command
let mut deserializer = serde_cbor::Deserializer::from_reader(&mut conn);
match IPCCommand::deserialize(&mut deserializer) {
Ok(command) => handle_ipc_cmd(app_state, command),
Err(e) => {
log::error!("Failed to read command from IPC: {:?}", e);
return
}
}

// TODO Write different status if command failed
// Write command status
if let Err(e) = conn.write_i32::<NetworkEndian>(0).and_then(|_| conn.flush()) {
match e.kind() {
_ => log::error!("IPC error while writing command status: {:?}", e)
}
return
// TODO Write different status if command failed
// Write command status
if let Err(e) = conn.write_i32::<NetworkEndian>(0).and_then(|_| conn.flush()) {
match e.kind() {
_ => log::error!("IPC error while writing command status: {:?}", e)
}
return
}
}

Expand Down

0 comments on commit 973ea94

Please sign in to comment.