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
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:
2. setup() Always Returns Ok(()) (Major - tcp_ipc.rs:35, lib.rs:419)
Because
TcpListener::bindhappens inside the spawned async task,setup()returnsOk(())before the bind attempt completes. The caller inlib.rs:417checks forErrbut will never see one from a bind failure, making the error handling dead code.Recommendations:
3. cleanup() Doesn't Actually Stop the TCP Listener (Major - tcp_ipc.rs:43)
cleanup()only clears the stored address string from state. TheTcpListenerand its accept loop (and any active client connections) continue running because the listener is owned by the spawned task, not byTcpSocketState.Unlike the Unix socket
ipc::cleanup()which removes the socket file, this cleanup is purely cosmetic.Recommendations:
References
apps/tauri/src-tauri/src/tcp_ipc.rs,apps/tauri/src-tauri/src/lib.rs