Skip to content
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

Merged
merged 78 commits into from
Dec 16, 2020

Conversation

bartlomieju
Copy link
Member

No description provided.

cli/ops/websocket.rs Outdated Show resolved Hide resolved
cli/ops/net.rs Outdated Show resolved Hide resolved
@bartlomieju bartlomieju mentioned this pull request Dec 15, 2020
core/async_cell.rs Outdated Show resolved Hide resolved
});
let (size, remote_addr) = receive_fut.await?;
let resource = state
.borrow_mut()
Copy link
Member

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.

Copy link
Member

@piscisaureus piscisaureus Dec 15, 2020

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.

@bartlomieju bartlomieju merged commit 6984b63 into denoland:master Dec 16, 2020
@bartlomieju bartlomieju deleted the resource_table2 branch December 16, 2020 16:14
@bartlomieju bartlomieju mentioned this pull request Dec 17, 2020
22 tasks
kitsonk pushed a commit to lucacasonato/deno that referenced this pull request Dec 18, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants