コード例 #1
0
        public static WsrmFault ValidateTerminateSequenceResponse(ChannelReliableSession session, UniqueId messageId, WsrmMessageInfo info, long last)
        {
            string exceptionMessage = null;
            string faultReason      = null;

            if (info.WsrmHeaderFault is UnknownSequenceFault)
            {
                return(null);
            }
            if (info.TerminateSequenceResponseInfo == null)
            {
                exceptionMessage = System.ServiceModel.SR.GetString("InvalidWsrmResponseSessionFaultedExceptionString", new object[] { "TerminateSequence", info.Action, "http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequenceResponse" });
                faultReason      = System.ServiceModel.SR.GetString("InvalidWsrmResponseSessionFaultedFaultString", new object[] { "TerminateSequence", info.Action, "http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequenceResponse" });
            }
            else if (!object.Equals(messageId, info.TerminateSequenceResponseInfo.RelatesTo))
            {
                exceptionMessage = System.ServiceModel.SR.GetString("WsrmMessageWithWrongRelatesToExceptionString", new object[] { "TerminateSequence" });
                faultReason      = System.ServiceModel.SR.GetString("WsrmMessageWithWrongRelatesToFaultString", new object[] { "TerminateSequence" });
            }
            else
            {
                return(ValidateFinalAck(session, info, last));
            }
            return(SequenceTerminatedFault.CreateProtocolFault(session.OutputID, faultReason, exceptionMessage));
        }
コード例 #2
0
        public static WsrmFault ValidateFinalAck(ChannelReliableSession session, WsrmMessageInfo info, long last)
        {
            WsrmAcknowledgmentInfo acknowledgementInfo = info.AcknowledgementInfo;
            WsrmFault fault = ValidateFinalAckExists(session, acknowledgementInfo);

            if (fault != null)
            {
                return(fault);
            }
            SequenceRangeCollection ranges = acknowledgementInfo.Ranges;

            if (last == 0L)
            {
                if (ranges.Count == 0)
                {
                    return(null);
                }
            }
            else if (ranges.Count == 1)
            {
                SequenceRange range = ranges[0];
                if (range.Lower == 1L)
                {
                    SequenceRange range2 = ranges[0];
                    if (range2.Upper == last)
                    {
                        return(null);
                    }
                }
            }
            return(new InvalidAcknowledgementFault(session.OutputID, acknowledgementInfo.Ranges));
        }
コード例 #3
0
        public static WsrmFault ValidateFinalAckExists(ChannelReliableSession session, WsrmAcknowledgmentInfo ackInfo)
        {
            if ((ackInfo != null) && ackInfo.Final)
            {
                return(null);
            }
            string exceptionMessage = System.ServiceModel.SR.GetString("MissingFinalAckExceptionString");
            string faultReason      = System.ServiceModel.SR.GetString("SequenceTerminatedMissingFinalAck");

            return(SequenceTerminatedFault.CreateProtocolFault(session.OutputID, faultReason, exceptionMessage));
        }
コード例 #4
0
 public static bool ValidateWsrmRequest(ChannelReliableSession session, WsrmRequestInfo info, IReliableChannelBinder binder, RequestContext context)
 {
     if (!(info is CloseSequenceInfo) && !(info is TerminateSequenceInfo))
     {
         throw Fx.AssertAndThrow("Method is meant for CloseSequence or TerminateSequence only.");
     }
     if (info.ReplyTo.Uri != binder.RemoteAddress.Uri)
     {
         string    faultReason      = System.ServiceModel.SR.GetString("WsrmRequestIncorrectReplyToFaultString", new object[] { info.RequestName });
         string    exceptionMessage = System.ServiceModel.SR.GetString("WsrmRequestIncorrectReplyToExceptionString", new object[] { info.RequestName });
         WsrmFault fault            = SequenceTerminatedFault.CreateProtocolFault(session.InputID, faultReason, exceptionMessage);
         session.OnLocalFault(fault.CreateException(), fault, context);
         return(false);
     }
     return(true);
 }
コード例 #5
0
        public ReliableChannelOpenAsyncResult(IReliableChannelBinder binder, ChannelReliableSession session, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
        {
            this.binder        = binder;
            this.session       = session;
            this.timeoutHelper = new TimeoutHelper(timeout);
            bool      flag  = false;
            bool      flag2 = true;
            Exception e     = null;

            try
            {
                IAsyncResult result = this.binder.BeginOpen(this.timeoutHelper.RemainingTime(), onBinderOpenComplete, this);
                flag2 = false;
                if (result.CompletedSynchronously)
                {
                    flag = this.CompleteBinderOpen(true, result);
                }
            }
            catch (Exception exception2)
            {
                if (Fx.IsFatal(exception2))
                {
                    throw;
                }
                if (flag2 || this.CloseBinder(e))
                {
                    throw;
                }
            }
            finally
            {
                if (flag2)
                {
                    this.binder.Abort();
                }
            }
            if (flag)
            {
                base.Complete(true);
            }
        }
 public ReliableChannelOpenAsyncResult(IReliableChannelBinder binder, ChannelReliableSession session, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.binder = binder;
     this.session = session;
     this.timeoutHelper = new TimeoutHelper(timeout);
     bool flag = false;
     bool flag2 = true;
     Exception e = null;
     try
     {
         IAsyncResult result = this.binder.BeginOpen(this.timeoutHelper.RemainingTime(), onBinderOpenComplete, this);
         flag2 = false;
         if (result.CompletedSynchronously)
         {
             flag = this.CompleteBinderOpen(true, result);
         }
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2))
         {
             throw;
         }
         if (flag2 || this.CloseBinder(e))
         {
             throw;
         }
     }
     finally
     {
         if (flag2)
         {
             this.binder.Abort();
         }
     }
     if (flag)
     {
         base.Complete(true);
     }
 }