Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Bugfixes #67

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion razer_control_gui/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ lazy_static! {

// Main function for daemon
fn main() {
std::panic::set_hook(Box::new(|_info| {
println!("Something went wrong! Removing the socket path");
if std::fs::metadata(comms::SOCKET_PATH).is_ok() {
std::fs::remove_file(comms::SOCKET_PATH).unwrap();
}
}));

if let Ok(mut d) = DEV_MANAGER.lock() {
d.discover_devices();
if let Some(laptop) = d.get_device() {
Expand Down Expand Up @@ -234,7 +241,11 @@ fn handle_data(mut stream: UnixStream) {
if let Some(cmd) = comms::read_from_socket_req(&buffer) {
if let Some(s) = process_client_request(cmd) {
if let Ok(x) = bincode::serialize(&s) {
stream.write_all(&x).unwrap();
let result = stream.write_all(&x);

if let Err(error) = result {
println!("Client disconnected with error: {error}");
}
}
}
}
Expand Down