public void Kill() { OnRequestCompleteAction = null; try { this.Abort(); //this.OnRequestCompleteAction = null; //this.Dispose(); } catch (Exception) { } }
private IEnumerator Call(WWWForm form, Batch batch) { this.qccCount = 0u; WWW wWW = new WWW(this.url, form.data, this.headers); WWWManager.Add(wWW); yield return(wWW); if (WWWManager.Remove(wWW)) { uint serverTime = Service.ServerAPI.ServerTime; if (string.IsNullOrEmpty(wWW.error)) { string name = "Received batch response"; Service.AssetManager.Profiler.RecordFetchEvent(name, wWW.bytesDownloaded, true, true); object obj = new JsonParser(wWW.text).Parse(); Response response = new Response(); response.FromObject(obj); bool flag = this.responseHandler.MatchProtocolVersion(response.ProtocolVersion); Batch batch2 = null; for (int i = 0; i < batch.Commands.Count; i++) { ICommand command = batch.Commands[i]; Data data = response.DataList[i]; if (data.RequestId != command.Id) { this.logger.Error("RequestId Mismatch in Dispatcher!"); } bool success = this.SuccessStatuses.Contains(data.Status); OnCompleteAction onCompleteAction = command.OnComplete(data, success); if (data.Messages != null) { this.responseHandler.SendMessages(data.Messages); } if (this.qcc.Enabled && this.qcc.StatusWhitelist.Contains(data.Status)) { this.qcc.CorrectBatch(batch, response.DataList, i, new QuietCorrectionController.HandleBatch(this.ReCall)); wWW.Dispose(); if (batch.Sync) { this.syncDispatchLock = false; } goto IL_4DF; } if (onCompleteAction == OnCompleteAction.Desync) { this.responseHandler.Desync(DesyncType.CriticalCommandFail, data.Status); wWW.Dispose(); goto IL_4DF; } if (onCompleteAction == OnCompleteAction.Retry && flag) { command.Tries += 1u; if (command.Tries > 3u) { Service.Logger.Error("Command Desync. " + this.CreateCommandErrorString(command, serverTime)); this.responseHandler.Desync(DesyncType.CommandMaxRetry, data.Status); wWW.Dispose(); goto IL_4DF; } if (batch2 == null) { batch2 = new Batch(); batch2.Sync = batch.Sync; } Service.Logger.Warn("Command Resend. " + this.CreateCommandErrorString(command, serverTime)); command.SetTime(serverTime); batch2.Commands.Add(command); } } if (batch2 != null) { this.Exec(batch2); wWW.Dispose(); goto IL_4DF; } if (batch.Sync) { this.syncDispatchLock = false; this.lastSuccessfulSyncReqestId = this.FindMinMaxCommandId(batch, false); } } else { batch.Tries += 1u; if (batch.Tries > 3u) { Match match = Regex.Match(wWW.error, "\\d+"); uint status = (!match.Success) ? 0u : Convert.ToUInt32(match.Value); Service.Logger.Error("Batch Desync. " + this.CreateBatchErrorString(batch, wWW, serverTime)); this.responseHandler.Desync(DesyncType.BatchMaxRetry, status); wWW.Dispose(); goto IL_4DF; } Service.Logger.Warn("Batch WWW Error. " + this.CreateBatchErrorString(batch, wWW, serverTime)); this.Exec(batch); } wWW.Dispose(); } IL_4DF: yield break; }
public void AddOnCompleteListener(OnCompleteAction _OnCompleteAction) { OnRequestCompleteAction += _OnCompleteAction; }
public void OnFinishCooldown() { OnCompleteAction?.Invoke(); }