-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
CodeRabbit identified several robustness issues in the TCP IPC implementation:
1. Hardcoded Port Conflicts with Neo4j (Major - tcp_ipc.rs:8)
Port 7474 is Neo4j's default HTTP port. The TCP bind happens asynchronously inside a spawned task, but if another process holds the port, the error is only logged to stderr.
Recommendations:
- Make the port configurable (via config file or environment variable)
- Consider a fallback port range
- Synchronously bind before spawning the listener loop to catch conflicts early
2. setup() Always Returns Ok(()) (Major - tcp_ipc.rs:35, lib.rs:419)
Because TcpListener::bind happens inside the spawned async task, setup() returns Ok(()) before the bind attempt completes. The caller in lib.rs:417 checks for Err but will never see one from a bind failure, making the error handling dead code.
Recommendations:
- Synchronously bind before spawning the accept loop, OR
- Use a oneshot channel to relay the bind result back to the caller
- Propagate actual bind errors to the caller
3. cleanup() Doesn't Actually Stop the TCP Listener (Major - tcp_ipc.rs:43)
cleanup() only clears the stored address string from state. The TcpListener and its accept loop (and any active client connections) continue running because the listener is owned by the spawned task, not by TcpSocketState.
Unlike the Unix socket ipc::cleanup() which removes the socket file, this cleanup is purely cosmetic.
Recommendations:
- Store a cancellation mechanism (tokio::sync::watch, CancellationToken, or JoinHandle) in TcpSocketState
- Modify the accept loop to check for cancellation
- In cleanup(), signal cancellation or abort the JoinHandle
References
- PR fix(tauri): resolve relative paths and prepare for IPC merge #12 CodeRabbit review comments
- Files:
apps/tauri/src-tauri/src/tcp_ipc.rs,apps/tauri/src-tauri/src/lib.rs