Handle 'CONNECTION_NOT_INITED'
This commit is contained in:
parent
3b4184f34e
commit
d38c5adeb5
@ -576,6 +576,9 @@ export class ApiManager {
|
||||
} else {
|
||||
rejectPromise(error);
|
||||
}
|
||||
} else if(error.code === 400 && error.type === 'CONNECTION_NOT_INITED') {
|
||||
networkerFactory.unsetConnectionInited();
|
||||
performRequest(cachedNetworker);
|
||||
} else if(!options.rawError && error.code === 420) {
|
||||
const waitTime = +error.type.match(/^FLOOD_WAIT_(\d+)/)[1] || 1;
|
||||
|
||||
|
@ -375,6 +375,8 @@ export default class MTPNetworker {
|
||||
this.nextReq = 0;
|
||||
}
|
||||
|
||||
this.connectionInited = false;
|
||||
|
||||
/// #if MTPROTO_HAS_HTTP
|
||||
if(this.longPollInterval !== undefined) {
|
||||
clearInterval(this.longPollInterval);
|
||||
@ -1336,7 +1338,9 @@ export default class MTPNetworker {
|
||||
return;
|
||||
}
|
||||
|
||||
// deserializer.setMtproto(false);
|
||||
result.result = deserializer.fetchObject(type, field + '[result]');
|
||||
// deserializer.setMtproto(true);
|
||||
// self.log(dT(), 'override rpc_result', sentMessage, type, result);
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,12 @@ export class NetworkerFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public unsetConnectionInited() {
|
||||
for(const networker of this.networkers) {
|
||||
networker.connectionInited = false;
|
||||
}
|
||||
}
|
||||
|
||||
public forceReconnectTimeout() {
|
||||
for(const networker of this.networkers) {
|
||||
networker.forceReconnectTimeout();
|
||||
|
@ -491,6 +491,10 @@ class TLDeserialization<FetchLongAs extends Long> {
|
||||
this.debug = options.debug !== undefined ? options.debug : /* Modes.debug */false;
|
||||
}
|
||||
|
||||
/* public setMtproto(mtproto: boolean) {
|
||||
this.mtproto = mtproto;
|
||||
} */
|
||||
|
||||
private readInt(field: string) {
|
||||
//if(this.offset >= this.intView.length * 4) {
|
||||
if((this.byteView.length - this.offset) < 4) {
|
||||
|
Loading…
Reference in New Issue
Block a user