Example #1
0
        public void SetSessionReadyState(bool bError)
        {
            TRItem tritem = GetAttachedTRItem();

            if (tritem != null)
            {
                uint nSeq = tritem.nSeq;
                this.state = RtfSessionState.ready_attach;

                if (bError)
                {
                    Debug.WriteLine(string.Format("*** TR 처리에러 nSeq = {0} TRCode = {1} ***", nSeq, tritem.strTrCode));
                }
                else
                {
                    Debug.WriteLine(string.Format("*** TR 처리완료 nSeq = {0} TRCode = {1} ***", nSeq, tritem.strTrCode));
                }

                DettachTRItem(tritem);

                //세션이 대기 상태가 되었음을 알림
                if (type == RtfSessionType.small || type == RtfSessionType.large)
                {
                    //                    if (bConnected)  // 세션이 접속되있는 상태일때만 대기상태로
                    //                    {
                    ReadyEventArgs args = new ReadyEventArgs(nSeq, type);
                    ReadyEvent(this, args);
                    //                    }
                }
            }
        }
Example #2
0
        public void OnSessionReady(object sender, ReadyEventArgs e)
        {
            if (_bShutDownProc) //
            {
                Debug.WriteLine("_bShutDownProc: true");
                return;
            }

            /*
             * RtfSession session = sender as RtfSession;
             * if (session != null)
             * {
             *  //접속이 끊어져서 대기상태가 된 경우
             *  if (session.bConnected == false)
             *  {
             *      Debug.WriteLine(string.Format("세션명={0}, SessionDataRcvEvent={1}", session.session_name, sender.GetHashCode().ToString()));
             *      return;
             *  }
             * }
             */
            /*
             * if (session != null)
             * {
             *  //접속이 끊어져서 대기상태가 된 경우
             *  if (session.bConnected == false)
             *  {
             *      //20130107 셧다운 동작이 아니면 해당 세션을 재접속 한다.
             *      if (_bShutDownProc == false)
             *      {
             *          session.ReconnectToServer();
             *      }
             *  }
             * }
             */

            //세션에 할당된 TRITEM 처리가 완료되 세션이 대기상태로 전환된 경우 발생

            //세션 할당에 실패한 경우 TRItem을 관리 맵에서 삭제
            RemoveTRItem(e.nSeq);

            bool bLarge = (e.type == RtfSessionType.large) ? true : false;

            DequeueReadyQueue(bLarge);

            //Debug.WriteLine("현재 쓰레드아이디:" + Thread.CurrentThread.ManagedThreadId.ToString(),"SessionDataRcvEvent");
            //Debug.WriteLine("SessionDataRcvEvent " + sender.GetHashCode().ToString());

            //쓰레드에 안전한 방식
            //RtfGlobal.MainForm.SendSystem("setdata", "");

            /*
             * if (RtfGlobal.MainForm.InvokeRequired)
             * {
             *  Debug.WriteLine("RtfGlobal.MainForm.InvokeRequired = true", "SessionDataRcvEvent");
             * }
             */
        }