summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/adapters/gonet/gonet.go
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2021-03-24 12:08:24 -0700
committergVisor bot <gvisor-bot@google.com>2021-03-24 12:11:44 -0700
commite7ca2a51a89a8ff2c9f5adfdfa5b51be1b3faeb3 (patch)
tree1abf748d2755526978f560abb67f29b6f83496c7 /pkg/tcpip/adapters/gonet/gonet.go
parent72ff6a1cac6ab35132b4f79b1149590e103e5291 (diff)
Add POLLRDNORM/POLLWRNORM support.
On Linux these are meant to be equivalent to POLLIN/POLLOUT. Rather than hack these on in sys_poll etc it felt cleaner to just cleanup the call sites to notify for both events. This is what linux does as well. Fixes #5544 PiperOrigin-RevId: 364859977
Diffstat (limited to 'pkg/tcpip/adapters/gonet/gonet.go')
-rw-r--r--pkg/tcpip/adapters/gonet/gonet.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/tcpip/adapters/gonet/gonet.go b/pkg/tcpip/adapters/gonet/gonet.go
index c188aaa18..010e2e833 100644
--- a/pkg/tcpip/adapters/gonet/gonet.go
+++ b/pkg/tcpip/adapters/gonet/gonet.go
@@ -251,7 +251,7 @@ func (l *TCPListener) Accept() (net.Conn, error) {
if _, ok := err.(*tcpip.ErrWouldBlock); ok {
// Create wait queue entry that notifies a channel.
waitEntry, notifyCh := waiter.NewChannelEntry(nil)
- l.wq.EventRegister(&waitEntry, waiter.EventIn)
+ l.wq.EventRegister(&waitEntry, waiter.ReadableEvents)
defer l.wq.EventUnregister(&waitEntry)
for {
@@ -301,7 +301,7 @@ func commonRead(b []byte, ep tcpip.Endpoint, wq *waiter.Queue, deadline <-chan s
if _, ok := err.(*tcpip.ErrWouldBlock); ok {
// Create wait queue entry that notifies a channel.
waitEntry, notifyCh := waiter.NewChannelEntry(nil)
- wq.EventRegister(&waitEntry, waiter.EventIn)
+ wq.EventRegister(&waitEntry, waiter.ReadableEvents)
defer wq.EventUnregister(&waitEntry)
for {
res, err = ep.Read(&w, opts)
@@ -382,7 +382,7 @@ func (c *TCPConn) Write(b []byte) (int, error) {
if ch == nil {
entry, ch = waiter.NewChannelEntry(nil)
- c.wq.EventRegister(&entry, waiter.EventOut)
+ c.wq.EventRegister(&entry, waiter.WritableEvents)
defer c.wq.EventUnregister(&entry)
} else {
// Don't wait immediately after registration in case more data
@@ -485,7 +485,7 @@ func DialContextTCP(ctx context.Context, s *stack.Stack, addr tcpip.FullAddress,
//
// We do this unconditionally as Connect will always return an error.
waitEntry, notifyCh := waiter.NewChannelEntry(nil)
- wq.EventRegister(&waitEntry, waiter.EventOut)
+ wq.EventRegister(&waitEntry, waiter.WritableEvents)
defer wq.EventUnregister(&waitEntry)
select {
@@ -652,7 +652,7 @@ func (c *UDPConn) WriteTo(b []byte, addr net.Addr) (int, error) {
if _, ok := err.(*tcpip.ErrWouldBlock); ok {
// Create wait queue entry that notifies a channel.
waitEntry, notifyCh := waiter.NewChannelEntry(nil)
- c.wq.EventRegister(&waitEntry, waiter.EventOut)
+ c.wq.EventRegister(&waitEntry, waiter.WritableEvents)
defer c.wq.EventUnregister(&waitEntry)
for {
select {