Beispiel #1
0
        public static Service StartService(string ip, string portstr)
        {
            CafeAuthService cafeAuthService = new CafeAuthService();

            ServiceInvoker.StartService(ip, portstr, cafeAuthService);
            return(cafeAuthService);
        }
Beispiel #2
0
        private void connection_ConnectionSucceeded(object sender, EventArgs e)
        {
            Log <CafeAuthService> .Logger.Warn("Successfully connected to Session server.");

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "Connected", this.connection.RemoteEndPoint.Address.ToString(), string.Format("Port:{0}/DomainSN:{1}", this.connection.RemoteEndPoint.Port, ServiceCoreSettings.Default.CafeAuthDomainSN));
            this.cafeauthProcessing = true;
        }
Beispiel #3
0
        private void connectToCafeAuthServer()
        {
            if (this.journalID != 0L)
            {
                CafeAuthService.AddCafeAuthServiceLog(this.journalID, "CloseJournal", "by reconnecting", "");
            }
            this.journalID = CafeAuthService.AddLoginJournal();
            if (this.journalID == -1L)
            {
                CafeAuthService.AddCafeAuthServiceLog(this.journalID, "OpenJournal", "failed", "");
            }
            IPAddress[] hostAddresses = Dns.GetHostAddresses(ServiceCoreSettings.Default.CafeAuthAddress);
            int         num           = 0;

            if (num >= hostAddresses.Length)
            {
                return;
            }
            IPAddress  address    = hostAddresses[num];
            IPEndPoint ipendPoint = new IPEndPoint(address, (int)ServiceCoreSettings.Default.CafeAuthPort);

            Log <CafeAuthService> .Logger.WarnFormat("Connecting to Session server : [{0} {1} {2}]", ipendPoint, ServiceCoreSettings.Default.CafeAuthDomainSN, ServiceCoreSettings.Default.CafeAuthDomainString);

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "Connecting", ipendPoint.Address.ToString(), string.Format("Port:{0}/DomainSN:{1}", ipendPoint.Port, ServiceCoreSettings.Default.CafeAuthDomainSN));
            this.connection.Connect(base.Thread, ipendPoint, ServiceCoreSettings.Default.CafeAuthDomainSN, ServiceCoreSettings.Default.CafeAuthDomainString);
        }
Beispiel #4
0
        private void connection_Disconnected(object sender, EventArgs e)
        {
            Log <CafeAuthService> .Logger.Fatal("Disconnected from Session server.");

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "Disconnected", "", "");
            this.journalID = 0L;
            Scheduler.Schedule(base.Thread, Job.Create(new Action(this.connectToCafeAuthServer)), 10000);
        }
Beispiel #5
0
        private void connection_ConnectionFail(object sender, EventArgs <Exception> e)
        {
            Log <CafeAuthService> .Logger.Fatal(string.Format("Failed to connect to Session server. Retry after {0} sec...", 10), e.Value);

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "Not connected", this.connection.RemoteEndPoint.Address.ToString(), string.Format("Port:{0}/DomainSN:{1}", this.connection.RemoteEndPoint.Port, ServiceCoreSettings.Default.CafeAuthDomainSN));
            this.journalID = 0L;
            if (this.cafeauthProcessing)
            {
                Scheduler.Schedule(base.Thread, Job.Create(new Action(this.connectToCafeAuthServer)), 10000);
            }
        }
Beispiel #6
0
        private void connection_InitializeResponsed(InitializeResponse response)
        {
            Log <CafeAuthService> .Logger.InfoFormat("Initialize response from Session server: [{0}]", response);

            InitializeResult result = response.Result;

            if (result == InitializeResult.Success)
            {
                Log <CafeAuthService> .Logger.WarnFormat("Successfully initialized with DoaminSN {0}", response.DomainSN);

                CafeAuthService.AddCafeAuthServiceLog(this.journalID, "InitializeResponse", "Success", "");
                return;
            }
            Log <CafeAuthService> .Logger.FatalFormat("Initialization failed ({0}) with DoaminSN {1}: {2}", response.Result, response.DomainSN, response.Message);

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "InitializeResponse", response.Result.ToString().Substring(0, Math.Min(response.Result.ToString().Length, 19)), response.Message.Substring(0, Math.Min(response.Message.Length, 29)));
            Scheduler.Schedule(base.Thread, Job.Create(new Action(this.connection.RequestInitialize)), 10000);
        }
Beispiel #7
0
 public CafeAuth(CafeAuthService service, IEntity entity)
 {
     this.Service        = service;
     this.Entity         = entity;
     this.Entity.Closed += this.Entity_Closed;
 }
Beispiel #8
0
        private void connection_InitializeSent(Initialize request)
        {
            Log <CafeAuthService> .Logger.WarnFormat("Initialize request sent to Session server: [{0}]", request);

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "InitializeSent", string.Format("GameSN:{0}", request.GameSN), string.Format("DomainSN:{0}", request.DomainSN));
        }
Beispiel #9
0
        private void connection_ExceptionOccur(object sender, EventArgs <Exception> e)
        {
            Log <CafeAuthService> .Logger.Fatal("Exception occurred in Connection between Session server", e.Value);

            CafeAuthService.AddCafeAuthServiceLog(this.journalID, "Exception occurred", "", e.Value.Message.Substring(0, Math.Min(e.Value.Message.Length, 29)));
        }