Inheritance: System.Runtime.Remoting.Messaging.InternalSink, IMessageSink
 internal static CrossAppDomainSink FindOrCreateSink(
     IntPtr srvContextID, int srvDomainID)
 {
     lock (staticSyncObject) {
         // Note: keep this in sync with DomainUnloaded below
         int key = srvDomainID;
         if (_sinks == null)
         {
             GrowArrays(0);
         }
         int i = 0;
         while (_sinks[i] != null)
         {
             if (_sinkKeys[i] == key)
             {
                 return(_sinks[i]);
             }
             i++;
             if (i == _sinks.Length)
             {
                 // could not find a sink, also need to Grow the array.
                 GrowArrays(i);
                 break;
             }
         }
         // At this point we need to create a new sink and cache
         // it at location "i"
         _sinks[i]    = new CrossAppDomainSink(srvContextID, srvDomainID);
         _sinkKeys[i] = key;
         return(_sinks[i]);
     }
 }
Esempio n. 2
0
        // Token: 0x060058CC RID: 22732 RVA: 0x0013836C File Offset: 0x0013656C
        internal static CrossAppDomainSink FindOrCreateSink(CrossAppDomainData xadData)
        {
            object             obj = CrossAppDomainSink.staticSyncObject;
            CrossAppDomainSink result;

            lock (obj)
            {
                int domainID = xadData.DomainID;
                if (CrossAppDomainSink._sinks == null)
                {
                    CrossAppDomainSink.GrowArrays(0);
                }
                int num = 0;
                while (CrossAppDomainSink._sinks[num] != null)
                {
                    if (CrossAppDomainSink._sinkKeys[num] == domainID)
                    {
                        return(CrossAppDomainSink._sinks[num]);
                    }
                    num++;
                    if (num == CrossAppDomainSink._sinks.Length)
                    {
                        CrossAppDomainSink.GrowArrays(num);
                        break;
                    }
                }
                CrossAppDomainSink._sinks[num]    = new CrossAppDomainSink(xadData);
                CrossAppDomainSink._sinkKeys[num] = domainID;
                result = CrossAppDomainSink._sinks[num];
            }
            return(result);
        }
Esempio n. 3
0
 internal static CrossAppDomainSink FindOrCreateSink(CrossAppDomainData xadData)
 {
     lock (staticSyncObject)
     {
         int domainID = xadData.DomainID;
         if (_sinks == null)
         {
             GrowArrays(0);
         }
         int index = 0;
         while (_sinks[index] != null)
         {
             if (_sinkKeys[index] == domainID)
             {
                 return(_sinks[index]);
             }
             index++;
             if (index == _sinks.Length)
             {
                 GrowArrays(index);
                 break;
             }
         }
         _sinks[index]    = new CrossAppDomainSink(xadData);
         _sinkKeys[index] = domainID;
         return(_sinks[index]);
     }
 }
Esempio n. 4
0
 internal static CrossAppDomainSink FindOrCreateSink(CrossAppDomainData xadData)
 {
     lock (CrossAppDomainSink.staticSyncObject)
     {
         int local_2 = xadData.DomainID;
         if (CrossAppDomainSink._sinks == null)
         {
             CrossAppDomainSink.GrowArrays(0);
         }
         int local_3 = 0;
         while (CrossAppDomainSink._sinks[local_3] != null)
         {
             if (CrossAppDomainSink._sinkKeys[local_3] == local_2)
             {
                 return(CrossAppDomainSink._sinks[local_3]);
             }
             ++local_3;
             if (local_3 == CrossAppDomainSink._sinks.Length)
             {
                 CrossAppDomainSink.GrowArrays(local_3);
                 break;
             }
         }
         CrossAppDomainSink._sinks[local_3]    = new CrossAppDomainSink(xadData);
         CrossAppDomainSink._sinkKeys[local_3] = local_2;
         return(CrossAppDomainSink._sinks[local_3]);
     }
 }
        [System.Security.SecurityCritical]  // auto-generated
        public virtual IMessageSink CreateMessageSink(String url, Object data,
                                                      out String objectURI)
        {
            // Set the out parameters
            objectURI = null;
            IMessageSink sink = null;

            // <


            if ((null != url) && (data == null))
            {
                if (url.StartsWith(_channelName, StringComparison.Ordinal))
                {
                    throw new RemotingException(
                              Environment.GetResourceString(
                                  "Remoting_AppDomains_NYI"));
                }
            }
            else
            {
                Message.DebugOut("XAPPDOMAIN::Creating sink for data \n");
                CrossAppDomainData xadData = data as CrossAppDomainData;
                if (null != xadData)
                {
                    if (xadData.ProcessGuid.Equals(Identity.ProcessGuid))
                    {
                        sink = CrossAppDomainSink.FindOrCreateSink(xadData);
                    }
                }
            }
            return(sink);
        }
