xshell 1.0.114 → 1.0.115
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/net.browser.js +12 -5
- package/net.js +12 -5
- package/package.json +1 -1
package/net.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from './i18n/instance.js';
|
|
2
2
|
import './prototype.browser.js'; // to_time_str()
|
|
3
|
-
import { assert, concat, genid, delay, Lock, encode, decode } from './utils.browser.js';
|
|
3
|
+
import { assert, concat, genid, delay, Lock, encode, decode, timeout } from './utils.browser.js';
|
|
4
4
|
const drop_request_headers = new Set([
|
|
5
5
|
// : 开头的 key
|
|
6
6
|
// sec-*
|
|
@@ -379,11 +379,15 @@ export class Remote {
|
|
|
379
379
|
this.reconnecting = false;
|
|
380
380
|
if (!this.disconnected)
|
|
381
381
|
try {
|
|
382
|
-
await
|
|
382
|
+
await timeout(3000, async () => {
|
|
383
|
+
await this.connect();
|
|
384
|
+
});
|
|
383
385
|
this.first_error = true;
|
|
384
386
|
}
|
|
385
|
-
catch {
|
|
386
|
-
//
|
|
387
|
+
catch (error) {
|
|
388
|
+
// 重连失败的错误这里需要简单打印下,_on_error 不会打印,这里也不继续往上抛了
|
|
389
|
+
console.log(error.message);
|
|
390
|
+
// 重连由 this.connect 里面调用 this._on_error 处理
|
|
387
391
|
}
|
|
388
392
|
})();
|
|
389
393
|
};
|
|
@@ -441,9 +445,12 @@ export class Remote {
|
|
|
441
445
|
break;
|
|
442
446
|
if (!this.reconnecting)
|
|
443
447
|
try {
|
|
444
|
-
await
|
|
448
|
+
await timeout(1000 * 2, async () => {
|
|
449
|
+
await this.call('echo', []);
|
|
450
|
+
});
|
|
445
451
|
}
|
|
446
452
|
catch (error) {
|
|
453
|
+
console.log(error.message);
|
|
447
454
|
this._on_error(error);
|
|
448
455
|
}
|
|
449
456
|
}
|
package/net.js
CHANGED
|
@@ -3,7 +3,7 @@ import { buffer as stream_to_buffer, text as stream_to_text } from 'stream/consu
|
|
|
3
3
|
import { isReadable } from 'stream';
|
|
4
4
|
import { t } from './i18n/instance.js';
|
|
5
5
|
import './prototype.js';
|
|
6
|
-
import { inspect, concat, assert, genid, delay, Lock, encode, decode, pipe_with_error, map_values, unique } from './utils.js';
|
|
6
|
+
import { inspect, concat, assert, genid, delay, Lock, encode, decode, pipe_with_error, map_values, unique, timeout } from './utils.js';
|
|
7
7
|
export const WebSocketConnecting = 0;
|
|
8
8
|
export const WebSocketOpen = 1;
|
|
9
9
|
export const WebSocketClosing = 2;
|
|
@@ -590,11 +590,15 @@ export class Remote {
|
|
|
590
590
|
this.reconnecting = false;
|
|
591
591
|
if (!this.disconnected)
|
|
592
592
|
try {
|
|
593
|
-
await
|
|
593
|
+
await timeout(3000, async () => {
|
|
594
|
+
await this.connect();
|
|
595
|
+
});
|
|
594
596
|
this.first_error = true;
|
|
595
597
|
}
|
|
596
|
-
catch {
|
|
597
|
-
//
|
|
598
|
+
catch (error) {
|
|
599
|
+
// 重连失败的错误这里需要简单打印下,_on_error 不会打印,这里也不继续往上抛了
|
|
600
|
+
console.log(error.message);
|
|
601
|
+
// 重连由 this.connect 里面调用 this._on_error 处理
|
|
598
602
|
}
|
|
599
603
|
})();
|
|
600
604
|
};
|
|
@@ -652,9 +656,12 @@ export class Remote {
|
|
|
652
656
|
break;
|
|
653
657
|
if (!this.reconnecting)
|
|
654
658
|
try {
|
|
655
|
-
await
|
|
659
|
+
await timeout(1000 * 2, async () => {
|
|
660
|
+
await this.call('echo', []);
|
|
661
|
+
});
|
|
656
662
|
}
|
|
657
663
|
catch (error) {
|
|
664
|
+
console.log(error.message);
|
|
658
665
|
this._on_error(error);
|
|
659
666
|
}
|
|
660
667
|
}
|