} // CreateChannelSinks internal static void SetEnvoyAndChannelSinks(Identity idObj, IMessageSink chnlSink, IMessageSink envoySink) { Message.DebugOut("Setting up envoy and channel sinks \n"); BCLDebug.Assert(null != idObj,"null != idObj"); // Decide if we need to set the envoy sink chain if (null == idObj.ChannelSink) { if (null != chnlSink) { idObj.RaceSetChannelSink(chnlSink); } } // Decide if we need to set the envoy sink chain if (null == idObj.EnvoyChain) { if (null != envoySink) { idObj.RaceSetEnvoyChain(envoySink); } else { throw new RemotingException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Remoting_BadInternalState_FailEnvoySink"))); } } }
IntPtr _privateData; // Used for DoCallbackInEE // The _delegate should really be on an agile object otherwise // the whole point of doing a callBack is moot. However, even if it // is not, remoting and serialization together will ensure that // everything happens as expected and there is no smuggling. internal TransitionCall( IntPtr targetCtxID, CrossContextDelegate deleg) { BCLDebug.Assert(targetCtxID!=IntPtr.Zero, "bad target ctx for call back"); _sourceCtxID = Thread.CurrentContext.InternalContextID; _targetCtxID = targetCtxID; _delegate = deleg; _targetDomainID = 0; _privateData = IntPtr.Zero; // We are going to another context in the same app domain _srvID = new ServerIdentity( null, Thread.GetContextInternal(_targetCtxID)); _ID = _srvID; _ID.RaceSetChannelSink(CrossContextChannel.MessageSink); _srvID.RaceSetServerObjectChain(this); //DBG Console.WriteLine("### TransitionCall ctor: " + Int32.Format(_sourceCtxID,"x") + ":" + Int32.Format(_targetCtxID,"x")); } // TransitionCall
} // TransitionCall // This constructor should be used for cross appdomain case. internal TransitionCall(IntPtr targetCtxID, IntPtr privateData, int targetDomainID) { BCLDebug.Assert(targetCtxID != IntPtr.Zero, "bad target ctx for call back"); BCLDebug.Assert(targetDomainID != 0, "bad target ctx for call back"); _sourceCtxID = Thread.CurrentContext.InternalContextID; _targetCtxID = targetCtxID; _delegate = null; _targetDomainID = targetDomainID; _privateData = privateData; // In the cross domain case, the client side just has a base Identity // and the server domain has the Server identity. We fault in the latter // when requested later. // We are going to a context in another app domain _srvID = null; _ID = new Identity("TransitionCallURI", null); // Create the data needed for the channel sink creation CrossAppDomainData data = new CrossAppDomainData(_targetCtxID, _targetDomainID, Identity.ProcessGuid); String unUsed; IMessageSink channelSink = CrossAppDomainChannel.AppDomainChannel.CreateMessageSink( null, //uri data, //channelData out unUsed);//out objURI BCLDebug.Assert(channelSink != null, "X-domain transition failure"); _ID.RaceSetChannelSink(channelSink); } // TransitionCall
internal static void SetEnvoyAndChannelSinks(Identity idObj, IMessageSink chnlSink, IMessageSink envoySink) { if ((idObj.ChannelSink == null) && (chnlSink != null)) { idObj.RaceSetChannelSink(chnlSink); } if (idObj.EnvoyChain == null) { if (envoySink == null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadInternalState_FailEnvoySink"), new object[0])); } idObj.RaceSetEnvoyChain(envoySink); } }