Esempio n. 6
0
 // Token: 0x060058CB RID: 22731 RVA: 0x001382DC File Offset: 0x001364DC
 internal static void GrowArrays(int oldSize)
 {
     if (CrossAppDomainSink._sinks == null)
     {
         CrossAppDomainSink._sinks    = new CrossAppDomainSink[8];
         CrossAppDomainSink._sinkKeys = new int[8];
         return;
     }
     CrossAppDomainSink[] array = new CrossAppDomainSink[CrossAppDomainSink._sinks.Length + 8];
     int[] array2 = new int[CrossAppDomainSink._sinkKeys.Length + 8];
     Array.Copy(CrossAppDomainSink._sinks, array, CrossAppDomainSink._sinks.Length);
     Array.Copy(CrossAppDomainSink._sinkKeys, array2, CrossAppDomainSink._sinkKeys.Length);
     CrossAppDomainSink._sinks    = array;
     CrossAppDomainSink._sinkKeys = array2;
 }
 // Note: this should be called from within a synch-block
 internal static void GrowArrays(int oldSize)
 {
     if (_sinks == null)
     {
         _sinks    = new CrossAppDomainSink[GROW_BY];
         _sinkKeys = new int[GROW_BY];
     }
     else
     {
         CrossAppDomainSink[] tmpSinks = new CrossAppDomainSink[_sinks.Length + GROW_BY];
         int[] tmpKeys = new int[_sinkKeys.Length + GROW_BY];
         Array.Copy(_sinks, tmpSinks, _sinks.Length);
         Array.Copy(_sinkKeys, tmpKeys, _sinkKeys.Length);
         _sinks    = tmpSinks;
         _sinkKeys = tmpKeys;
     }
 }
Esempio n. 8
0
 internal static void GrowArrays(int oldSize)
 {
     if (_sinks == null)
     {
         _sinks    = new CrossAppDomainSink[8];
         _sinkKeys = new int[8];
     }
     else
     {
         CrossAppDomainSink[] destinationArray = new CrossAppDomainSink[_sinks.Length + 8];
         int[] numArray = new int[_sinkKeys.Length + 8];
         Array.Copy(_sinks, destinationArray, _sinks.Length);
         Array.Copy(_sinkKeys, numArray, _sinkKeys.Length);
         _sinks    = destinationArray;
         _sinkKeys = numArray;
     }
 }
Esempio n. 9
0
 public virtual IMessageSink CreateMessageSink(string url, object data, out string uri)
 {
     uri = null;
     if (data != null)
     {
         CrossAppDomainData crossAppDomainData = data as CrossAppDomainData;
         if (crossAppDomainData != null && crossAppDomainData.ProcessID == RemotingConfiguration.ProcessId)
         {
             return(CrossAppDomainSink.GetSink(crossAppDomainData.DomainID));
         }
     }
     if (url != null && url.StartsWith("MONOCAD"))
     {
         throw new NotSupportedException("Can't create a named channel via crossappdomain");
     }
     return(null);
 }
