Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
koron committed Oct 21, 2023
1 parent 0bdcf1e commit 5f9e3fb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/multicast/multicast.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ func joinGroupIPv4(conn *net.UDPConn, ifplist []*net.Interface, gaddr net.Addr)

// add interfaces to multicast group.
joined := 0
for _, ifp := range ifplist {
if err := wrap.JoinGroup(ifp, gaddr); err != nil {
ssdplog.Printf("failed to join group %s on %s: %s", gaddr.String(), ifp.Name, err)
for _, ifi := range ifplist {
if err := wrap.JoinGroup(ifi, gaddr); err != nil {
ssdplog.Printf("failed to join group %s on %s: %s", gaddr.String(), ifi.Name, err)
continue
}
joined++
ssdplog.Printf("joined group %s on %s (#%d)", gaddr.String(), ifp.Name, ifp.Index)
ssdplog.Printf("joined group %s on %s (#%d)", gaddr.String(), ifi.Name, ifi.Index)
}
if joined == 0 {
return nil, errors.New("no interfaces had joined to group")
Expand Down Expand Up @@ -150,8 +150,9 @@ func (mc *Conn) WriteTo(dataProv DataProvider, to net.Addr) (int, error) {
}
// Send a multicast message to all interfaces (iflist).
sum := 0
for _, ifp := range mc.ifps {
n, err := mc.writeToIfi(dataProv, to, ifp)
for _, ifi := range mc.ifps {
ssdplog.Printf("WriteTo: ifi=%+v", ifi)
n, err := mc.writeToIfi(dataProv, to, ifi)
if err != nil {
return 0, err
}
Expand Down

0 comments on commit 5f9e3fb

Please sign in to comment.