New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-mbed-dtls

Package Overview
Dependencies
Maintainers
5
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-mbed-dtls - npm Package Compare versions

Comparing version 2.6.2-beta.1 to 2.6.2-beta.2

2

package.json
{
"name": "node-mbed-dtls",
"version": "2.6.2-beta.1",
"version": "2.6.2-beta.2",
"description": "Node mbed DTLS",

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

@@ -97,16 +97,12 @@ 'use strict';

const lookedUp = this.emit('lookupKey', deviceId, (err, oldRinfo) => {
// For an IpChange message to be considered successful it has to SUCCESSFULLY be 'received' by its client
if (!err && oldRinfo) {
const oldKey = `${oldRinfo.address}:${oldRinfo.port}`;
let client = this.sockets[oldKey];
if (rinfo.address === oldRinfo.address && rinfo.port === oldRinfo.port) {
// The IP and port have not changed.
// The device just thought they might have.
// Strip the extra DTLS option and handle the message
// the extra DTLS option has been stripped already, handle the message as normal
// like normal using the client we already had.
this._debug(`handleIpChange: ignoring ip change because address did not change ip=${key}, deviceID=${deviceId}`);
this._onMessage(msg, rinfo, (client, received) => {
// 'received' is true or false based on whether the message is pushed into the stream
if (!received) {
this._debug(`handleIpChange: message NOT successfully received on same ip address ip=${key}, deviceID=${deviceId}`);
this.emit('forceDeviceRehandshake', rinfo, deviceId);

@@ -119,2 +115,3 @@ }

// The IP and/or port have changed
// There should NOT already exist a socket on the new IP and port.

@@ -125,6 +122,6 @@ if (this.sockets[key]) {

// If it matches, then we continue with _attemptResume below.
// If not, log something's wrong.
// If not, log something's wrong and bail.
this.emit('lookupSource', key, (err, session) => {
if(session.deviceId && session.deviceId != deviceId){
this.debug(`handleIpChange: received conflict with an existing socket ip=${key} deviceID=${deviceId}, sessionDeviceId=${session.deviceId}`);
if (session && session.deviceId && session.deviceId !== deviceId) {
this._debug(`handleIpChange: received conflict with an existing socket ip=${key} deviceID=${deviceId}, sessionDeviceId=${session.deviceId}`);
return;

@@ -135,6 +132,8 @@ }

// This creates a new client using the new address and port and 'attempts' session resumption
// If the message is 'delivered' aka 'good crypto' then we update our session information in redis for future incomming messages
this.sockets[key] = client = this._createSocket(rinfo, key);
// Resume session using from oldKey
// This creates a new client using the new address and port and attempts session resumption
// If the message is 'received' then we update our session information in redis for future incomming messages
const client = this._createSocket(rinfo, key);
const oldKey = `${oldRinfo.address}:${oldRinfo.port}`;
// Resume session using oldKey
this._debug(`handleIpChange: attempting session resumption on newip=${key}, oldip=${oldKey}`);
this._attemptResume(client, msg, oldKey, (client, received) => {

@@ -145,4 +144,5 @@ if (received) {

} else {
//If the message wasn't able to be recieved on the new address and port OR the redis session key has been deleted
this._debug(`handleIpChange: message NOT received on new ip address during session resumption toip=${key}, deviceID=${deviceId} forcing handshake`);
// If the message wasn't able to be recieved on the new address and port
// OR the redis session key has been deleted
this._debug(`handleIpChange: message NOT received on new ip address during session resumption toip=${key}, deviceID=${deviceId}`);
this.emit('forceDeviceRehandshake', rinfo, deviceId);

@@ -157,3 +157,3 @@ }

// mbedTLS to fail a socket read and initiate a handshake.
this._debug(`Device in 'move session' lock state attempting to force it to re-handshake deviceID=${deviceId}`);
this._debug(`handleIpChange: deviceId key doesnt exist in redis or there was a redis error deviceID=${deviceId}`);
this.emit('forceDeviceRehandshake', rinfo, deviceId);

@@ -160,0 +160,0 @@ }

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