public override IEnumerable <object> Run() { base.Entity.SetLoginInformation(base.Operation.NexonSN, base.Operation.NexonID, base.Operation.CharacterID, base.Operation.LocalAddress, base.Operation.RemoteAddress, base.Operation.CanTry, base.Operation.IsTrial, base.Operation.MachineID, base.Operation.GameRoomClient, base.Operation.ChannelCode); if (!this.Service.Valid) { this.Service.PCRoomManager.AddUser(255, base.Entity); Log <LoginProcessor> .Logger.Info("Invalid CafeAuth Session Server - Passed"); base.Finished = true; yield return(true); yield return(false); yield return(0); yield return(false); yield return(1); } else if (!this.Service.Running) { Log <LoginProcessor> .Logger.Info("Session Server is shut down : add to queue"); base.Finished = true; this.Service.AddToWaitQueue(base.Entity); yield return(false); yield return(false); yield return(0); yield return(false); yield return(0); } else { base.Entity.BeginLogin(); yield return(base.Entity.LoginSync); if (base.Entity.LoginSync.Result) { CafeAuthResult result = base.Entity.EndLogin(); if (result == null) { Log <LoginProcessor> .Logger.ErrorFormat("Timeout for user [{{{0}}}] : Disconnected", base.Operation.NexonID); base.Entity.ReportCafeAuthMessage("Timeout"); base.Finished = true; yield return(new FailMessage("Entity.LoginSync.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { base.Entity.SessionNo = result.SessionNo; if (this.Service.SessionDic.ContainsKey(result.SessionNo)) { Log <CafeAuthService> .Logger.WarnFormat("Duplicate Session : [{0}]", result.SessionNo); } else { this.Service.SessionDic.Add(result.SessionNo, base.Entity); } if (result.ReloginRequired) { Scheduler.Schedule(this.Service.Thread, Job.Create(delegate { SendPacket op = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Dialog, "GameUI_Heroes_Policy_Shutdown_Relogin_Required")); base.Entity.FrontendConn.RequestOperation(op); }), 3000); } base.Entity.ReportCafeAuthLogin(); if (result.PCRoomNo > 0) { this.Service.PCRoomManager.AddUser(result.PCRoomNo, base.Entity); } base.Finished = true; yield return(result.Result != AuthorizeResult.Trial); if (result.Option == Option.NoOption && result.Result != AuthorizeResult.Trial) { yield return(true); } else { yield return(result.Result == AuthorizeResult.Forbidden || result.Result == AuthorizeResult.Terminate); } yield return((int)result.Option); yield return(result.IsShutDownEnabled); yield return((result.Result != AuthorizeResult.Trial) ? 1 : 0); } } else { yield return(""); } } yield break; }
public override IEnumerable <object> Run() { if (!this.Service.Valid) { base.Finished = true; yield return(true); yield return(false); yield return(0); yield return(false); yield return(0); } else if (!this.Service.Running) { base.Finished = true; yield return(false); yield return(false); yield return(0); yield return(false); yield return(0); } else { AsyncResultSync sync = base.Entity.BeginLogin(base.Operation.NexonID, base.Operation.CharacterID, base.Operation.LocalAddress, base.Operation.RemoteAddress, base.Operation.CanTry, base.Operation.IsTrial, new MachineID(base.Operation.MachineID.ToByteArray()), base.Operation.GameRoomClient, base.Entity); if (sync == null) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("sync is NULL from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); base.Finished = true; yield return(false); yield return(false); yield return(0); yield return(0); } else { IAsyncResult ar = sync.AsyncResult; if (ar == null) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("ar is NULL from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); } Scheduler.Schedule(this.Service.Thread, Job.Create <AsyncResultSync, IAsyncResult>(delegate(AsyncResultSync async, IAsyncResult asyncResult) { if (sync.AsyncResult == ar && sync.AsyncResult.AsyncState == this.Entity) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("No response from CafeAuth service : {0} / {1}", this.Operation.NexonID, this.Operation.CharacterID); sync.AsyncCallback(asyncResult); } }, sync, ar), this.ackCompleteTimeout); yield return(sync); base.Finished = true; if (sync.Result) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("sync.Result is true from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); CafeAuthResult result = this.Service.EndLogin(sync.AsyncResult); if (result == null) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult Is NULL : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); yield return(""); } else { yield return(result.Result != Nexon.CafeAuthJPN.Result.Trial); if (result.Option == Option.NoOption && result.Result != Nexon.CafeAuthJPN.Result.Trial) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #1", result.Result, result.Option); yield return(true); } else { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #2", result.Result, result.Option); yield return(result.Result == Nexon.CafeAuthJPN.Result.Forbidden || result.Result == Nexon.CafeAuthJPN.Result.Terminate); } Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #3", result.Result, result.Option); yield return((int)result.Option); yield return(false); if (result.Result == Nexon.CafeAuthJPN.Result.Trial) { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #4", result.Result, result.Option); yield return(0); } else { Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #5", result.Result, result.Option); yield return(1); } } } else { yield return(""); } } } yield break; }
public override IEnumerable <object> Run() { Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService sync starting : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); if (!this.Service.Valid) { base.Finished = true; Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService is invalid : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); yield return(true); yield return(false); yield return(0); yield return(false); yield return(1); } else if (!this.Service.Running) { base.Finished = true; Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService is not working : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); yield return(false); yield return(false); yield return(0); yield return(false); yield return(0); } else { AsyncResultSync sync = base.Entity.BeginLogin(base.Operation.NexonID, base.Operation.CharacterID, base.Operation.LocalAddress, base.Operation.RemoteAddress, base.Operation.CanTry, base.Operation.IsTrial, new MachineID(base.Operation.MachineID.ToByteArray()), base.Operation.GameRoomClient, base.Entity); if (sync == null) { Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService sync null : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); base.Finished = true; yield return(false); yield return(false); yield return(0); yield return(false); yield return(0); } else { IAsyncResult ar = sync.AsyncResult; if (ar == null) { Log <CafeAuthOldVersionService> .Logger.InfoFormat("ar is NULL from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); } Scheduler.Schedule(this.Service.Thread, Job.Create <AsyncResultSync, IAsyncResult>(delegate(AsyncResultSync async, IAsyncResult asyncResult) { if (sync.AsyncResult == ar && (sync.AsyncResult == null || sync.AsyncResult.AsyncState == this.Entity)) { Log <CafeAuthOldVersionService> .Logger.InfoFormat("No response from CafeAuth service : {0} / {1}", this.Operation.NexonID, this.Operation.CharacterID); sync.AsyncCallback(asyncResult); } }, sync, ar), this.ackCompleteTimeout); yield return(sync); Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService sync : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); base.Finished = true; if (sync.Result) { CafeAuthResult result = this.Service.EndLogin(sync.AsyncResult); if (result == null) { Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuth fail : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); yield return(""); } else { Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuth : {0} / {1} = {2} {3} {4}", new object[] { base.Operation.NexonID, base.Operation.CharacterID, result.Result, result.Option, result.CafeLevel }); yield return(result.Result != Nexon.CafeAuthOld.Result.Trial); if (result.Option == Option.NoOption && result.Result != Nexon.CafeAuthOld.Result.Trial) { yield return(true); } else { yield return(result.Result == Nexon.CafeAuthOld.Result.Forbidden || result.Result == Nexon.CafeAuthOld.Result.Terminate); } yield return((int)result.Option); yield return(false); yield return((int)result.CafeLevel); } } else { base.Finished = true; Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuth Auth Time Out : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID); yield return(false); yield return(false); yield return(0); yield return(false); yield return(0); } } } yield break; }