Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coap

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coap - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0

test/share-socket.js

4

index.js

@@ -33,5 +33,5 @@ /*

else if (ipv6)
agent = globalAgentV6
agent = exports.globalAgentIPv6
else
agent = globalAgent
agent = exports.globalAgent

@@ -38,0 +38,0 @@ return agent.request(url)

@@ -47,5 +47,9 @@ /*

if (opts.socket) {
delete opts.port
}
this._opts = opts
this._init()
this._init(opts.socket)
}

@@ -55,8 +59,10 @@

Agent.prototype._init = function initSock() {
if (this._sock)
Agent.prototype._init = function initSock(socket) {
if (this._sock) {
return
}
var that = this
this._sock = dgram.createSocket(this._opts.type, function(msg, rsinfo) {
this._sock = socket || dgram.createSocket(this._opts.type)
this._sock.on('message', function(msg, rsinfo) {
var packet

@@ -75,2 +81,7 @@ , message

if (packet.code[0] === '0' && packet.code !== '0.00') {
// ignore this packet since it's not a response.
return
}
outSocket = that._sock.address();

@@ -117,2 +128,5 @@ that._handle(msg, rsinfo, outSocket)

if (this._opts.socket)
return
this._sock.close()

@@ -119,0 +133,0 @@ this._sock = null

@@ -290,2 +290,12 @@ /*

if (packet.code[0] !== '0') {
// According to RFC7252 Section 4.2 receiving a confirmable messages
// that can't be processed, should be rejected by ignoring it AND
// sending a reset. In this case confirmable response message would
// be silently ignored, which is not exactly as stated in the standard.
// However, sending a reset would interfere with a coap client which is
// re-using a socket (see pull-request #131).
return
}
var sock = this._sock

@@ -292,0 +302,0 @@ , lru = this._lru

{
"name": "coap",
"version": "0.20.0",
"version": "0.21.0",
"description": "A CoAP library for node modelled after 'http'",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -497,2 +497,4 @@ node-coap

* `socket`: use existing socket instead of creating a new one.
-------------------------------------------------------

@@ -499,0 +501,0 @@ <a name="globalAgent"></a>

@@ -84,2 +84,3 @@ /*

req.once('error', function () {
coap.globalAgent.abort(req)
done()

@@ -537,2 +538,3 @@ })

messageId: packet.messageId
, code: '2.05'
, token: packet.token

@@ -595,2 +597,3 @@ , options: [{

messageId: packet.messageId
, code: '2.05'
, token: packet.token

@@ -622,2 +625,3 @@ , options: [{

messageId: packet.messageId
, code: '2.05'
, token: packet.token

@@ -624,0 +628,0 @@ , options: []

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc