profile
viewpoint

Ask questionsTCP accept loop doesn't use for-await

Currently to accept connections from TCP server the API is this:

  const listener = Deno.listen({ port: 1234 });
  console.log("Listening on", addr);
  while (true) {
    const conn = await listener.accept();
    handle(conn);
  }

Would it be better to instead use a for-await loop? (Especially since top-level-for-await is now supported).

If the API is changed, we should also make sure that listenTCP is similarly updated.

denoland/deno

Answer questions ry

Oops I forgot about that :)

useful!
source:https://uonfu.com/
Github User Rank List