Skip to content

Commit

Permalink
Revert "Change behavior of Subscribe to non-blocking. Fix test."
Browse files Browse the repository at this point in the history
This reverts commit 916f968.
  • Loading branch information
tnqn authored and aboch committed May 23, 2024
1 parent 856e190 commit 1e68b27
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 32 deletions.
3 changes: 0 additions & 3 deletions addr_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,6 @@ func addrSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- AddrUpdate, done <-c
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
if cberr != nil {
cberr(fmt.Errorf("Receive failed: %v",
err))
Expand Down
3 changes: 0 additions & 3 deletions link_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2434,9 +2434,6 @@ func linkSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- LinkUpdate, done <-c
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
if cberr != nil {
cberr(fmt.Errorf("Receive failed: %v",
err))
Expand Down
3 changes: 0 additions & 3 deletions neigh_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,6 @@ func neighSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- NeighUpdate, done <
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
if cberr != nil {
cberr(err)
}
Expand Down
10 changes: 0 additions & 10 deletions nl/nl_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,16 +727,6 @@ func Subscribe(protocol int, groups ...uint) (*NetlinkSocket, error) {
if err != nil {
return nil, err
}

// Sometimes (socket_linux.go:SocketGet), Subscribe is used to create a socket
// that subscirbed to no groups. So we don't need to set nonblock there.
if len(groups) > 0 {
if err := unix.SetNonblock(fd, true); err != nil {
unix.Close(fd)
return nil, err
}
}

s := &NetlinkSocket{
fd: int32(fd),
}
Expand Down
3 changes: 0 additions & 3 deletions proc_event_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ func ProcEventMonitor(ch chan<- ProcEvent, done <-chan struct{}, errorChan chan<
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
errorChan <- err
return
}
Expand Down
3 changes: 0 additions & 3 deletions route_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1657,9 +1657,6 @@ func routeSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- RouteUpdate, done <
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
if cberr != nil {
cberr(fmt.Errorf("Receive failed: %v",
err))
Expand Down
3 changes: 0 additions & 3 deletions socket_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,6 @@ loop:
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
return err
}
if from.Pid != nl.PidKernel {
Expand Down
4 changes: 0 additions & 4 deletions xfrm_monitor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package netlink

import (
"fmt"
"syscall"

"github.com/vishvananda/netlink/nl"
"github.com/vishvananda/netns"
Expand Down Expand Up @@ -57,9 +56,6 @@ func XfrmMonitor(ch chan<- XfrmMsg, done <-chan struct{}, errorChan chan<- error
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
errorChan <- err
return
}
Expand Down

0 comments on commit 1e68b27

Please sign in to comment.