9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] adding TCP half-duplex close
@ 2017-02-04  1:56 Skip Tavakkolian
  2017-02-04  6:29 ` Bakul Shah
  2017-02-04  9:58 ` Charles Forsyth
  0 siblings, 2 replies; 16+ messages in thread
From: Skip Tavakkolian @ 2017-02-04  1:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

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

For the curious, this is described here:
https://tools.ietf.org/html/rfc1122#page-87
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) {
  qhangup(rq);
  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
Established?
}

case 'shut_wr':
  if (Established) {
    qhangup(wq);
    send(FIN)
    tcpsetstate(Finwait_1)
  }

[-- Attachment #2: Type: text/html, Size: 2398 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-02-12  3:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-04  1:56 [9fans] adding TCP half-duplex close Skip Tavakkolian
2017-02-04  6:29 ` Bakul Shah
2017-02-05  4:24   ` Skip Tavakkolian
2017-02-04  9:58 ` Charles Forsyth
2017-02-04 10:11   ` Charles Forsyth
2017-02-04 10:13     ` Charles Forsyth
2017-02-05  4:39       ` Skip Tavakkolian
2017-02-05  5:23         ` Bakul Shah
2017-02-05 15:51           ` Charles Forsyth
2017-02-05 15:54             ` Charles Forsyth
2017-02-05 18:13               ` Bakul Shah
2017-02-05 21:48                 ` Charles Forsyth
2017-02-10  8:49                   ` Skip Tavakkolian
2017-02-12  3:28                     ` Skip Tavakkolian
2017-02-05  7:54         ` Fran. J Ballesteros
2017-02-05  4:16   ` Skip Tavakkolian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).