1
0
Fork 0
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:
Peter Evers 2020-06-15 18:20:45 +02:00 committed by GitHub
parent 9e8ecedfea
commit fc850b11e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -244,11 +244,11 @@ fn op_datagram_send(
})?;
let socket = &mut resource.socket;
socket
let byte_length = socket
.send_to(&zero_copy, &resource.local_addr.as_pathname().unwrap())
.await?;
Ok(json!({}))
Ok(json!(byte_length))
};
Ok(JsonOp::Async(op.boxed_local()))

View file

@ -290,7 +290,8 @@ unitTest(
assertEquals(bob.addr.path, filePath);
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();
assert(remote.transport === "unixpacket");