From: Skip Tavakkolian <skip.tavakkolian@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] adding TCP half-duplex close
Date: Sat, 4 Feb 2017 01:56:23 +0000 [thread overview]
Message-ID: <CAJSxfmJKdKF7ntmHkbeZXya+5kh_biyim7qhVNHkwE7Wm3a=DA@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2017-02-04 1:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-04 1:56 Skip Tavakkolian [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJSxfmJKdKF7ntmHkbeZXya+5kh_biyim7qhVNHkwE7Wm3a=DA@mail.gmail.com' \
--to=skip.tavakkolian@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).