public CloseOutputSessionAsyncResult(FramingDuplexSessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     channel.ThrowIfNotOpened();
     channel.ThrowIfFaulted();
     this.timeoutHelper = new TimeoutHelper(timeout);
     this.channel       = channel;
     if (channel.sendLock.EnterAsync(this.timeoutHelper.RemainingTime(), onEnterComplete, this))
     {
         bool flag  = false;
         bool flag2 = false;
         try
         {
             flag  = this.WriteEndBytes();
             flag2 = true;
         }
         finally
         {
             if (!flag2)
             {
                 this.Cleanup(false, true);
             }
         }
         if (flag)
         {
             this.Cleanup(true, true);
             base.Complete(true);
         }
     }
 }
 public SendAsyncResult(FramingDuplexSessionChannel channel, Message message, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.timeoutHelper = new TimeoutHelper(timeout);
     this.channel       = channel;
     this.message       = message;
     if (channel.sendLock.EnterAsync(this.timeoutHelper.RemainingTime(), onEnterComplete, this))
     {
         bool flag  = false;
         bool flag2 = false;
         try
         {
             flag  = this.WriteCore();
             flag2 = true;
         }
         finally
         {
             if (!flag2)
             {
                 this.Cleanup(false, true);
             }
         }
         if (flag)
         {
             this.Cleanup(true, true);
             base.Complete(true);
         }
     }
 }
            public TryReceiveAsyncResult(FramingDuplexSessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
            {
                this.channel = channel;
                bool flag = false;

                try
                {
                    IAsyncResult result = this.channel.BeginReceive(timeout, onReceive, this);
                    if (result.CompletedSynchronously)
                    {
                        this.CompleteReceive(result);
                        flag = true;
                    }
                }
                catch (TimeoutException exception)
                {
                    if (DiagnosticUtility.ShouldTraceInformation)
                    {
                        DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
                    }
                    flag = true;
                }
                if (flag)
                {
                    base.Complete(true);
                }
            }
            public CloseAsyncResult(FramingDuplexSessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
            {
                this.channel       = channel;
                this.timeoutHelper = new TimeoutHelper(timeout);
                IAsyncResult result = channel.BeginCloseOutputSession(this.timeoutHelper.RemainingTime(), onCloseOutputSession, this);

                if (result.CompletedSynchronously && this.HandleCloseOutputSession(result, true))
                {
                    base.Complete(true);
                }
            }
Example #5
0
            public static FramingConnectionDuplexSession CreateSession(FramingDuplexSessionChannel channel,
                                                                       StreamUpgradeProvider upgrade)
            {
                StreamSecurityUpgradeProvider security = upgrade as StreamSecurityUpgradeProvider;

                if (security == null)
                {
                    return(new FramingConnectionDuplexSession(channel));
                }

                throw ExceptionHelper.PlatformNotSupported("SecureConnectionDuplexSession is not supported.");
            }
Example #6
0
            public static FramingConnectionDuplexSession CreateSession(FramingDuplexSessionChannel channel,
                                                                       StreamUpgradeProvider upgrade)
            {
                StreamSecurityUpgradeProvider security = upgrade as StreamSecurityUpgradeProvider;

                if (security == null)
                {
                    return(new FramingConnectionDuplexSession(channel));
                }
                else
                {
                    return(new SecureConnectionDuplexSession(channel));
                }
            }
Example #7
0
 public SecureConnectionDuplexSession(FramingDuplexSessionChannel channel)
     : base(channel)
 {
     // empty
 }
Example #8
0
 private FramingConnectionDuplexSession(FramingDuplexSessionChannel channel)
     : base(channel)
 {
 }
 public static FramingDuplexSessionChannel.ConnectionDuplexSession CreateSession(FramingDuplexSessionChannel channel, StreamUpgradeProvider upgrade)
 {
     if (upgrade is StreamSecurityUpgradeProvider)
     {
         return(new SecureConnectionDuplexSession(channel));
     }
     return(new FramingDuplexSessionChannel.ConnectionDuplexSession(channel));
 }
 private ConnectionDuplexSession(FramingDuplexSessionChannel channel)
 {
     this.channel = channel;
 }