예제 #1
0
 public void enqueue_network_message(CRecvedMsg buffer)
 {
     lock (this.cs_event)
     {
         this.network_events.Enqueue(buffer);
     }
 }
예제 #2
0
 virtual public bool ProcessMsg(CRecvedMsg rm)
 {
     return(false);
 }
예제 #3
0
        // 내부 패킷 + 사용자 패킷을 구분하여 처리
        protected string OnPacket(CRecvedMsg recved_msg)
        {
            if (recved_msg.pkop.m_pack_mode == PacketMode8.PM_None)
            {
            }
            else if (recved_msg.pkop.m_pack_mode == PacketMode8.PM_Encrypt_Mode)
            {
                try
                {
                    recved_msg.msg.Decrypt();
                }
                catch (Exception e)
                {
                    return("MsgDecryptException: " + e.Message);
                }
            }
            else
            {
                if (this.message_handler != null)
                {
                    this.message_handler(MsgType.Warning, string.Format("packmode warning {0}", recved_msg.pkop.m_pack_mode));
                }
            }

            if (recved_msg.pkID == PacketType.PacketType_Internal)
            {
                try
                {
                    PackInternal internel_id;
                    recved_msg.msg.Read(out internel_id);
                    if (!RecvInternalMessage(recved_msg.remote, internel_id, recved_msg.msg, recved_msg.pkop))
                    {
                        if (this.message_handler != null)
                        {
                            this.message_handler(MsgType.Warning, string.Format("RecvInternal need implement : pkid : {0}", internel_id));
                        }
                    }
                }
                catch (Exception e)
                {
                    return(string.Format("RecvInternal ErrorException : {0}", e.Message));
                }
                return(string.Empty);
            }

            ECore.PacketType runningPkID = PacketType.PacketType_None;
            int nReceive = 0;

            try
            {
                foreach (var obj in this.stub_list)
                {
                    runningPkID = recved_msg.pkID;
                    if (obj.ProcessMsg(recved_msg))
                    {
                        nReceive++;
                    }
                    if (nReceive >= 2)
                    {
                        if (this.message_handler != null)
                        {
                            this.message_handler(MsgType.Warning, string.Format("ProcessMsg duplicate warning msgID {0}  callCnt {1}", recved_msg.pkID, nReceive));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                return(string.Format("StubException Rmi.Common.ID:{0}, {1}", (int)runningPkID, e.Message));
            }
            if (nReceive == 0)
            {
                if (this.message_handler != null)
                {
                    this.message_handler(MsgType.Warning, string.Format("ProcessMsg warning msgID {0}  call zero", recved_msg.pkID));
                }
            }
            return(string.Empty);
        }