internal static IEnvoyInfo CreateEnvoyInfo(ServerIdentity serverID)
{
IEnvoyInfo info = null;
if (null != serverID)
{
// Set the envoy sink chain
if (serverID.EnvoyChain == null)
{
serverID.RaceSetEnvoyChain(
serverID.ServerContext.CreateEnvoyChain(
serverID.TPOrObject));
}
// Create an envoy info object only if necessary
IMessageSink sink = serverID.EnvoyChain as EnvoyTerminatorSink;
if(null == sink)
{
// The chain consists of more than a terminator sink
// Go ahead and create an envoy info structure, otherwise
// a null is returned and we recreate the terminator sink
// on the other side, automatically.
info = new EnvoyInfo(serverID.EnvoyChain);
}
}
return info;
}