diff --git a/README.md b/README.md index 7f2d197..0d1ec4c 100644 --- a/README.md +++ b/README.md @@ -442,6 +442,11 @@ Bug reports should be sent to . * Use `raw.Socket.writeChecksum()` instead of manually rendering checksums +## Version 1.1.10 - 02/04/2014 + + * Echo requests sent by this module are processed like responses when sent to + the `127.0.0.1` and `::1` addresses + # Roadmap Suggestions and requirements should be sent to . diff --git a/index.js b/index.js index 16d6ebc..5771a5f 100644 --- a/index.js +++ b/index.js @@ -255,6 +255,21 @@ Session.prototype.onSocketMessage = function (buffer, source) { var req = this.fromBuffer (buffer); if (req) { + /** + ** If we ping'd ourself (i.e. 127.0.0.1 or ::1) then it is likely we + ** will receive the echo request in addition to any corresponding echo + ** responses. We discard the request packets here so that we don't + ** delete the request from the from the request queue since we haven't + ** actually received a response yet. + **/ + if (this.addressFamily == raw.AddressFamily.IPv6) { + if (req.type == 128) + return; + } else { + if (req.type == 8) + return; + } + this.reqRemove (req.id); if (this.addressFamily == raw.AddressFamily.IPv6) { diff --git a/package.json b/package.json index f49a5bf..153175e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "net-ping", - "version": "1.1.9", + "version": "1.1.10", "description": "Ping and trace route to many hosts at once.", "main": "index.js", "directories": {