using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Channels
{
/// Holds the stack of client channel sinks that must be invoked during an asynchronous message response decoding.
// Token: 0x02000398 RID: 920
[ComVisible(true)]
public class ClientChannelSinkStack : IClientChannelSinkStack, IClientResponseChannelSinkStack
{
/// Initializes a new instance of the class with default values.
// Token: 0x06002577 RID: 9591 RVA: 0x0007C744 File Offset: 0x0007A944
public ClientChannelSinkStack()
{
}
/// Initializes a new instance of the class with the specified reply sink.
/// The that the current stack can use to reply to messages.
// Token: 0x06002578 RID: 9592 RVA: 0x0007C74C File Offset: 0x0007A94C
public ClientChannelSinkStack(IMessageSink replySink)
{
this._replySink = replySink;
}
/// Requests asynchronous processing of a method call on the sinks that are in the current sink stack.
/// The headers that are retrieved from the server response stream.
/// The stream that is returning from the transport sink.
/// The current sink stack is empty.
///
///
///
// Token: 0x06002579 RID: 9593 RVA: 0x0007C75C File Offset: 0x0007A95C
public void AsyncProcessResponse(ITransportHeaders headers, Stream stream)
{
if (this._sinkStack == null)
{
throw new RemotingException("The current sink stack is empty");
}
ChanelSinkStackEntry sinkStack = this._sinkStack;
this._sinkStack = this._sinkStack.Next;
((IClientChannelSink)sinkStack.Sink).AsyncProcessResponse(this, sinkStack.State, headers, stream);
}
/// Dispatches the specified exception on the reply sink.
/// The exception to dispatch to the server.
///
///
///
// Token: 0x0600257A RID: 9594 RVA: 0x0007C7B0 File Offset: 0x0007A9B0
public void DispatchException(Exception e)
{
this.DispatchReplyMessage(new ReturnMessage(e, null));
}
/// Dispatches the specified reply message on the reply sink.
/// The to dispatch.
///
///
///
// Token: 0x0600257B RID: 9595 RVA: 0x0007C7C0 File Offset: 0x0007A9C0
public void DispatchReplyMessage(IMessage msg)
{
if (this._replySink != null)
{
this._replySink.SyncProcessMessage(msg);
}
}
/// Pops the information that is associated with all the sinks from the sink stack up to and including the specified sink.
/// Information generated on the request side and associated with the specified sink.
/// The sink to remove and return from the sink stack.
/// The current sink stack is empty, or the specified sink was never pushed onto the current stack.
///
///
///
// Token: 0x0600257C RID: 9596 RVA: 0x0007C7DC File Offset: 0x0007A9DC
public object Pop(IClientChannelSink sink)
{
while (this._sinkStack != null)
{
ChanelSinkStackEntry sinkStack = this._sinkStack;
this._sinkStack = this._sinkStack.Next;
if (sinkStack.Sink == sink)
{
return sinkStack.State;
}
}
throw new RemotingException("The current sink stack is empty, or the specified sink was never pushed onto the current stack");
}
/// Pushes the specified sink and information that is associated with it onto the sink stack.
/// The sink to push onto the sink stack.
/// Information generated on the request side that is needed on the response side.
///
///
///
// Token: 0x0600257D RID: 9597 RVA: 0x0007C830 File Offset: 0x0007AA30
public void Push(IClientChannelSink sink, object state)
{
this._sinkStack = new ChanelSinkStackEntry(sink, state, this._sinkStack);
}
// Token: 0x04000EB3 RID: 3763
private IMessageSink _replySink;
// Token: 0x04000EB4 RID: 3764
private ChanelSinkStackEntry _sinkStack;
}
}