fix: write complete administrative console responses (#717)

* fix: write complete administrative console responses

* Document changed function contracts
This commit is contained in:
jahvari authored and GitHub committed 2026-11-07 12:52:17 +08:00
1 parent 1bd3938cfe
commit 36a0996ee8
2 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -385,6 +385,7 @@ async fn io_loop(
}
}
/// Accepts a relay connection and routes loopback console requests separately.
async fn handle_connection(
stream: TcpStream,
addr: SocketAddr,
@@ -401,7 +402,7 @@ async fn handle_connection(
if let Ok(Ok(n)) = timeout(1000, stream.read(&mut buffer[..])).await {
if let Ok(data) = std::str::from_utf8(&buffer[..n]) {
let res = check_cmd(data, limiter).await;
stream.write(res.as_bytes()).await.ok();
stream.write_all(res.as_bytes()).await.ok();
}
}
});
+2 -1
View File
@@ -1167,6 +1167,7 @@ impl RendezvousServer {
res
}
/// Handles loopback console requests and external NAT or online-status queries.
async fn handle_listener2(&self, stream: TcpStream, addr: SocketAddr) {
let mut rs = self.clone();
let ip = try_into_v4(addr).ip();
@@ -1177,7 +1178,7 @@ impl RendezvousServer {
if let Ok(Ok(n)) = timeout(1000, stream.read(&mut buffer[..])).await {
if let Ok(data) = std::str::from_utf8(&buffer[..n]) {
let res = rs.check_cmd(data).await;
stream.write(res.as_bytes()).await.ok();
stream.write_all(res.as_bytes()).await.ok();
}
}
});