Skip to content

Commit

Permalink
Check more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Maartje Eyskens committed Aug 24, 2018
1 parent 8910bb0 commit ed39df7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions imcp/icmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ func SendDiscoverIMCP(localAddr string, dst net.Addr, ttl, pid int, timeout time
return hop, err
}
defer c.Close()
c.IPv4PacketConn().SetTTL(ttl)

err = c.IPv4PacketConn().SetTTL(ttl)
if err != nil {
return hop, err
}
err = c.SetDeadline(time.Now().Add(timeout))
if err != nil {
return hop, err
Expand Down Expand Up @@ -69,7 +73,10 @@ func SendIMCP(localAddr string, dst net.Addr, target string, ttl, pid int, timeo
return hop, err
}
defer c.Close()
c.IPv4PacketConn().SetTTL(ttl)
err = c.IPv4PacketConn().SetTTL(ttl)
if err != nil {
return hop, err
}
err = c.SetDeadline(time.Now().Add(timeout))
if err != nil {
return hop, err
Expand Down

0 comments on commit ed39df7

Please sign in to comment.