Comparing version 0.19.0 to 0.20.0
@@ -319,3 +319,3 @@ /* | ||
req.sender.send(buf) | ||
req.sender.send(buf, !packet.confirmable) | ||
}) | ||
@@ -322,0 +322,0 @@ |
@@ -63,2 +63,3 @@ /* | ||
var that = this | ||
, timeout | ||
@@ -68,9 +69,10 @@ this._message = message | ||
if (!avoidBackoff) | ||
this._timer = setTimeout(function() { | ||
var err = new Error('No reply in ' + parameters.exchangeLifetime + 's') | ||
err.retransmitTimeout = parameters.exchangeLifetime; | ||
timeout = avoidBackoff ? parameters.maxRTT : parameters.exchangeLifetime | ||
this._timer = setTimeout(function() { | ||
var err = new Error('No reply in ' + timeout + 's') | ||
err.retransmitTimeout = timeout; | ||
if (!avoidBackoff) | ||
that.emit('error', err) | ||
that.emit('timeout', err) | ||
}, parameters.exchangeLifetime * 1000) | ||
that.emit('timeout', err) | ||
}, timeout * 1000) | ||
} | ||
@@ -77,0 +79,0 @@ |
{ | ||
"name": "coap", | ||
"version": "0.19.0", | ||
"version": "0.20.0", | ||
"description": "A CoAP library for node modelled after 'http'", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -660,17 +660,5 @@ /* | ||
it('should error after ~247 seconds', function (done) { | ||
it('should timeout after ~202 seconds', function (done) { | ||
var req = doReq() | ||
req.on('error', function (err) { | ||
expect(err).to.have.property('message', 'No reply in 247s') | ||
expect(err).to.have.property('retransmitTimeout', 247) | ||
done() | ||
}) | ||
fastForward(1000, 247 * 1000) | ||
}) | ||
it('should timeout after ~247 seconds', function (done) { | ||
var req = doReq() | ||
req.on('error', function () { | ||
@@ -680,11 +668,11 @@ }) | ||
req.on('timeout', function (err) { | ||
expect(err).to.have.property('message', 'No reply in 247s') | ||
expect(err).to.have.property('retransmitTimeout', 247) | ||
expect(err).to.have.property('message', 'No reply in 202s') | ||
expect(err).to.have.property('retransmitTimeout', 202) | ||
done() | ||
}) | ||
fastForward(1000, 247 * 1000) | ||
fastForward(1000, 202 * 1000) | ||
}) | ||
it('should retry four times before erroring', function (done) { | ||
it('should not retry before timeout', function (done) { | ||
var req = doReq() | ||
@@ -697,5 +685,4 @@ , messages = 0 | ||
req.on('error', function (err) { | ||
// original one plus 4 retries | ||
expect(messages).to.eql(5) | ||
req.on('timeout', function (err) { | ||
expect(messages).to.eql(1) | ||
done() | ||
@@ -707,3 +694,3 @@ }) | ||
it('should retry four times before 45s', function (done) { | ||
it('should not retry before 45s', function (done) { | ||
var req = doReq() | ||
@@ -717,4 +704,3 @@ , messages = 0 | ||
setTimeout(function () { | ||
// original one plus 4 retries | ||
expect(messages).to.eql(5) | ||
expect(messages).to.eql(1) | ||
done() | ||
@@ -721,0 +707,0 @@ }, 45 * 1000) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180300
5047