mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
unixpacket should also return byte length on send (#6291)
This commit is contained in:
parent
9e8ecedfea
commit
fc850b11e5
2 changed files with 4 additions and 3 deletions
|
@ -244,11 +244,11 @@ fn op_datagram_send(
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let socket = &mut resource.socket;
|
let socket = &mut resource.socket;
|
||||||
socket
|
let byte_length = socket
|
||||||
.send_to(&zero_copy, &resource.local_addr.as_pathname().unwrap())
|
.send_to(&zero_copy, &resource.local_addr.as_pathname().unwrap())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(json!({}))
|
Ok(json!(byte_length))
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(JsonOp::Async(op.boxed_local()))
|
Ok(JsonOp::Async(op.boxed_local()))
|
||||||
|
|
|
@ -290,7 +290,8 @@ unitTest(
|
||||||
assertEquals(bob.addr.path, filePath);
|
assertEquals(bob.addr.path, filePath);
|
||||||
|
|
||||||
const sent = new Uint8Array([1, 2, 3]);
|
const sent = new Uint8Array([1, 2, 3]);
|
||||||
await alice.send(sent, bob.addr);
|
const byteLength = await alice.send(sent, bob.addr);
|
||||||
|
assertEquals(byteLength, 3);
|
||||||
|
|
||||||
const [recvd, remote] = await bob.receive();
|
const [recvd, remote] = await bob.receive();
|
||||||
assert(remote.transport === "unixpacket");
|
assert(remote.transport === "unixpacket");
|
||||||
|
|
Loading…
Reference in a new issue