Esempio n. 10
0
 internal static void GrowArrays(int oldSize)
 {
     if (CrossAppDomainSink._sinks == null)
     {
         CrossAppDomainSink._sinks    = new CrossAppDomainSink[8];
         CrossAppDomainSink._sinkKeys = new int[8];
     }
     else
     {
         CrossAppDomainSink[] crossAppDomainSinkArray = new CrossAppDomainSink[CrossAppDomainSink._sinks.Length + 8];
         int[] numArray = new int[CrossAppDomainSink._sinkKeys.Length + 8];
         Array.Copy((Array)CrossAppDomainSink._sinks, (Array)crossAppDomainSinkArray, CrossAppDomainSink._sinks.Length);
         Array.Copy((Array)CrossAppDomainSink._sinkKeys, (Array)numArray, CrossAppDomainSink._sinkKeys.Length);
         CrossAppDomainSink._sinks    = crossAppDomainSinkArray;
         CrossAppDomainSink._sinkKeys = numArray;
     }
 }
Esempio n. 11
0
        internal static object DoTransitionDispatchCallback(object[] args)
        {
            byte[] reqStmBuff = (byte[])args[0];
            SmuggledMethodCallMessage   smuggledMcm = (SmuggledMethodCallMessage)args[1];
            SmuggledMethodReturnMessage smuggledMethodReturnMessage = null;

            byte[] result = null;
            try
            {
                result = CrossAppDomainSink.DoDispatch(reqStmBuff, smuggledMcm, out smuggledMethodReturnMessage);
            }
            catch (Exception e)
            {
                IMessage msg = new ReturnMessage(e, new ErrorMessage());
                result = CrossAppDomainSerializer.SerializeMessage(msg).GetBuffer();
            }
            args[2] = smuggledMethodReturnMessage;
            return(result);
        }
Esempio n. 12
0
        internal static object DoTransitionDispatchCallback(object[] args)
        {
            byte[] reqStmBuff = (byte[])args[0];
            SmuggledMethodCallMessage   smuggledMcm = (SmuggledMethodCallMessage)args[1];
            SmuggledMethodReturnMessage smuggledMrm = (SmuggledMethodReturnMessage)null;

            byte[] numArray;
            try
            {
                numArray = CrossAppDomainSink.DoDispatch(reqStmBuff, smuggledMcm, out smuggledMrm);
            }
            catch (Exception ex)
            {
                ErrorMessage errorMessage = new ErrorMessage();
                numArray = CrossAppDomainSerializer.SerializeMessage((IMessage) new ReturnMessage(ex, (IMethodCallMessage)errorMessage)).GetBuffer();
            }
            args[2] = (object)smuggledMrm;
            return((object)numArray);
        }
        internal static CrossAppDomainSink GetSink(int domainID)
        {
            // Check if we have a sink for the current domainID
            // note, locking is not to bad here, very few class to GetSink
            lock (s_sinks.SyncRoot)
            {
                if (s_sinks.ContainsKey(domainID))
                {
                    return((CrossAppDomainSink)s_sinks[domainID]);
                }
                else
                {
                    CrossAppDomainSink sink = new CrossAppDomainSink(domainID);
                    s_sinks[domainID] = sink;

                    return(sink);
                }
            }
        }
Esempio n. 14
0
        internal static CrossAppDomainSink GetSink(int domainID)
        {
            object             syncRoot = CrossAppDomainSink.s_sinks.SyncRoot;
            CrossAppDomainSink result;

            lock (syncRoot)
            {
                if (CrossAppDomainSink.s_sinks.ContainsKey(domainID))
                {
                    result = (CrossAppDomainSink)CrossAppDomainSink.s_sinks[domainID];
                }
                else
                {
                    CrossAppDomainSink crossAppDomainSink = new CrossAppDomainSink(domainID);
                    CrossAppDomainSink.s_sinks[domainID] = crossAppDomainSink;
                    result = crossAppDomainSink;
                }
            }
            return(result);
        }
