Skip to content

Commit b9454d9

Browse files
committed
disable ipc listener
1 parent 18a0be7 commit b9454d9

File tree

1 file changed

+80
-80
lines changed

1 file changed

+80
-80
lines changed

src-tauri/src/ipc.rs

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -42,90 +42,90 @@ fn create_overlay_window(
4242
Ok(())
4343
}
4444

45-
pub fn listen_for_ipc(app_handle: AppHandle) {
46-
thread::spawn(move || {
47-
let listener = TcpListener::bind(format!("127.0.0.1:{}", IPC_PORT))
48-
.expect("Failed to bind to IPC port");
45+
pub fn listen_for_ipc(_app_handle: AppHandle) {
46+
// thread::spawn(move || {
47+
// let listener = TcpListener::bind(format!("127.0.0.1:{}", IPC_PORT))
48+
// .expect("Failed to bind to IPC port");
4949

50-
for stream in listener.incoming() {
51-
if let Ok(stream) = stream {
52-
let handle = app_handle.clone();
50+
// for stream in listener.incoming() {
51+
// if let Ok(stream) = stream {
52+
// let handle = app_handle.clone();
5353

54-
thread::spawn(move || {
55-
let Ok(stream_clone) = stream.try_clone() else {
56-
log::error!("Failed to clone IPC stream");
57-
return;
58-
};
59-
let mut reader = std::io::BufReader::new(stream_clone);
60-
let mut line = String::new();
61-
while let Ok(bytes) = reader.read_line(&mut line) {
62-
if bytes == 0 {
63-
break;
64-
}
54+
// thread::spawn(move || {
55+
// let Ok(stream_clone) = stream.try_clone() else {
56+
// log::error!("Failed to clone IPC stream");
57+
// return;
58+
// };
59+
// let mut reader = std::io::BufReader::new(stream_clone);
60+
// let mut line = String::new();
61+
// while let Ok(bytes) = reader.read_line(&mut line) {
62+
// if bytes == 0 {
63+
// break;
64+
// }
6565

66-
if line.starts_with("init:") {
67-
if let Some(pid_str) = line.strip_prefix("init:") {
68-
if let Ok(pid) = pid_str.trim().parse::<i32>() {
69-
if let Ok(stream_clone) = stream.try_clone() {
70-
if let Ok(mut streams) = GAME_STREAMS.lock() {
71-
streams.insert(pid, stream_clone);
72-
}
73-
}
74-
}
75-
}
76-
} else if line.starts_with("pos:") {
77-
if let Some(coords) = line.strip_prefix("pos:") {
78-
let parts: Vec<_> = coords.trim().split(',').collect();
79-
if parts.len() == 5 {
80-
if let (Ok(_x), Ok(_y), Ok(w), Ok(h), Ok(pid)) = (
81-
parts[0].parse::<i32>(),
82-
parts[1].parse::<i32>(),
83-
parts[2].parse::<i32>(),
84-
parts[3].parse::<i32>(),
85-
parts[4].parse::<i32>(),
86-
) {
87-
let window_label = format!("omp_overlay_window:{}", pid);
88-
if let Some(win) = handle.get_window(&window_label) {
89-
let _ = win.set_position(tauri::PhysicalPosition {
90-
x: -1 * w - 1000,
91-
y: -1 * h - 1000,
92-
});
66+
// if line.starts_with("init:") {
67+
// if let Some(pid_str) = line.strip_prefix("init:") {
68+
// if let Ok(pid) = pid_str.trim().parse::<i32>() {
69+
// if let Ok(stream_clone) = stream.try_clone() {
70+
// if let Ok(mut streams) = GAME_STREAMS.lock() {
71+
// streams.insert(pid, stream_clone);
72+
// }
73+
// }
74+
// }
75+
// }
76+
// } else if line.starts_with("pos:") {
77+
// if let Some(coords) = line.strip_prefix("pos:") {
78+
// let parts: Vec<_> = coords.trim().split(',').collect();
79+
// if parts.len() == 5 {
80+
// if let (Ok(_x), Ok(_y), Ok(w), Ok(h), Ok(pid)) = (
81+
// parts[0].parse::<i32>(),
82+
// parts[1].parse::<i32>(),
83+
// parts[2].parse::<i32>(),
84+
// parts[3].parse::<i32>(),
85+
// parts[4].parse::<i32>(),
86+
// ) {
87+
// let window_label = format!("omp_overlay_window:{}", pid);
88+
// if let Some(win) = handle.get_window(&window_label) {
89+
// let _ = win.set_position(tauri::PhysicalPosition {
90+
// x: -1 * w - 1000,
91+
// y: -1 * h - 1000,
92+
// });
9393

94-
let _ = win.set_size(tauri::PhysicalSize {
95-
width: w as u32,
96-
height: h as u32,
97-
});
98-
}
99-
}
100-
}
101-
}
102-
} else if line.starts_with("show_overlay:") {
103-
let parts: Vec<_> = line.trim().split(':').collect();
104-
if parts.len() >= 2 {
105-
if let Ok(pid) = parts[1].parse::<i32>() {
106-
let window_label = format!("omp_overlay_window:{}", pid);
107-
let _ = create_overlay_window(&handle, &window_label, pid);
108-
}
109-
}
110-
} else if line.starts_with("hide_overlay:") {
111-
let parts: Vec<_> = line.trim().split(':').collect();
112-
if parts.len() >= 2 {
113-
let window_label = format!("omp_overlay_window:{}", parts[1]);
114-
if let Some(window) = handle.get_window(&window_label) {
115-
let _ = window.close();
116-
} else {
117-
log::warn!("IPC overlay window not found: {}", window_label);
118-
}
119-
}
120-
} else {
121-
log::warn!("Unknown IPC command received: {}", line.trim());
122-
}
123-
line.clear();
124-
}
125-
});
126-
}
127-
}
128-
});
94+
// let _ = win.set_size(tauri::PhysicalSize {
95+
// width: w as u32,
96+
// height: h as u32,
97+
// });
98+
// }
99+
// }
100+
// }
101+
// }
102+
// } else if line.starts_with("show_overlay:") {
103+
// let parts: Vec<_> = line.trim().split(':').collect();
104+
// if parts.len() >= 2 {
105+
// if let Ok(pid) = parts[1].parse::<i32>() {
106+
// let window_label = format!("omp_overlay_window:{}", pid);
107+
// let _ = create_overlay_window(&handle, &window_label, pid);
108+
// }
109+
// }
110+
// } else if line.starts_with("hide_overlay:") {
111+
// let parts: Vec<_> = line.trim().split(':').collect();
112+
// if parts.len() >= 2 {
113+
// let window_label = format!("omp_overlay_window:{}", parts[1]);
114+
// if let Some(window) = handle.get_window(&window_label) {
115+
// let _ = window.close();
116+
// } else {
117+
// log::warn!("IPC overlay window not found: {}", window_label);
118+
// }
119+
// }
120+
// } else {
121+
// log::warn!("Unknown IPC command received: {}", line.trim());
122+
// }
123+
// line.clear();
124+
// }
125+
// });
126+
// }
127+
// }
128+
// });
129129
}
130130

131131
#[tauri::command]

0 commit comments

Comments
 (0)