Has anyone looked into implementing this?  Can anyone comment on the

For the curious, this is described here:
Go net package (https://github.com/golang/go/issues/17906).

As I understand it, one would only worry about 'shutdown' if the connection
is in 'Established' state. It is not clear to me what the state should
transition to when the read-end is closed (i.e. shut_rd).  Also, there
doesn't not seem to be consistency between different implementations
(Windows,Linux, *BSD) on what should happen to what's already in the read
queue; should it be allowed to drain to the reader or discarded immediately?

Shutting down the write-end (i.e. 'shut_wr'), should send FIN, and
transition to Finwait1.

I think the correct mechanics to handle this would be to add two new
messages in tcpctl (/sys/src/9/ip/tcp.c). Then, roughly something like this:

case 'shut_rd' :
 if (Etablished) {
  send(RST);  // Windows does this and RFC1122 seems to recommend it. Linux
does not.
  tcb->rcv.blocked = 1;  // all that's needed?
  tcb->rcv.wnd = 0;
  tcpsetstate(????)  // not sure what it should be or should stay

case 'shut_wr':
  if (Established) {

Reply via email to