Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }