Exemple #1
0
        internal bool EndTryAccept(IAsyncResult result, out IChannelBinder channelBinder)
        {
            ErrorHandlingCompletedAsyncResult handlerResult = result as ErrorHandlingCompletedAsyncResult;

            if (handlerResult != null)
            {
                channelBinder = null;
                return(ErrorHandlingCompletedAsyncResult.End(handlerResult));
            }
            else
            {
                try
                {
                    channelBinder = this.binder.EndAccept(result);
                    if (channelBinder != null)
                    {
                        this.dispatcher.PendingChannels.Add(channelBinder.Channel);
                    }
                    return(true);
                }
                catch (CommunicationObjectAbortedException)
                {
                    channelBinder = null;
                    return(true);
                }
                catch (CommunicationObjectFaultedException)
                {
                    channelBinder = null;
                    return(true);
                }
                catch (TimeoutException)
                {
                    channelBinder = null;
                    return(false);
                }
                catch (CommunicationException e)
                {
                    this.HandleError(e);
                    channelBinder = null;
                    return(false);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    this.HandleErrorOrAbort(e);
                    channelBinder = null;
                    return(false);
                }
            }
        }
        internal bool EndTryReceive(IAsyncResult result, out RequestContext requestContext)
        {
            ErrorHandlingCompletedAsyncResult handlerResult = result as ErrorHandlingCompletedAsyncResult;

            if (handlerResult != null)
            {
                requestContext = null;
                return(ErrorHandlingCompletedAsyncResult.End(handlerResult));
            }
            else
            {
                try
                {
                    return(_binder.EndTryReceive(result, out requestContext));
                }
                catch (CommunicationObjectAbortedException)
                {
                    requestContext = null;
                    return(true);
                }
                catch (CommunicationObjectFaultedException)
                {
                    requestContext = null;
                    return(true);
                }
                catch (CommunicationException e)
                {
                    this.HandleError(e);
                    requestContext = null;
                    return(false);
                }
                catch (TimeoutException e)
                {
                    this.HandleError(e);
                    requestContext = null;
                    return(false);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    this.HandleErrorOrAbort(e);
                    requestContext = null;
                    return(false);
                }
            }
        }
Exemple #3
0
        internal bool EndTryReceive(IAsyncResult result, out RequestContext requestContext)
        {
            ErrorHandlingCompletedAsyncResult result2 = result as ErrorHandlingCompletedAsyncResult;

            if (result2 != null)
            {
                requestContext = null;
                return(CompletedAsyncResult <bool> .End(result2));
            }
            try
            {
                return(this.binder.EndTryReceive(result, out requestContext));
            }
            catch (CommunicationObjectAbortedException)
            {
                requestContext = null;
                return(true);
            }
            catch (CommunicationObjectFaultedException)
            {
                requestContext = null;
                return(true);
            }
            catch (CommunicationException exception)
            {
                this.HandleError(exception);
                requestContext = null;
                return(false);
            }
            catch (TimeoutException exception2)
            {
                this.HandleError(exception2);
                requestContext = null;
                return(false);
            }
            catch (Exception exception3)
            {
                if (Fx.IsFatal(exception3))
                {
                    throw;
                }
                this.HandleErrorOrAbort(exception3);
                requestContext = null;
                return(false);
            }
        }