node-opcua-secure-channel
Advanced tools
Comparing version 0.4.0 to 0.4.2
{ | ||
"name": "node-opcua-secure-channel", | ||
"version": "0.4.0", | ||
"version": "0.4.2", | ||
"description": "pure nodejs OPCUA SDK - module -secure-channel", | ||
@@ -13,29 +13,29 @@ "main": "index.js", | ||
"node-opcua-assert": "^0.4.0", | ||
"node-opcua-basic-types": "^0.4.0", | ||
"node-opcua-binary-stream": "^0.4.0", | ||
"node-opcua-chunkmanager": "^0.4.0", | ||
"node-opcua-basic-types": "^0.4.2", | ||
"node-opcua-binary-stream": "^0.4.2", | ||
"node-opcua-chunkmanager": "^0.4.2", | ||
"node-opcua-crypto": "0.0.18", | ||
"node-opcua-debug": "^0.4.0", | ||
"node-opcua-enum": "^0.4.0", | ||
"node-opcua-factory": "^0.4.0", | ||
"node-opcua-object-registry": "^0.4.0", | ||
"node-opcua-packet-analyzer": "^0.4.0", | ||
"node-opcua-service-secure-channel": "^0.4.0", | ||
"node-opcua-status-code": "^0.4.0", | ||
"node-opcua-transport": "^0.4.0", | ||
"node-opcua-utils": "^0.4.0", | ||
"underscore": "^1.9.0" | ||
"node-opcua-debug": "^0.4.2", | ||
"node-opcua-enum": "^0.4.2", | ||
"node-opcua-factory": "^0.4.2", | ||
"node-opcua-object-registry": "^0.4.2", | ||
"node-opcua-packet-analyzer": "^0.4.2", | ||
"node-opcua-service-secure-channel": "^0.4.2", | ||
"node-opcua-status-code": "^0.4.2", | ||
"node-opcua-transport": "^0.4.2", | ||
"node-opcua-utils": "^0.4.2", | ||
"underscore": "^1.9.1" | ||
}, | ||
"devDependencies": { | ||
"async": "^2.6.1", | ||
"node-opcua-buffer-utils": "^0.4.0", | ||
"node-opcua-leak-detector": "^0.4.0", | ||
"node-opcua-service-browse": "^0.4.0", | ||
"node-opcua-service-endpoints": "^0.4.0", | ||
"node-opcua-service-read": "^0.4.0", | ||
"node-opcua-service-session": "^0.4.0", | ||
"node-opcua-test-fixtures": "^0.4.0", | ||
"node-opcua-test-helpers": "^0.4.0", | ||
"node-opcua-buffer-utils": "^0.4.2", | ||
"node-opcua-leak-detector": "^0.4.2", | ||
"node-opcua-service-browse": "^0.4.2", | ||
"node-opcua-service-endpoints": "^0.4.2", | ||
"node-opcua-service-read": "^0.4.2", | ||
"node-opcua-service-session": "^0.4.2", | ||
"node-opcua-test-fixtures": "^0.4.2", | ||
"node-opcua-test-helpers": "^0.4.2", | ||
"should": "13.2.1", | ||
"sinon": "^5.0.10", | ||
"sinon": "^6.0.1", | ||
"sprintf": "^0.1.5" | ||
@@ -42,0 +42,0 @@ }, |
@@ -1019,6 +1019,4 @@ "use strict"; | ||
console.log(" Timeout .... waiting for response for ", requestMessage.constructor.name, requestMessage.requestHeader.toString()); | ||
hasTimedOut = true; | ||
modified_callback(new Error("Transaction has timed out ( timeout = " + timeout + " ms)"), null); | ||
self._timedout_request_count += 1; | ||
@@ -1035,3 +1033,3 @@ /** | ||
const transaction_data = {msgType: msgType, request: requestMessage, callback: modified_callback}; | ||
const transaction_data = {timerId: timerId, msgType: msgType, request: requestMessage, callback: modified_callback}; | ||
@@ -1060,3 +1058,3 @@ //xx self._pending_callback = callback; | ||
transaction_data.callback(new Error("Client not connected")); | ||
}, 1000); | ||
}, 100); | ||
return; | ||
@@ -1282,2 +1280,28 @@ } | ||
ClientSecureChannelLayer.prototype.getDisplayName = function() { | ||
const self = this; | ||
if (!self.parent) { return ""; } | ||
return "" + (self.parent.applicationName ?self.parent.applicationName + " " : "" ) + self.parent.clientName; | ||
}; | ||
ClientSecureChannelLayer.prototype.cancelPendingTransactions = function(callback) { | ||
const self = this; | ||
assert(_.isFunction(callback), "expecting a callback function, but got " + callback); | ||
// istanbul ignore next | ||
if (doDebug) { | ||
debugLog(" PENDING TRANSACTION = ", | ||
self.getDisplayName(), | ||
Object.keys(self._request_data) | ||
.map(k=>self._request_data[k].request.constructor.name).join("")); | ||
} | ||
for ( let key of Object.keys(self._request_data)) { | ||
// kill timer id | ||
const transaction = self._request_data[key]; | ||
if (transaction.callback) { | ||
transaction.callback(new Error("Transaction has been canceled because client channel is beeing closed")); | ||
} | ||
} | ||
setImmediate(callback); | ||
}; | ||
/** | ||
@@ -1295,32 +1319,36 @@ * Close a client SecureChannel ,by sending a CloseSecureChannelRequest to the server. | ||
// what the specs says: | ||
// -------------------- | ||
// The client closes the connection by sending a CloseSecureChannelRequest and closing the | ||
// socket gracefully. When the server receives this message it shall release all resources | ||
// allocated for the channel. The server does not send a CloseSecureChannel response | ||
// | ||
// ( Note : some servers do send a CloseSecureChannel though !) | ||
const self = this; | ||
assert(_.isFunction(callback), "expecting a callback function, but got " + callback); | ||
// there is no need for the security token expiration event to trigger anymore | ||
_cancel_security_token_watchdog.call(self); | ||
// cancel any pending transaction | ||
self.cancelPendingTransactions(function(err){ | ||
debugLog("Sending CloseSecureChannelRequest to server"); | ||
//xx console.log("xxxx Sending CloseSecureChannelRequest to server"); | ||
const request = new CloseSecureChannelRequest(); | ||
// what the specs says: | ||
// -------------------- | ||
// The client closes the connection by sending a CloseSecureChannelRequest and closing the | ||
// socket gracefully. When the server receives this message it shall release all resources | ||
// allocated for the channel. The server does not send a CloseSecureChannel response | ||
// | ||
// ( Note : some servers do send a CloseSecureChannel though !) | ||
self.__in_normal_close_operation = true; | ||
// there is no need for the security token expiration event to trigger anymore | ||
_cancel_security_token_watchdog.call(self); | ||
if (!self._transport || self._transport.__disconnecting__) { | ||
self.dispose(); | ||
return callback(new Error("Transport disconnected")); | ||
} | ||
debugLog("Sending CloseSecureChannelRequest to server"); | ||
//xx console.log("xxxx Sending CloseSecureChannelRequest to server"); | ||
const request = new CloseSecureChannelRequest(); | ||
self._performMessageTransaction("CLO", request, function () { | ||
///xx self._transport.disconnect(function() { | ||
self.dispose(); | ||
callback(); | ||
//xxx }); | ||
self.__in_normal_close_operation = true; | ||
if (!self._transport || self._transport.__disconnecting__) { | ||
self.dispose(); | ||
return callback(new Error("Transport disconnected")); | ||
} | ||
self._performMessageTransaction("CLO", request, function () { | ||
///xx self._transport.disconnect(function() { | ||
self.dispose(); | ||
callback(); | ||
//xxx }); | ||
}); | ||
}); | ||
@@ -1327,0 +1355,0 @@ }; |
@@ -76,2 +76,4 @@ "use strict"; | ||
self.__hash = getNextChannelId(); | ||
self.parent = options.parent; | ||
@@ -88,3 +90,3 @@ | ||
// uninitialized securityToken | ||
self.securityToken = { secureChannelId: 0, tokenId: 0 }; | ||
self.securityToken = { secureChannelId: self.__hash , tokenId: 0 }; | ||
@@ -125,3 +127,2 @@ self.serverNonce = null; // will be created when needed | ||
self.secureChannelId = getNextChannelId(); | ||
@@ -283,3 +284,5 @@ if (doPerfMonitoring) { | ||
}); | ||
self.secureChannelId = self.__hash; | ||
assert(!securityToken.expired); | ||
@@ -876,4 +879,10 @@ assert(_.isFinite(securityToken.revisedLifeTime)); | ||
ServerSecureChannelLayer.prototype._abort = function() { | ||
const self = this; | ||
debugLog("ServerSecureChannelLayer#_abort"); | ||
if (self._abort_has_been_called) { | ||
debugLog("Warning => ServerSecureChannelLayer#_abort has already been called"); | ||
return; | ||
@@ -897,2 +906,3 @@ } | ||
self.emit("abort"); | ||
debugLog("ServerSecureChannelLayer emitted abort event"); | ||
}; | ||
@@ -1254,5 +1264,8 @@ | ||
const self = this; | ||
return self.securityToken.secureChannelId.toString(); | ||
return self.__hash; | ||
//xx assert( self.securityToken.secureChannelId !== 0,"cannot be null"); | ||
//xx return self.securityToken.secureChannelId.toString(); | ||
}); | ||
exports.ServerSecureChannelLayer = ServerSecureChannelLayer; |
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
243628
4855
Updatednode-opcua-debug@^0.4.2
Updatednode-opcua-enum@^0.4.2
Updatednode-opcua-factory@^0.4.2
Updatednode-opcua-transport@^0.4.2
Updatednode-opcua-utils@^0.4.2
Updatedunderscore@^1.9.1