Beispiel #1
0
        public override void OnOperationReturn(ClientConnection client, OperationResponse operationResponse)
        {
            Counters.ReceivedOperationResponse.Increment();
            WindowsCounters.ReceivedOperationResponse.Increment();

            switch (operationResponse.OperationCode)
            {
                case OperationCode.JoinGame:
                    {
                        if (operationResponse.ReturnCode == 0)
                        {
                            this.TransitState(client);
                        }
                        else
                        {
                            log.WarnFormat("OnOperationReturn: unexpected return code {0} of operation {1}", operationResponse.ReturnCode, operationResponse.OperationCode);
                            client.Stop();
                        }

                        break;
                    }

                default:
                    {
                        log.WarnFormat("OnOperationReturn: unexpected return code {0} of operation {1}", operationResponse.ReturnCode, operationResponse.OperationCode);
                        break;
                    }
            }
        }
Beispiel #2
0
        /// <summary>
        /// The on operation return.
        /// </summary>
        /// <param name="client">
        /// The client.
        /// </param>
        /// <param name="operationResponse">
        /// The operation Response.
        /// </param>
        public override void OnOperationReturn(ClientConnection client, OperationResponse operationResponse)
        {
            Counters.ReceivedOperationResponse.Increment();
            WindowsCounters.ReceivedOperationResponse.Increment();

            switch (operationResponse.OperationCode)
            {
                case OperationCode.RaiseEvent:
                    {
                        if (operationResponse.ReturnCode != 0)
                        {
                            log.WarnFormat(
                                "OnOperationReturn: unexpected return code {0} of operation {1}", operationResponse.ReturnCode, operationResponse.OperationCode);
                            client.Stop();
                        }

                        break;
                    }

                case OperationCode.Leave:
                    {
                        if (operationResponse.ReturnCode == 0)
                        {
                            if (log.IsDebugEnabled)
                            {
                                log.Debug("Stopped Playing");
                            }

                            client.State = Connected.Instance;
                            client.StopTimers();
                        }
                        else
                        {
                            log.WarnFormat(
                                "OnOperationReturn: unexpected return code {0} of operation {1}", operationResponse.ReturnCode, operationResponse.OperationCode);
                            client.Stop();
                        }

                        break;
                    }

                case OperationCode.JoinGame:
                    {
                        // ignore: ReturnIncoming app returns 10x response
                        break;
                    }

                default:
                    {
                        log.WarnFormat(
                            "OnOperationReturn: unexpected return code {0} of operation {1}", operationResponse.ReturnCode, operationResponse.OperationCode);
                        break;
                    }
            }
        }