]> Cypherpunks repositories - gostls13.git/commit
net: always wake up the readers on close on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Tue, 18 Oct 2016 13:21:46 +0000 (15:21 +0200)
committerDavid du Colombier <0intro@gmail.com>
Tue, 18 Oct 2016 13:27:09 +0000 (13:27 +0000)
commit0c12bdf73b1cf60ceb45f2a302cddba17e86a503
tree66b2b1ca5a48e5174e6d53ed6cda902be9c64a56
parentc1a1328c5f004c62b8c08faf0d0d2845e0be5d37
net: always wake up the readers on close on Plan 9

Previously, in acceptPlan9 we set netFD.ctl to the listener's
/net/tcp/*/listen file instead of the accepted connection's
/net/tcp/*/ctl file.

In netFD.Read, we write "close" to netFD.ctl to close the
connection and wake up the readers. However, in the
case of an accepted connection, we got the error
"write /net/tcp/*/listen: inappropriate use of fd"
because the /net/tcp/*/listen doesn't handle the "close" message.

In this case, the connection wasn't closed and the readers
weren't awake.

We modified the netFD structure so that netFD.ctl represents
the accepted connection and netFD.listen represents the
listener.

Change-Id: Ie38c7dbaeaf77fe9ff7da293f09e86d1a01b3e1e
Reviewed-on: https://go-review.googlesource.com/31390
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/fd_plan9.go
src/net/file_plan9.go
src/net/ipsock_plan9.go