-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(cli): rewrite ops to use ResourceTable2 #8512
Conversation
}); | ||
let (size, remote_addr) = receive_fut.await?; | ||
let resource = state | ||
.borrow_mut() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like https://github.com/denoland/deno/pull/8512/files/8fcb9a496bbadc19dc1c22c226ff17656b286bce#diff-6b4e31d40f717632f8b6eb94b2a0828d3cde3ee6df5197d49e976068f9be33b2 hasn't been addressed.
We also need a test for it, which should roughly do the following:
- Create an UDP socket.
- Start receiving packets on that UDP socket.
- Use the UDP socket to send a packet to itself.
- Verify that the packet has been received.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test (verified to pass w/ deno 1.6.1):
const socket = Deno.listenDatagram({ port: 3500, transport: "udp" });
assert(socket.addr.transport === "udp");
assertEquals(socket.addr.port, 3500);
assertEquals(socket.addr.hostname, "127.0.0.1");
const recvPromise = socket.receive();
const sendBuf = new Uint8Array([1, 2, 3]);
const sendLen = await socket.send(sendBuf, socket.addr);
assertEquals(sendLen, 3);
const [recvBuf, recvAddr] = await recvPromise;
assertEquals(recvBuf.length, 3);
assertEquals(1, recvBuf[0]);
assertEquals(2, recvBuf[1]);
assertEquals(3, recvBuf[2]);
socket.close();
EDIT: pushed the test to this branch.
EDIT: made the test pass for UDP sockets. The equivalent test for UnixDatagram sockets can't be made to pass until we upgrade to Tokio 0.3, but the (ignored) test has been added to net_test.ts
.
Anything that can be *actively* run to completion should just do so and not get canceled.
This commit migrates all ops to use new resource table and "AsyncRefCell". Old implementation of resource table was completely removed and all code referencing it was updated to use new system.
No description provided.