This commit is contained in:
esrrhs 2019-10-25 21:17:47 +08:00
parent f6e315ba37
commit 2fda6b845c

View File

@ -80,16 +80,12 @@ func recvICMP(conn icmp.PacketConn, recv chan<- *Packet) {
n, srcaddr, err := conn.ReadFrom(bytes)
if err != nil {
if neterr, ok := err.(*net.OpError); ok {
if neterr.Timeout() {
// Read timeout
continue
} else {
nerr, ok := err.(net.Error)
if !ok || !nerr.Timeout() {
loggo.Error("Error read icmp message %s", err)
continue
}
}
}
echoId := int(binary.BigEndian.Uint16(bytes[4:6]))
echoSeq := int(binary.BigEndian.Uint16(bytes[6:8]))