mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -06:00
RTC-13903 Fix C9 double network messages on virtual machine
This commit is contained in:
parent
b2f230121e
commit
0761f1bf8c
@ -19,6 +19,7 @@ type StatusCallback = (status: IShellStatus) => void;
|
|||||||
class C9ShellHandler {
|
class C9ShellHandler {
|
||||||
private _c9shell: ChildProcess | undefined;
|
private _c9shell: ChildProcess | undefined;
|
||||||
private _curStatus: IShellStatus | undefined;
|
private _curStatus: IShellStatus | undefined;
|
||||||
|
private _firstSuccessfulConnectionDate = 0;
|
||||||
private _isDisconnected = false;
|
private _isDisconnected = false;
|
||||||
private _isFreshStart = true;
|
private _isFreshStart = true;
|
||||||
private _isStarting = false;
|
private _isStarting = false;
|
||||||
@ -239,11 +240,19 @@ class C9ShellHandler {
|
|||||||
if (
|
if (
|
||||||
c9ShellMessage.includes('NetworkConnectivityService|Internet Available')
|
c9ShellMessage.includes('NetworkConnectivityService|Internet Available')
|
||||||
) {
|
) {
|
||||||
|
if (this._isFreshStart) {
|
||||||
this._isFreshStart = false;
|
this._isFreshStart = false;
|
||||||
|
this._firstSuccessfulConnectionDate = Date.now();
|
||||||
|
}
|
||||||
if (this._isDisconnected) {
|
if (this._isDisconnected) {
|
||||||
this._isDisconnected = false;
|
this._isDisconnected = false;
|
||||||
|
const millisecondsElapsed =
|
||||||
|
Date.now() - this._firstSuccessfulConnectionDate;
|
||||||
|
// Sometime, we have 2 network connections in 4 seconds (while using a virtual machine)
|
||||||
|
if (millisecondsElapsed > 10000) {
|
||||||
this._onNetworkReconnection();
|
this._onNetworkReconnection();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
c9ShellMessage.includes(
|
c9ShellMessage.includes(
|
||||||
'NetworkConnectivityService|No Internet Available',
|
'NetworkConnectivityService|No Internet Available',
|
||||||
|
Loading…
Reference in New Issue
Block a user