forked from unom/punktfunk
fix(host/linux): TCP_NODELAY on accepted usbip loopback sockets
The vhci-bound socket already set nodelay, but the server-side accepted socket — the one carrying every URB reply back to the kernel — did not. The wired single-interface device never tripped it, but the Puck's six concurrent endpoint streams turn the request/response URB pattern into classic write-write-read Nagle/delayed-ACK stalls: measured ~22 reports/s on Steam's active Puck hidraw (each ~45 ms apart, sequence jumping by 12) against a clean 266 Hz feed from the client. Trackpad felt accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -283,6 +283,11 @@ async fn run_server(
|
||||
_ = stop.notified() => break,
|
||||
r = listener.accept() => match r {
|
||||
Ok((mut sock, _)) => {
|
||||
// URB replies are small and interleave with the kernel's next SUBMITs; without
|
||||
// TCP_NODELAY the multi-interface request/response pattern collapses into
|
||||
// ~40 ms Nagle/delayed-ACK stalls (observed as ~22 reports/s on the Puck's
|
||||
// active hidraw against a 266 Hz source).
|
||||
sock.set_nodelay(true).ok();
|
||||
let server = server.clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = usbip_sim::handler(&mut sock, server).await;
|
||||
|
||||
Reference in New Issue
Block a user