Comparing version 0.4.1 to 0.4.2
@@ -170,8 +170,6 @@ const bl = require('bl') | ||
Agent.prototype._nextMessageId = function nextToken() { | ||
var messageId = this._lastMessageId++ | ||
if (++this._lastMessageId === maxMessageId) | ||
this._lastMessageId = 1 | ||
if (this._lastMessageId === maxMessageId) | ||
this._lastMessageId = -1 | ||
return messageId; | ||
return this._lastMessageId | ||
} | ||
@@ -178,0 +176,0 @@ |
{ | ||
"name": "coap", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A CoAP library for node modelled after 'http'", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -50,2 +50,23 @@ | ||
it('should calculate the messageIds module 16 bytes', function(done) { | ||
var total = 2 | ||
doReq() | ||
agent._lastMessageId = Math.pow(2, 16) - 1 | ||
doReq() | ||
server.on('message', function(msg, rsinfo) { | ||
console.log(parse(msg)) | ||
if (total === 2) { | ||
// nothing to do | ||
} else if (total === 1) { | ||
expect(parse(msg).messageId).to.eql(1) | ||
done() | ||
} | ||
total-- | ||
}) | ||
}) | ||
it('should differentiate two requests with different tokens', function(done) { | ||
@@ -52,0 +73,0 @@ var firstToken |
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
92145
2442