Ejemplo n.º 1
0
        public bool EndTryReceiveRequest(IAsyncResult asyncResult, out RequestContext requestContext)
        {
            if (asyncResult == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("asyncResult");
            }

            ReceiveTimeoutAsyncResult result = asyncResult as ReceiveTimeoutAsyncResult;

            if (result == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.AsyncEndCalledWithAnIAsyncResult)));
            }

            RequestContext innerContext;

            if (InnerChannel.EndTryReceiveRequest(result.InnerResult, out innerContext))
            {
                requestContext = FinishReceiveRequest(innerContext, result.TimeoutHelper.RemainingTime());
                return(true);
            }
            else
            {
                requestContext = null;
                return(false);
            }
        }
        public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context)
        {
            RequestContext innerContext;

            context = null;
            if (!InnerChannel.EndTryReceiveRequest(result, out innerContext))
            {
                return(false);
            }

            context = WrapRequestContext(innerContext);
            return(true);
        }