QuickFix.SessionState.GetNextSenderMsgSeqNum C# (CSharp) Method

GetNextSenderMsgSeqNum() public method

public GetNextSenderMsgSeqNum ( ) : int
return int
        public int GetNextSenderMsgSeqNum()
        {
            lock (sync_) { return this.MessageStore.GetNextSenderMsgSeqNum(); }
        }

Usage Example

Exemplo n.º 1
0
        protected void NextResendRequest(Message resendReq)
        {
            try
            {
                // FIXME
                int begSeqNo = resendReq.GetInt(Fields.Tags.BeginSeqNo);
                int endSeqNo = resendReq.GetInt(Fields.Tags.EndSeqNo);
                this.Log.OnEvent("Got resend request from " + begSeqNo + " to " + endSeqNo);

                if ((endSeqNo == 999999) || (endSeqNo == 0))
                {
                    endSeqNo = state_.GetNextSenderMsgSeqNum() - 1;
                }

                List <string> messages = new List <string>();
                state_.Get(begSeqNo, endSeqNo, messages);
                int current   = begSeqNo;
                int begin     = 0;
                int msgSeqNum = 0;
                foreach (string msgStr in messages)
                {
                    Message msg = new Message(msgStr);
                    msgSeqNum = msg.Header.GetInt(Tags.MsgSeqNum);

                    if ((current != msgSeqNum) && begin == 0)
                    {
                        begin = current;
                    }

                    if (IsAdminMessage(msg))
                    {
                        if (begin == 0)
                        {
                            begin = msgSeqNum;
                        }
                    }
                    else
                    {
                        initializeResendFields(msg);
                        if (begin != 0)
                        {
                            GenerateSequenceReset(begin, msgSeqNum);
                        }
                        Send(msg.ToString());
                        begin = 0;
                    }
                    current = msgSeqNum + 1;
                }

                if (begin != 0)
                {
                    GenerateSequenceReset(begin, msgSeqNum + 1);
                }

                if (endSeqNo > msgSeqNum)
                {
                    endSeqNo = endSeqNo + 1;
                    int next = state_.GetNextSenderMsgSeqNum();
                    if (endSeqNo > next)
                    {
                        endSeqNo = next;
                    }
                    GenerateSequenceReset(begSeqNo, endSeqNo);
                }

                msgSeqNum = resendReq.Header.GetInt(Tags.MsgSeqNum);
                if (!IsTargetTooHigh(msgSeqNum) && !IsTargetTooLow(msgSeqNum))
                {
                    state_.IncrNextTargetMsgSeqNum();
                }
            }
            catch (System.Exception e)
            {
                this.Log.OnEvent("ERROR during resend request " + e.Message);
            }
        }