Esempio n. 15
0
        public virtual IMessageSink CreateMessageSink(string url, object data, out string objectURI)
        {
            objectURI = null;
            IMessageSink sink = null;

            if ((url != null) && (data == null))
            {
                if (url.StartsWith("XAPPDMN", StringComparison.Ordinal))
                {
                    throw new RemotingException(Environment.GetResourceString("Remoting_AppDomains_NYI"));
                }
                return(sink);
            }
            CrossAppDomainData xadData = data as CrossAppDomainData;

            if ((xadData != null) && xadData.ProcessGuid.Equals(Identity.ProcessGuid))
            {
                sink = CrossAppDomainSink.FindOrCreateSink(xadData);
            }
            return(sink);
        }
        // IChannelSender
        public virtual IMessageSink CreateMessageSink(String url, Object data, out String uri)
        {
            uri = null;

            if (data != null)
            {
                // Get the data and then get the sink
                CrossAppDomainData cadData = data as CrossAppDomainData;
                if (cadData != null && cadData.ProcessID == RemotingConfiguration.ProcessId)
                {
                    // GetSink creates a new sink if we don't have any (use contexts here later)
                    return(CrossAppDomainSink.GetSink(cadData.DomainID));
                }
            }
            if (url != null && url.StartsWith(_strName))
            {
                throw new NotSupportedException("Can't create a named channel via crossappdomain");
            }

            return(null);
        }
        public virtual IMessageSink CreateMessageSink(String url, Object data,
                                                      out String objectURI)
        {
            // Set the out parameters
            objectURI = null;
            IMessageSink sink = null;

            // FUTURE: this url parsing part will be useful only when
            // we have wellknown x-appdomain objects (that use the appdomain
            // channel)
            if ((null != url) && (data == null))
            {
                if (url.StartsWith(_channelName))
                {
                    throw new RemotingException(
                              Environment.GetResourceString(
                                  "Remoting_AppDomains_NYI"));
                }
            }
            else
            {
                Message.DebugOut("XAPPDOMAIN::Creating sink for data \n");
                CrossAppDomainData xadData = data as CrossAppDomainData;
                if (null != xadData)
                {
                    if (xadData.ProcessGuid.Equals(Identity.ProcessGuid))
                    {
                        int srvContextID = xadData.ContextID;
                        int srvDomainID  = xadData.DomainID;
                        sink = CrossAppDomainSink.FindOrCreateSink(
                            srvContextID,
                            srvDomainID
                            );
                    }
                }
            }
            return(sink);
        }
 internal static CrossAppDomainSink FindOrCreateSink(CrossAppDomainData xadData)
 {
     //
     // WARNING: Do not read any value type member of xadData in this method!!
     //          xadData is not completely deserialized at this point.  See
     //          warning in CrossAppDomainSink::.ctor above
     //
     lock (staticSyncObject) {
         // Note: keep this in [....] with DomainUnloaded below
         int key = xadData.DomainID;
         if (_sinks == null)
         {
             GrowArrays(0);
         }
         int i = 0;
         while (_sinks[i] != null)
         {
             if (_sinkKeys[i] == key)
             {
                 return(_sinks[i]);
             }
             i++;
             if (i == _sinks.Length)
             {
                 // could not find a sink, also need to Grow the array.
                 GrowArrays(i);
                 break;
             }
         }
         // At this point we need to create a new sink and cache
         // it at location "i"
         _sinks[i]    = new CrossAppDomainSink(xadData);
         _sinkKeys[i] = key;
         return(_sinks[i]);
     }
 }
Esempio n. 19
0
		internal static CrossAppDomainSink GetSink(int domainID) 
		{
			// Check if we have a sink for the current domainID
			// note, locking is not to bad here, very few class to GetSink
			lock (s_sinks.SyncRoot) 
			{
				if (s_sinks.ContainsKey(domainID)) 
					return (CrossAppDomainSink) s_sinks[domainID];
				else 
				{
					CrossAppDomainSink sink = new CrossAppDomainSink(domainID);
					s_sinks[domainID] = sink;

					return sink;
				}
			}
		}
