Skip to content

Commit

Permalink
Cannot specify the retries parameter for the Session class as 0, Upda…
Browse files Browse the repository at this point in the history
…te version in package.json to 1.1.11, Update README.md for 1.1.11, Added example program ping-retries-0.js
  • Loading branch information
stephenwvickers committed Aug 12, 2014
1 parent 356fd0f commit e0da26e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ Bug reports should be sent to <stephen.vickers.sv@gmail.com>.
* Echo requests sent by this module are processed like responses when sent to
the `127.0.0.1` and `::1` addresses

## Version 1.1.11 - 12/08/2014

* Cannot specify the `retries` parameter for the `Session` class as `0`
* Added example program `ping-retries-0.js`

# Roadmap

Suggestions and requirements should be sent to <stephen.vickers.sv@gmail.com>.
Expand Down
30 changes: 30 additions & 0 deletions example/ping-retries-0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

var ping = require ("../");

if (process.argv.length < 4) {
console.log ("usage: node ping-retries-0 <target> <timeout>");
process.exit (-1);
}

var target = process.argv[2];

var options = {
retries: 0,
timeout: parseInt(process.argv[3])
};

var session = ping.createSession (options);

session.on ("error", function (error) {
console.trace (error.toString ());
});

session.pingHost (target, function (error, target) {
if (error)
if (error instanceof ping.RequestTimedOutError)
console.log (target + ": Not alive");
else
console.log (target + ": " + error.toString ());
else
console.log (target + ": Alive");
});
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function TimeExceededError (source) {
util.inherits (TimeExceededError, Error);

function Session (options) {
this.retries = (options && options.retries) ? options.retries : 1;
this.retries = (options && options.retries != undefined) ? options.retries : 1;
this.timeout = (options && options.timeout) ? options.timeout : 2000;

this.packetSize = (options && options.packetSize) ? options.packetSize : 16;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "net-ping",
"version": "1.1.10",
"version": "1.1.11",
"description": "Ping and trace route to many hosts at once.",
"main": "index.js",
"directories": {
Expand Down

0 comments on commit e0da26e

Please sign in to comment.