/// <summary> /// Completes an asynchronous operation to send a request over the secure channel. /// </summary> public IServiceResponse EndSendRequest(IAsyncResult result) { if (m_wcfBypassChannel != null) { return(m_wcfBypassChannel.EndSendRequest(result)); } #if MANAGE_CHANNEL_THREADS return(SendRequestAsyncResult.WaitForComplete(result)); #else InvokeServiceResponseMessage responseMessage = EndInvokeService(result); return((IServiceResponse)BinaryDecoder.DecodeMessage(responseMessage.InvokeServiceResponse, null, m_messageContext)); #endif }
/// <summary> /// Checks for a valid IAsyncResult object and waits for the operation to complete. /// </summary> /// <param name="ar">The IAsyncResult object for the operation.</param> /// <returns>The response.</returns> public static new IServiceResponse WaitForComplete(IAsyncResult ar) { SendRequestAsyncResult result = ar as SendRequestAsyncResult; if (result == null) { throw new ArgumentException("End called with an invalid IAsyncResult object.", "ar"); } if (result.m_response == null && result.m_error == null) { if (!result.WaitForComplete()) { throw new TimeoutException(); } } if (result.m_error != null) { throw new ServiceResultException(result.m_error, StatusCodes.BadInternalError); } return(result.m_response); }