Esempio n. 20
0
 internal static CrossAppDomainSink FindOrCreateSink(
     IntPtr srvContextID, int srvDomainID)
 {
     lock(staticSyncObject) {        
         // Note: keep this in sync with DomainUnloaded below 
         int key = srvDomainID;
         if (_sinks == null)
         {
             GrowArrays(0);
         }
         int i=0;
         while (_sinks[i] != null)
         {
             if (_sinkKeys[i] == key)
             {
                 return _sinks[i];
             }
             i++;
             if (i == _sinks.Length)
             {
                 // could not find a sink, also need to Grow the array.
                 GrowArrays(i);
                 break;
             }
         }
         // At this point we need to create a new sink and cache
         // it at location "i"
         _sinks[i] = new CrossAppDomainSink(srvContextID, srvDomainID);
         _sinkKeys[i] = key;
         return _sinks[i];
     }
 }
 internal static CrossAppDomainSink FindOrCreateSink(CrossAppDomainData xadData)
 {
     lock (staticSyncObject)
     {
         int domainID = xadData.DomainID;
         if (_sinks == null)
         {
             GrowArrays(0);
         }
         int index = 0;
         while (_sinks[index] != null)
         {
             if (_sinkKeys[index] == domainID)
             {
                 return _sinks[index];
             }
             index++;
             if (index == _sinks.Length)
             {
                 GrowArrays(index);
                 break;
             }
         }
         _sinks[index] = new CrossAppDomainSink(xadData);
         _sinkKeys[index] = domainID;
         return _sinks[index];
     }
 }
Esempio n. 22
0
 internal static CrossAppDomainSink FindOrCreateSink(CrossAppDomainData xadData)
 {
     //
     // WARNING: Do not read any value type member of xadData in this method!!
     //          xadData is not completely deserialized at this point.  See 
     //          warning in CrossAppDomainSink::.ctor above
     //
     lock(staticSyncObject) {        
         // Note: keep this in sync with DomainUnloaded below 
         int key = xadData.DomainID;
         if (_sinks == null)
         {
             GrowArrays(0);
         }
         int i=0;
         while (_sinks[i] != null)
         {
             if (_sinkKeys[i] == key)
             {
                 return _sinks[i];
             }
             i++;
             if (i == _sinks.Length)
             {
                 // could not find a sink, also need to Grow the array.
                 GrowArrays(i);
                 break;
             }
         }
         // At this point we need to create a new sink and cache
         // it at location "i"
         _sinks[i] = new CrossAppDomainSink(xadData);
         _sinkKeys[i] = key;
         return _sinks[i];
     }
 }
Esempio n. 23
0
 // Note: this should be called from within a synch-block
 internal static void GrowArrays(int oldSize)
 {
     if (_sinks == null)
     {
         _sinks = new CrossAppDomainSink[GROW_BY];
         _sinkKeys = new int[GROW_BY];
     }
     else
     {
         CrossAppDomainSink[] tmpSinks = new CrossAppDomainSink[_sinks.Length + GROW_BY];
         int[] tmpKeys = new int[_sinkKeys.Length + GROW_BY];
         Array.Copy(_sinks, tmpSinks, _sinks.Length);
         Array.Copy(_sinkKeys, tmpKeys, _sinkKeys.Length);    
         _sinks = tmpSinks;
         _sinkKeys = tmpKeys;
     }
 }
 internal static void GrowArrays(int oldSize)
 {
     if (_sinks == null)
     {
         _sinks = new CrossAppDomainSink[8];
         _sinkKeys = new int[8];
     }
     else
     {
         CrossAppDomainSink[] destinationArray = new CrossAppDomainSink[_sinks.Length + 8];
         int[] numArray = new int[_sinkKeys.Length + 8];
         Array.Copy(_sinks, destinationArray, _sinks.Length);
         Array.Copy(_sinkKeys, numArray, _sinkKeys.Length);
         _sinks = destinationArray;
         _sinkKeys = numArray;
     }
 }