|
@@ -107,6 +107,7 @@ export class MTProtoSender {
|
|
private _connectMutex: Mutex;
|
|
private _connectMutex: Mutex;
|
|
private _cancelSend: boolean;
|
|
private _cancelSend: boolean;
|
|
cancellableRecvLoopPromise?: CancellablePromise<any>;
|
|
cancellableRecvLoopPromise?: CancellablePromise<any>;
|
|
|
|
+ private _finishedConnecting: boolean;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @param authKey
|
|
* @param authKey
|
|
@@ -117,6 +118,7 @@ export class MTProtoSender {
|
|
...MTProtoSender.DEFAULT_OPTIONS,
|
|
...MTProtoSender.DEFAULT_OPTIONS,
|
|
...opts,
|
|
...opts,
|
|
};
|
|
};
|
|
|
|
+ this._finishedConnecting = false;
|
|
this._cancelSend = false;
|
|
this._cancelSend = false;
|
|
this._connection = undefined;
|
|
this._connection = undefined;
|
|
this._log = args.logger;
|
|
this._log = args.logger;
|
|
@@ -249,7 +251,7 @@ export class MTProtoSender {
|
|
}
|
|
}
|
|
this.isConnecting = true;
|
|
this.isConnecting = true;
|
|
this._connection = connection;
|
|
this._connection = connection;
|
|
-
|
|
|
|
|
|
+ this._finishedConnecting = false;
|
|
for (let attempt = 0; attempt < this._retries; attempt++) {
|
|
for (let attempt = 0; attempt < this._retries; attempt++) {
|
|
try {
|
|
try {
|
|
await this._connect();
|
|
await this._connect();
|
|
@@ -261,6 +263,7 @@ export class MTProtoSender {
|
|
)
|
|
)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+ this._finishedConnecting = true;
|
|
break;
|
|
break;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
if (this._updateCallback && attempt === 0) {
|
|
if (this._updateCallback && attempt === 0) {
|
|
@@ -282,7 +285,7 @@ export class MTProtoSender {
|
|
}
|
|
}
|
|
this.isConnecting = false;
|
|
this.isConnecting = false;
|
|
|
|
|
|
- return true;
|
|
|
|
|
|
+ return this._finishedConnecting;
|
|
}
|
|
}
|
|
|
|
|
|
isConnected() {
|
|
isConnected() {
|