Skip to content

Commit 1e68b27

Browse files
tnqnaboch
authored andcommitted
Revert "Change behavior of Subscribe to non-blocking. Fix test."
This reverts commit 916f968.
1 parent 856e190 commit 1e68b27

8 files changed

+0
-32
lines changed

addr_linux.go

-3
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,6 @@ func addrSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- AddrUpdate, done <-c
367367
for {
368368
msgs, from, err := s.Receive()
369369
if err != nil {
370-
if err == syscall.EAGAIN {
371-
continue
372-
}
373370
if cberr != nil {
374371
cberr(fmt.Errorf("Receive failed: %v",
375372
err))

link_linux.go

-3
Original file line numberDiff line numberDiff line change
@@ -2434,9 +2434,6 @@ func linkSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- LinkUpdate, done <-c
24342434
for {
24352435
msgs, from, err := s.Receive()
24362436
if err != nil {
2437-
if err == syscall.EAGAIN {
2438-
continue
2439-
}
24402437
if cberr != nil {
24412438
cberr(fmt.Errorf("Receive failed: %v",
24422439
err))

neigh_linux.go

-3
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,6 @@ func neighSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- NeighUpdate, done <
416416
for {
417417
msgs, from, err := s.Receive()
418418
if err != nil {
419-
if err == syscall.EAGAIN {
420-
continue
421-
}
422419
if cberr != nil {
423420
cberr(err)
424421
}

nl/nl_linux.go

-10
Original file line numberDiff line numberDiff line change
@@ -727,16 +727,6 @@ func Subscribe(protocol int, groups ...uint) (*NetlinkSocket, error) {
727727
if err != nil {
728728
return nil, err
729729
}
730-
731-
// Sometimes (socket_linux.go:SocketGet), Subscribe is used to create a socket
732-
// that subscirbed to no groups. So we don't need to set nonblock there.
733-
if len(groups) > 0 {
734-
if err := unix.SetNonblock(fd, true); err != nil {
735-
unix.Close(fd)
736-
return nil, err
737-
}
738-
}
739-
740730
s := &NetlinkSocket{
741731
fd: int32(fd),
742732
}

proc_event_linux.go

-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ func ProcEventMonitor(ch chan<- ProcEvent, done <-chan struct{}, errorChan chan<
148148
for {
149149
msgs, from, err := s.Receive()
150150
if err != nil {
151-
if err == syscall.EAGAIN {
152-
continue
153-
}
154151
errorChan <- err
155152
return
156153
}

route_linux.go

-3
Original file line numberDiff line numberDiff line change
@@ -1657,9 +1657,6 @@ func routeSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- RouteUpdate, done <
16571657
for {
16581658
msgs, from, err := s.Receive()
16591659
if err != nil {
1660-
if err == syscall.EAGAIN {
1661-
continue
1662-
}
16631660
if cberr != nil {
16641661
cberr(fmt.Errorf("Receive failed: %v",
16651662
err))

socket_linux.go

-3
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,6 @@ loop:
499499
for {
500500
msgs, from, err := s.Receive()
501501
if err != nil {
502-
if err == syscall.EAGAIN {
503-
continue
504-
}
505502
return err
506503
}
507504
if from.Pid != nl.PidKernel {

xfrm_monitor_linux.go

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package netlink
22

33
import (
44
"fmt"
5-
"syscall"
65

76
"github.com/vishvananda/netlink/nl"
87
"github.com/vishvananda/netns"
@@ -57,9 +56,6 @@ func XfrmMonitor(ch chan<- XfrmMsg, done <-chan struct{}, errorChan chan<- error
5756
for {
5857
msgs, from, err := s.Receive()
5958
if err != nil {
60-
if err == syscall.EAGAIN {
61-
continue
62-
}
6359
errorChan <- err
6460
return
6561
}

0 commit comments

Comments
 (0)