lib/beacon: Check FlagRunning (#9051)

This commit is contained in:
bt90 2023-08-22 11:27:43 +02:00 committed by GitHub
parent acd767b30b
commit 3147285c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 3 deletions

View File

@ -52,7 +52,7 @@ func writeBroadcasts(ctx context.Context, inbox <-chan []byte, port int) error {
var dsts []net.IP var dsts []net.IP
for _, intf := range intfs { for _, intf := range intfs {
if intf.Flags&net.FlagBroadcast == 0 { if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagBroadcast == 0 {
continue continue
} }

View File

@ -67,7 +67,7 @@ func writeMulticasts(ctx context.Context, inbox <-chan []byte, addr string) erro
success := 0 success := 0
for _, intf := range intfs { for _, intf := range intfs {
if intf.Flags&net.FlagMulticast == 0 { if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 {
continue continue
} }

View File

@ -98,7 +98,6 @@ func Discover(ctx context.Context, _, timeout time.Duration) []nat.Device {
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
for _, intf := range interfaces { for _, intf := range interfaces {
// Interface flags seem to always be 0 on Windows
if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 { if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 {
continue continue
} }