diff --git a/monitor_linux.go b/monitor_linux.go index e92f469..bd1f4e3 100644 --- a/monitor_linux.go +++ b/monitor_linux.go @@ -32,8 +32,8 @@ var ErrNetlinkBanned = E.New( func NewNetworkUpdateMonitor(logger logger.Logger) (NetworkUpdateMonitor, error) { monitor := &networkUpdateMonitor{ - routeUpdate: make(chan netlink.RouteUpdate, 2), - linkUpdate: make(chan netlink.LinkUpdate, 2), + routeUpdate: make(chan netlink.RouteUpdate, 100), + linkUpdate: make(chan netlink.LinkUpdate, 100), close: make(chan struct{}), logger: logger, } @@ -78,6 +78,15 @@ func (m *networkUpdateMonitor) loopUpdate() { case <-m.routeUpdate: case <-m.linkUpdate: } + drain: + for { + select { + case <-m.routeUpdate: + case <-m.linkUpdate: + default: + break drain + } + } m.emit() select { case <-m.close: