node-opcua-client 2.104.0 → 2.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +0 -1
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +4 -3
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -1
- package/dist/client_session_keepalive_manager.js +0 -1
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/private/client_base_impl.js +4 -5
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_session_impl.js +3 -3
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js +28 -18
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/reconnection.js +1 -2
- package/dist/reconnection.js.map +1 -1
- package/package.json +43 -43
- package/source/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.ts +1 -5
- package/source/alarms_and_conditions/client_alarm_tools_dump_event.ts +6 -3
- package/source/client_session_keepalive_manager.ts +0 -1
- package/source/private/client_base_impl.ts +4 -5
- package/source/private/client_session_impl.ts +21 -22
- package/source/private/opcua_client_impl.ts +39 -31
- package/source/reconnection.ts +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.105.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module client",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf node_modules dist *.tsbuildinfo certificates",
|
|
@@ -17,54 +17,54 @@
|
|
|
17
17
|
"@types/async": "^3.2.20",
|
|
18
18
|
"async": "^3.2.4",
|
|
19
19
|
"chalk": "4.1.2",
|
|
20
|
-
"node-opcua-assert": "2.
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
-
"node-opcua-buffer-utils": "2.
|
|
23
|
-
"node-opcua-certificate-manager": "2.
|
|
24
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
25
|
-
"node-opcua-common": "2.
|
|
20
|
+
"node-opcua-assert": "2.105.0",
|
|
21
|
+
"node-opcua-basic-types": "2.105.0",
|
|
22
|
+
"node-opcua-buffer-utils": "2.105.0",
|
|
23
|
+
"node-opcua-certificate-manager": "2.105.0",
|
|
24
|
+
"node-opcua-client-dynamic-extension-object": "2.105.0",
|
|
25
|
+
"node-opcua-common": "2.105.0",
|
|
26
26
|
"node-opcua-constants": "2.98.1",
|
|
27
|
-
"node-opcua-crypto": "3.0.
|
|
28
|
-
"node-opcua-data-model": "2.
|
|
29
|
-
"node-opcua-data-value": "2.
|
|
30
|
-
"node-opcua-date-time": "2.
|
|
31
|
-
"node-opcua-debug": "2.
|
|
32
|
-
"node-opcua-extension-object": "2.
|
|
33
|
-
"node-opcua-hostname": "2.
|
|
34
|
-
"node-opcua-nodeid": "2.
|
|
35
|
-
"node-opcua-object-registry": "2.
|
|
36
|
-
"node-opcua-pki": "4.2.
|
|
37
|
-
"node-opcua-pseudo-session": "2.
|
|
38
|
-
"node-opcua-schemas": "2.
|
|
39
|
-
"node-opcua-secure-channel": "2.
|
|
40
|
-
"node-opcua-service-browse": "2.
|
|
41
|
-
"node-opcua-service-call": "2.
|
|
42
|
-
"node-opcua-service-discovery": "2.
|
|
43
|
-
"node-opcua-service-endpoints": "2.
|
|
44
|
-
"node-opcua-service-filter": "2.
|
|
45
|
-
"node-opcua-service-history": "2.
|
|
46
|
-
"node-opcua-service-query": "2.
|
|
47
|
-
"node-opcua-service-read": "2.
|
|
48
|
-
"node-opcua-service-register-node": "2.
|
|
49
|
-
"node-opcua-service-secure-channel": "2.
|
|
50
|
-
"node-opcua-service-session": "2.
|
|
51
|
-
"node-opcua-service-subscription": "2.
|
|
52
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
53
|
-
"node-opcua-service-write": "2.
|
|
54
|
-
"node-opcua-status-code": "2.
|
|
55
|
-
"node-opcua-types": "2.
|
|
56
|
-
"node-opcua-utils": "2.
|
|
57
|
-
"node-opcua-variant": "2.
|
|
27
|
+
"node-opcua-crypto": "3.0.6",
|
|
28
|
+
"node-opcua-data-model": "2.105.0",
|
|
29
|
+
"node-opcua-data-value": "2.105.0",
|
|
30
|
+
"node-opcua-date-time": "2.105.0",
|
|
31
|
+
"node-opcua-debug": "2.105.0",
|
|
32
|
+
"node-opcua-extension-object": "2.105.0",
|
|
33
|
+
"node-opcua-hostname": "2.105.0",
|
|
34
|
+
"node-opcua-nodeid": "2.105.0",
|
|
35
|
+
"node-opcua-object-registry": "2.105.0",
|
|
36
|
+
"node-opcua-pki": "4.2.1",
|
|
37
|
+
"node-opcua-pseudo-session": "2.105.0",
|
|
38
|
+
"node-opcua-schemas": "2.105.0",
|
|
39
|
+
"node-opcua-secure-channel": "2.105.0",
|
|
40
|
+
"node-opcua-service-browse": "2.105.0",
|
|
41
|
+
"node-opcua-service-call": "2.105.0",
|
|
42
|
+
"node-opcua-service-discovery": "2.105.0",
|
|
43
|
+
"node-opcua-service-endpoints": "2.105.0",
|
|
44
|
+
"node-opcua-service-filter": "2.105.0",
|
|
45
|
+
"node-opcua-service-history": "2.105.0",
|
|
46
|
+
"node-opcua-service-query": "2.105.0",
|
|
47
|
+
"node-opcua-service-read": "2.105.0",
|
|
48
|
+
"node-opcua-service-register-node": "2.105.0",
|
|
49
|
+
"node-opcua-service-secure-channel": "2.105.0",
|
|
50
|
+
"node-opcua-service-session": "2.105.0",
|
|
51
|
+
"node-opcua-service-subscription": "2.105.0",
|
|
52
|
+
"node-opcua-service-translate-browse-path": "2.105.0",
|
|
53
|
+
"node-opcua-service-write": "2.105.0",
|
|
54
|
+
"node-opcua-status-code": "2.105.0",
|
|
55
|
+
"node-opcua-types": "2.105.0",
|
|
56
|
+
"node-opcua-utils": "2.105.0",
|
|
57
|
+
"node-opcua-variant": "2.105.0",
|
|
58
58
|
"thenify": "^3.3.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/underscore": "^1.11.5",
|
|
62
62
|
"dequeue": "^1.0.5",
|
|
63
63
|
"mocha": "^10.2.0",
|
|
64
|
-
"node-opcua-address-space": "2.
|
|
65
|
-
"node-opcua-binary-stream": "2.
|
|
66
|
-
"node-opcua-factory": "2.
|
|
67
|
-
"node-opcua-leak-detector": "2.
|
|
64
|
+
"node-opcua-address-space": "2.105.0",
|
|
65
|
+
"node-opcua-binary-stream": "2.105.0",
|
|
66
|
+
"node-opcua-factory": "2.105.0",
|
|
67
|
+
"node-opcua-leak-detector": "2.105.0",
|
|
68
68
|
"node-opcua-nodesets": "2.103.0",
|
|
69
69
|
"should": "^13.2.3",
|
|
70
70
|
"sinon": "^15.1.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"internet of things"
|
|
91
91
|
],
|
|
92
92
|
"homepage": "http://node-opcua.github.io/",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "41c30f321debfe92128905d97a52426b9d7f9b9e",
|
|
94
94
|
"files": [
|
|
95
95
|
"dist",
|
|
96
96
|
"source"
|
|
@@ -21,7 +21,6 @@ const errorLog = make_errorLog(__filename);
|
|
|
21
21
|
* @param comment
|
|
22
22
|
*/
|
|
23
23
|
export async function acknowledgeCondition(session: ClientSession, eventStuff: EventStuff, comment: string): Promise<StatusCode> {
|
|
24
|
-
|
|
25
24
|
try {
|
|
26
25
|
const conditionId = eventStuff.conditionId.value;
|
|
27
26
|
const eventId = eventStuff.eventId.value;
|
|
@@ -95,12 +94,9 @@ export async function findActiveConditions(session: ClientSession): Promise<Even
|
|
|
95
94
|
if (RefreshEndEventHasBeenReceived) {
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
|
|
100
98
|
// dumpEvent(session, fields, eventFields);
|
|
101
99
|
const pojo = fieldsToJson(fields, eventFields) as any;
|
|
102
|
-
|
|
103
|
-
// console.log(pojo.eventType.value.toString({ addressSpace}), RefreshEndEventType, RefreshStartEventType);
|
|
104
100
|
|
|
105
101
|
// make sure we only start recording event after the RefreshStartEvent has been received
|
|
106
102
|
if (!refreshStartEventHasBeenReceived) {
|
|
@@ -4,6 +4,10 @@ import { NodeId } from "node-opcua-nodeid";
|
|
|
4
4
|
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
5
5
|
import { DataType, Variant, VariantLike } from "node-opcua-variant";
|
|
6
6
|
|
|
7
|
+
import { make_warningLog } from "node-opcua-debug";
|
|
8
|
+
|
|
9
|
+
const warningLog = make_warningLog("ClientAlarmTool");
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
*
|
|
9
13
|
* @param session
|
|
@@ -32,8 +36,7 @@ export async function dumpEvent(session: IBasicSession, fields: string[], eventF
|
|
|
32
36
|
}
|
|
33
37
|
if (variant.dataType === DataType.NodeId) {
|
|
34
38
|
const name = await getBrowseName(_session, variant.value);
|
|
35
|
-
|
|
36
|
-
console.log(
|
|
39
|
+
warningLog(
|
|
37
40
|
chalk.yellow(w(name, 30), w(_fields[index], 25)),
|
|
38
41
|
chalk.cyan(w(DataType[variant.dataType], 10).toString()),
|
|
39
42
|
chalk.cyan.bold(name),
|
|
@@ -43,7 +46,7 @@ export async function dumpEvent(session: IBasicSession, fields: string[], eventF
|
|
|
43
46
|
);
|
|
44
47
|
} else {
|
|
45
48
|
// tslint:disable-next-line: no-console
|
|
46
|
-
|
|
49
|
+
warningLog(
|
|
47
50
|
chalk.yellow(w("", 30), w(_fields[index], 25)),
|
|
48
51
|
chalk.cyan(w(DataType[variant.dataType as number], 10).toString()),
|
|
49
52
|
variant.value
|
|
@@ -120,7 +120,6 @@ export class ClientSessionKeepAliveManager extends EventEmitter implements Clien
|
|
|
120
120
|
timeSinceLastServerContact
|
|
121
121
|
);
|
|
122
122
|
// no need to send a ping yet
|
|
123
|
-
// console.log("Skipping ",timeSinceLastServerContact,this.session.timeout);
|
|
124
123
|
return timeSinceLastServerContact - this.pingTimeout;
|
|
125
124
|
}
|
|
126
125
|
|
|
@@ -753,10 +753,10 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
753
753
|
if (!fs.existsSync(this.certificateFile)) {
|
|
754
754
|
await withLock({ fileToLock: this.certificateFile + ".mutex" }, async () => {
|
|
755
755
|
if (fs.existsSync(this.certificateFile)) {
|
|
756
|
-
// the file may have been created in between
|
|
756
|
+
// the file may have been created in between
|
|
757
757
|
return;
|
|
758
758
|
}
|
|
759
|
-
|
|
759
|
+
warningLog("Creating default certificate ... please wait");
|
|
760
760
|
if (this.disconnecting) return;
|
|
761
761
|
|
|
762
762
|
await ClientBaseImpl.createCertificate(
|
|
@@ -810,13 +810,13 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
810
810
|
|
|
811
811
|
protected _handleUnrecoverableConnectionFailure(err: Error, callback: ErrorCallback): void {
|
|
812
812
|
debugLog(err.message);
|
|
813
|
-
this.emit("connection_failed");
|
|
813
|
+
this.emit("connection_failed", err);
|
|
814
814
|
this._setInternalState("disconnected");
|
|
815
815
|
return callback(err);
|
|
816
816
|
}
|
|
817
817
|
private _handleDisconnectionWhileConnecting(err: Error, callback: ErrorCallback) {
|
|
818
818
|
debugLog(err.message);
|
|
819
|
-
this.emit("connection_failed");
|
|
819
|
+
this.emit("connection_failed", err);
|
|
820
820
|
this._setInternalState("disconnected");
|
|
821
821
|
return callback(err);
|
|
822
822
|
}
|
|
@@ -937,7 +937,6 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
937
937
|
/* */
|
|
938
938
|
this._handleDisconnectionWhileConnecting(err, callback);
|
|
939
939
|
} else {
|
|
940
|
-
console.log("REMOVE ME", err.stack);
|
|
941
940
|
err = new Error("The connection may have been rejected by server,\n" + "Err = (" + err.message + ")");
|
|
942
941
|
this._handleUnrecoverableConnectionFailure(err, callback);
|
|
943
942
|
}
|
|
@@ -309,7 +309,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
309
309
|
get subscriptionCount(): number {
|
|
310
310
|
return this._publishEngine ? this._publishEngine.subscriptionCount : 0;
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
|
|
313
313
|
get isReconnecting(): boolean {
|
|
314
314
|
return this._client ? this._client.isReconnecting || this._reconnecting?.reconnecting : false;
|
|
315
315
|
}
|
|
@@ -337,7 +337,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
337
337
|
this._client._activateSession(this, userIdentityInfo, (err1: Error | null, session2?: ClientSessionImpl) => {
|
|
338
338
|
if (err1) {
|
|
339
339
|
this.userIdentityInfo = old_userIdentity;
|
|
340
|
-
|
|
340
|
+
warningLog("activate session error = ", err1.message);
|
|
341
341
|
return callback!(null, StatusCodes.BadUserAccessDenied);
|
|
342
342
|
}
|
|
343
343
|
this.userIdentityInfo = userIdentityInfo;
|
|
@@ -450,8 +450,8 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
450
450
|
if (r.references && r.references.length > this.requestedMaxReferencesPerNode) {
|
|
451
451
|
warningLog(
|
|
452
452
|
chalk.yellow("warning") +
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
" BrowseResponse : the server didn't take into" +
|
|
454
|
+
" account our requestedMaxReferencesPerNode "
|
|
455
455
|
);
|
|
456
456
|
warningLog(" this.requestedMaxReferencesPerNode= " + this.requestedMaxReferencesPerNode);
|
|
457
457
|
warningLog(" got " + r.references.length + "for " + nodesToBrowse[i].nodeId.toString());
|
|
@@ -460,7 +460,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
for (const r of results) {
|
|
463
|
-
r.references = r.references || /* istanbul ignore next */[];
|
|
463
|
+
r.references = r.references || /* istanbul ignore next */ [];
|
|
464
464
|
}
|
|
465
465
|
assert(results[0] instanceof BrowseResult);
|
|
466
466
|
return callback(null, isArray ? results : results[0]);
|
|
@@ -546,7 +546,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
546
546
|
* ```javascript
|
|
547
547
|
* const dataValues = await session.readVariableValue(["ns=1;s=Temperature","ns=1;s=Pressure"]);
|
|
548
548
|
* ```
|
|
549
|
-
*
|
|
549
|
+
*
|
|
550
550
|
* @deprecated
|
|
551
551
|
*/
|
|
552
552
|
public readVariableValue(nodeId: NodeIdLike, callback: ResponseCallback<DataValue>): void;
|
|
@@ -759,7 +759,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
759
759
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
762
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
763
763
|
callback(null, response);
|
|
764
764
|
});
|
|
765
765
|
}
|
|
@@ -891,7 +891,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
891
891
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
892
892
|
}
|
|
893
893
|
|
|
894
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
894
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
895
895
|
|
|
896
896
|
assert(nodesToRead.length === response.results.length);
|
|
897
897
|
|
|
@@ -1034,7 +1034,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1034
1034
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1035
1035
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
1036
1036
|
}
|
|
1037
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1037
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1038
1038
|
assert(nodesToWrite.length === response.results.length);
|
|
1039
1039
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1040
1040
|
});
|
|
@@ -1256,7 +1256,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1256
1256
|
warningLog(
|
|
1257
1257
|
chalk.yellow(
|
|
1258
1258
|
"please make sure to refactor your code and check that " +
|
|
1259
|
-
|
|
1259
|
+
"the second argument of your callback function is named"
|
|
1260
1260
|
),
|
|
1261
1261
|
chalk.cyan("dataValue" + (isArray ? "s" : ""))
|
|
1262
1262
|
);
|
|
@@ -1289,7 +1289,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1289
1289
|
|
|
1290
1290
|
// perform ExtensionObject resolution
|
|
1291
1291
|
promoteOpaqueStructureWithCallback(this, response.results!, () => {
|
|
1292
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1292
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1293
1293
|
return callback(null, isArray ? response.results : response.results[0]);
|
|
1294
1294
|
});
|
|
1295
1295
|
});
|
|
@@ -1490,7 +1490,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1490
1490
|
if (!response) {
|
|
1491
1491
|
return callback(new Error("Internal Error"));
|
|
1492
1492
|
}
|
|
1493
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1493
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1494
1494
|
callback(err, isArray ? response.results : response.results[0]);
|
|
1495
1495
|
}
|
|
1496
1496
|
);
|
|
@@ -1535,7 +1535,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1535
1535
|
if (!response || !(response instanceof TranslateBrowsePathsToNodeIdsResponse)) {
|
|
1536
1536
|
return callback(new Error("Internal Error"));
|
|
1537
1537
|
}
|
|
1538
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1538
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1539
1539
|
|
|
1540
1540
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1541
1541
|
});
|
|
@@ -1694,9 +1694,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1694
1694
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1695
1695
|
err = new Error(
|
|
1696
1696
|
" ServiceResult is " +
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1697
|
+
response.responseHeader.serviceResult.toString() +
|
|
1698
|
+
" request was " +
|
|
1699
|
+
request.constructor.name
|
|
1700
1700
|
);
|
|
1701
1701
|
|
|
1702
1702
|
if (response && response.responseHeader.serviceDiagnostics) {
|
|
@@ -1943,7 +1943,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1943
1943
|
return callback(new Error("Internal Error"));
|
|
1944
1944
|
}
|
|
1945
1945
|
|
|
1946
|
-
response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */[];
|
|
1946
|
+
response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */ [];
|
|
1947
1947
|
|
|
1948
1948
|
callback(null, response.registeredNodeIds);
|
|
1949
1949
|
});
|
|
@@ -2038,7 +2038,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2038
2038
|
const privateThis = this as any;
|
|
2039
2039
|
if (!(!privateThis.pendingTransactions || privateThis.pendingTransactions.length === 0)) {
|
|
2040
2040
|
// tslint:disable-next-line: no-console
|
|
2041
|
-
|
|
2041
|
+
warningLog("dispose when pendingTransactions is not empty ");
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
2044
|
|
|
@@ -2073,12 +2073,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2073
2073
|
str += "\n reviseTokenLifetime...... " + this._client._secureChannel.securityToken.revisedLifetime;
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
2076
|
-
str += "\n keepAlive ................ " + this._keepAliveManager ? true:
|
|
2076
|
+
str += "\n keepAlive ................ " + this._keepAliveManager ? true : false;
|
|
2077
2077
|
if (this._keepAliveManager) {
|
|
2078
2078
|
str += "\n keepAlive checkInterval.. " + this._keepAliveManager.checkInterval;
|
|
2079
2079
|
str += "\n defaultTransportTimeout.. " + ClientSecureChannelLayer.defaultTransportTimeout;
|
|
2080
|
-
|
|
2081
|
-
}
|
|
2080
|
+
}
|
|
2082
2081
|
return str;
|
|
2083
2082
|
}
|
|
2084
2083
|
|
|
@@ -2277,7 +2276,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2277
2276
|
) {
|
|
2278
2277
|
if (this.recursive_repair_detector >= 1) {
|
|
2279
2278
|
// tslint:disable-next-line: no-console
|
|
2280
|
-
|
|
2279
|
+
warningLog("recreate_session_and_reperform_transaction => Already in Progress");
|
|
2281
2280
|
return callback(new Error("Cannot recreate session"));
|
|
2282
2281
|
}
|
|
2283
2282
|
this.recursive_repair_detector += 1;
|
|
@@ -13,14 +13,7 @@ import chalk from "chalk";
|
|
|
13
13
|
|
|
14
14
|
import { assert } from "node-opcua-assert";
|
|
15
15
|
import { createFastUninitializedBuffer } from "node-opcua-buffer-utils";
|
|
16
|
-
import {
|
|
17
|
-
Certificate,
|
|
18
|
-
exploreCertificate,
|
|
19
|
-
extractPublicKeyFromCertificateSync,
|
|
20
|
-
Nonce,
|
|
21
|
-
PrivateKey,
|
|
22
|
-
toPem
|
|
23
|
-
} from "node-opcua-crypto";
|
|
16
|
+
import { Certificate, exploreCertificate, extractPublicKeyFromCertificateSync, Nonce, PrivateKey, toPem } from "node-opcua-crypto";
|
|
24
17
|
|
|
25
18
|
import { LocalizedText } from "node-opcua-data-model";
|
|
26
19
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
@@ -608,7 +601,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
608
601
|
innerCallback();
|
|
609
602
|
});
|
|
610
603
|
} catch (err) {
|
|
611
|
-
|
|
604
|
+
errorLog("Exception catch in inner function, check your code ", err);
|
|
612
605
|
errorLog("OPCUAClientImpl#withClientSession", (<Error>err).message);
|
|
613
606
|
the_error = err as Error;
|
|
614
607
|
innerCallback();
|
|
@@ -637,7 +630,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
637
630
|
],
|
|
638
631
|
(err1) => {
|
|
639
632
|
if (err1) {
|
|
640
|
-
|
|
633
|
+
errorLog("err", err1.message);
|
|
641
634
|
}
|
|
642
635
|
if (need_disconnect) {
|
|
643
636
|
errorLog("Disconnecting client after failure");
|
|
@@ -728,7 +721,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
728
721
|
const result = await func(session, subscription);
|
|
729
722
|
return result;
|
|
730
723
|
} catch (err) {
|
|
731
|
-
|
|
724
|
+
errorLog("withSubscriptionAsync inner function failed ", (<Error>err).message);
|
|
732
725
|
throw err;
|
|
733
726
|
} finally {
|
|
734
727
|
await subscription.terminate();
|
|
@@ -756,9 +749,14 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
756
749
|
if (!this.__resolveEndPoint() || !this.endpoint) {
|
|
757
750
|
return callback!(
|
|
758
751
|
new Error(
|
|
759
|
-
" End point must exist " +
|
|
760
|
-
|
|
761
|
-
|
|
752
|
+
" End point must exist " +
|
|
753
|
+
this._secureChannel!.endpointUrl +
|
|
754
|
+
" securityMode = " +
|
|
755
|
+
MessageSecurityMode[this.securityMode] +
|
|
756
|
+
" securityPolicy = " +
|
|
757
|
+
this.securityPolicy
|
|
758
|
+
)
|
|
759
|
+
);
|
|
762
760
|
}
|
|
763
761
|
|
|
764
762
|
assert(
|
|
@@ -845,7 +843,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
845
843
|
this.clientNonce = crypto.randomBytes(32);
|
|
846
844
|
|
|
847
845
|
// recycle session name if already exists
|
|
848
|
-
const sessionName = session.name
|
|
846
|
+
const sessionName = session.name;
|
|
849
847
|
|
|
850
848
|
const request = new CreateSessionRequest({
|
|
851
849
|
clientCertificate: this.getCertificate(),
|
|
@@ -855,7 +853,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
855
853
|
maxResponseMessageSize: 800000,
|
|
856
854
|
requestedSessionTimeout: this.requestedSessionTimeout,
|
|
857
855
|
serverUri: this.serverUri,
|
|
858
|
-
sessionName
|
|
856
|
+
sessionName
|
|
859
857
|
});
|
|
860
858
|
|
|
861
859
|
// a client Nonce must be provided if security mode is set
|
|
@@ -864,10 +862,8 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
864
862
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
865
863
|
/* istanbul ignore next */
|
|
866
864
|
if (err) {
|
|
867
|
-
|
|
865
|
+
debugLog("__createSession_step3 has failed", err.message);
|
|
868
866
|
return callback(err);
|
|
869
|
-
|
|
870
|
-
// //xxxxxx qdqsdqsdqsdqsd
|
|
871
867
|
// // we could have an invalid state here or a connection error
|
|
872
868
|
// errorLog("error: ", err.message, " retrying in ... 5 secondes");
|
|
873
869
|
// setTimeout(() => {
|
|
@@ -1155,20 +1151,32 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
1155
1151
|
if (!this.__resolveEndPoint() || !this.endpoint) {
|
|
1156
1152
|
/* istanbul ignore next */
|
|
1157
1153
|
if (this._serverEndpoints) {
|
|
1158
|
-
warningLog(
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1154
|
+
warningLog(
|
|
1155
|
+
"server endpoints =",
|
|
1156
|
+
this._serverEndpoints
|
|
1157
|
+
.map(
|
|
1158
|
+
(endpoint) =>
|
|
1159
|
+
endpoint.endpointUrl +
|
|
1160
|
+
" " +
|
|
1161
|
+
MessageSecurityMode[endpoint.securityMode] +
|
|
1162
|
+
" " +
|
|
1163
|
+
endpoint.securityPolicyUri +
|
|
1164
|
+
" " +
|
|
1165
|
+
endpoint.userIdentityTokens?.map((u) => UserTokenType[u.tokenType]).join(",")
|
|
1166
|
+
)
|
|
1167
|
+
.join("\n")
|
|
1166
1168
|
);
|
|
1167
1169
|
}
|
|
1168
|
-
return callback(
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1170
|
+
return callback(
|
|
1171
|
+
new Error(
|
|
1172
|
+
" End point must exist " +
|
|
1173
|
+
this._secureChannel!.endpointUrl +
|
|
1174
|
+
" securityMode = " +
|
|
1175
|
+
MessageSecurityMode[this.securityMode] +
|
|
1176
|
+
" securityPolicy = " +
|
|
1177
|
+
this.securityPolicy
|
|
1178
|
+
)
|
|
1179
|
+
);
|
|
1172
1180
|
}
|
|
1173
1181
|
this.serverUri = this.endpoint.server.applicationUri || "invalid application uri";
|
|
1174
1182
|
this.endpointUrl = this._secureChannel!.endpointUrl;
|
package/source/reconnection.ts
CHANGED
|
@@ -167,7 +167,6 @@ function repair_client_session_by_recreating_a_new_session(
|
|
|
167
167
|
session: ClientSessionImpl,
|
|
168
168
|
callback: (err?: Error) => void
|
|
169
169
|
) {
|
|
170
|
-
|
|
171
170
|
// As we don"t know if server has been rebooted or not,
|
|
172
171
|
// and may be upgraded in between, we have to invalidate the extra data type manager
|
|
173
172
|
invalidateExtraDataTypeManager(session);
|
|
@@ -367,8 +366,7 @@ function repair_client_session_by_recreating_a_new_session(
|
|
|
367
366
|
// call Republish
|
|
368
367
|
return _ask_for_subscription_republish(newSession, (err) => {
|
|
369
368
|
if (err) {
|
|
370
|
-
|
|
371
|
-
console.log("warning: Subscription republished has failed ", err.message);
|
|
369
|
+
warningLog("warning: Subscription republished has failed ", err.message);
|
|
372
370
|
}
|
|
373
371
|
innerCallback(err);
|
|
374
372
|
});
|