♻️ Use u16 instead of newline
This commit is contained in:
parent
dedfb57285
commit
5bf43a72af
1 changed files with 4 additions and 4 deletions
|
|
@ -131,14 +131,14 @@ async fn send_fd(session_tx: &mut WriteHalf<'_>, stream: Vec<UnixStream>) -> Res
|
||||||
.wrap_err("failed to convert streams to file descriptors")?;
|
.wrap_err("failed to convert streams to file descriptors")?;
|
||||||
let json = serde_json::to_string(&Message::NewPrivilegedClient { count: fds.len() })
|
let json = serde_json::to_string(&Message::NewPrivilegedClient { count: fds.len() })
|
||||||
.wrap_err("failed to encode json")?;
|
.wrap_err("failed to encode json")?;
|
||||||
|
session_tx
|
||||||
|
.write_all(&(json.len() as u16).to_le_bytes())
|
||||||
|
.await
|
||||||
|
.wrap_err("failed to write length")?;
|
||||||
session_tx
|
session_tx
|
||||||
.write_all(json.as_bytes())
|
.write_all(json.as_bytes())
|
||||||
.await
|
.await
|
||||||
.wrap_err("failed to write json")?;
|
.wrap_err("failed to write json")?;
|
||||||
session_tx
|
|
||||||
.write_all(b"\n")
|
|
||||||
.await
|
|
||||||
.wrap_err("failed to write newline")?;
|
|
||||||
tokio::time::sleep(std::time::Duration::from_micros(100)).await;
|
tokio::time::sleep(std::time::Duration::from_micros(100)).await;
|
||||||
let tx: &UnixStream = session_tx.as_ref();
|
let tx: &UnixStream = session_tx.as_ref();
|
||||||
tx.send_with_fd(&[0], &fds).wrap_err("failed to send fd")?;
|
tx.send_with_fd(&[0], &fds).wrap_err("failed to send fd")?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue