WebAssembly / WebAssembly/WASI

TCP: Waiting for a socket to enter the `closed` state

Open
#704 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-sockets S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

In the following pseudocode (assuming the definitions in wit-0.3.0-draft):

let sock = TcpSocket::new(IpAddressFamily::Ipv4);
let bind_addr = /* some valid IPv4 address */;
sock.bind(bind_addr);
let data = /* create a new stream */;
sock.send(data);
data.close();
// Wait for `sock` to transition to the `closed` state

what would I add after the last comment if I wanted to add subsequent code that depended on sock being in the closed state? I assume that data.close() terminates the connection ("Closing the stream is equivalent to calling shutdown(SHUT_WR) in POSIX", comment on send()), but the older version of the TCP operational semantics doc says that the transition from connected to closed is asynchronous if the connection terminates. So what's the mechanism for waiting for this transition to occur?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TcpSocket::new, bind, send, and data.close() sequence in issue #704, then read the linked wit-0.3.0-draft send() comment and the older TCP operational semantics document. Done means documenting the mechanism, if one exists, for waiting until the socket reaches closed after the stream is closed.

Written by the indexing model from the issue text.

Assessment

Domain
api, networking
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.