@bithomp/xrpl-api 3.7.14 → 3.7.15
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/lib/connection.d.ts +1 -0
- package/lib/connection.js +11 -13
- package/package.json +1 -1
package/lib/connection.d.ts
CHANGED
package/lib/connection.js
CHANGED
|
@@ -88,10 +88,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
88
88
|
url: this.url,
|
|
89
89
|
shutdown: this.shutdown,
|
|
90
90
|
});
|
|
91
|
-
|
|
92
|
-
clearTimeout(this.connectionWatchTimer);
|
|
93
|
-
this.connectionWatchTimer = null;
|
|
94
|
-
}
|
|
91
|
+
this.removeWatchTimer();
|
|
95
92
|
this.removeClient();
|
|
96
93
|
this.client = new XRPLConnection.Connection(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
|
|
97
94
|
this.setupEmitter();
|
|
@@ -107,8 +104,9 @@ class Connection extends events_1.EventEmitter {
|
|
|
107
104
|
url: this.url,
|
|
108
105
|
error: err?.message || err?.name || err,
|
|
109
106
|
});
|
|
107
|
+
this.removeWatchTimer();
|
|
110
108
|
this.removeClient();
|
|
111
|
-
this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout,
|
|
109
|
+
this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, LEDGER_CLOSED_TIMEOUT);
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
async disconnect() {
|
|
@@ -121,10 +119,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
121
119
|
if (this.isConnected()) {
|
|
122
120
|
await this.unsubscribe();
|
|
123
121
|
}
|
|
124
|
-
|
|
125
|
-
clearTimeout(this.connectionWatchTimer);
|
|
126
|
-
this.connectionWatchTimer = null;
|
|
127
|
-
}
|
|
122
|
+
this.removeWatchTimer();
|
|
128
123
|
this.removeClient();
|
|
129
124
|
}
|
|
130
125
|
async request(request, options) {
|
|
@@ -344,6 +339,12 @@ class Connection extends events_1.EventEmitter {
|
|
|
344
339
|
catch (_err) {
|
|
345
340
|
}
|
|
346
341
|
}
|
|
342
|
+
removeWatchTimer() {
|
|
343
|
+
if (this.connectionWatchTimer !== null) {
|
|
344
|
+
clearTimeout(this.connectionWatchTimer);
|
|
345
|
+
this.connectionWatchTimer = null;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
347
348
|
setupEmitter() {
|
|
348
349
|
if (!this.client) {
|
|
349
350
|
return;
|
|
@@ -583,10 +584,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
583
584
|
url: this.url,
|
|
584
585
|
shutdown: this.shutdown,
|
|
585
586
|
});
|
|
586
|
-
|
|
587
|
-
clearTimeout(this.connectionWatchTimer);
|
|
588
|
-
this.connectionWatchTimer = null;
|
|
589
|
-
}
|
|
587
|
+
this.removeWatchTimer();
|
|
590
588
|
if (this.shutdown) {
|
|
591
589
|
this.removeClient();
|
|
592
590
|
return;
|