public Message Receive(TimeSpan timeout) { Message message = null; if (DoneReceivingInCurrentState()) { return(null); } bool shouldFault = true; try { message = MessageSource.Receive(timeout); OnReceiveMessage(message); shouldFault = false; return(message); } finally { if (shouldFault) { if (message != null) { message.Close(); message = null; } Fault(); } } }
private void EnsureInputClosed(TimeSpan timeout) { Message message = MessageSource.Receive(timeout); if (message != null) { using (message) { ProtocolException error = ProtocolException.ReceiveShutdownReturnedNonNull(message); throw TraceUtility.ThrowHelperError(error, message); } } }