示例#1
0
        /**********************************************
        * OpenXMLRPCChannel
        *
        * Generate a UUID channel key and add it and
        * the prim id to dictionary <channelUUID, primUUID>
        *
        * A custom channel key can be proposed.
        * Otherwise, passing UUID.Zero will generate
        * and return a random channel
        *
        * First check if there is a channel assigned for
        * this itemID.  If there is, then someone called
        * llOpenRemoteDataChannel twice.  Just return the
        * original channel.  Other option is to delete the
        * current channel and assign a new one.
        *
        * ********************************************/

        public UUID OpenXMLRPCChannel(uint localID, UUID itemID, UUID channelID)
        {
            UUID newChannel = UUID.Zero;

            // This should no longer happen, but the check is reasonable anyway
            if (null == m_openChannels)
            {
                m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete");
                return(newChannel);
            }

            //Is a dupe?
            foreach (RPCChannelInfo ci in m_openChannels.Values)
            {
                if (ci.GetItemID().Equals(itemID))
                {
                    // return the original channel ID for this item
                    newChannel = ci.GetChannelID();
                    break;
                }
            }

            if (newChannel == UUID.Zero)
            {
                newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID;
                RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel);
                lock (XMLRPCListLock)
                {
                    m_openChannels.Add(newChannel, rpcChanInfo);
                }
            }

            return(newChannel);
        }
        /**********************************************
        * OpenXMLRPCChannel
        *
        * Generate a UUID channel key and add it and
        * the prim id to dictionary <channelUUID, primUUID>
        *
        * A custom channel key can be proposed.
        * Otherwise, passing UUID.Zero will generate
        * and return a random channel
        *
        * First check if there is a channel assigned for
        * this itemID.  If there is, then someone called
        * llOpenRemoteDataChannel twice.  Just return the
        * original channel.  Other option is to delete the
        * current channel and assign a new one.
        *
        * ********************************************/

        public UUID OpenXMLRPCChannel(uint localID, UUID itemID, UUID channelID)
        {
            UUID newChannel = UUID.Zero;

            //Is a dupe?
            try
            {
                m_openChannels.ForEach(delegate(RPCChannelInfo ci)
                {
                    if (ci.GetItemID().Equals(itemID))
                    {
                        // return the original channel ID for this item
                        throw new ThreadedClasses.ReturnValueException <UUID>(ci.GetChannelID());
                    }
                });
            }
            catch (ThreadedClasses.ReturnValueException <UUID> e)
            {
                return(e.Value);
            }

            newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID;
            RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel);

            m_openChannels.Add(newChannel, rpcChanInfo);

            return(newChannel);
        }
示例#3
0
        /**********************************************
         * OpenXMLRPCChannel
         *
         * Generate a UUID channel key and add it and
         * the prim id to dictionary <channelUUID, primUUID>
         *
         * A custom channel key can be proposed.
         * Otherwise, passing UUID.Zero will generate
         * and return a random channel
         *
         * First check if there is a channel assigned for
         * this itemID.  If there is, then someone called
         * llOpenRemoteDataChannel twice.  Just return the
         * original channel.  Other option is to delete the
         * current channel and assign a new one.
         *
         * ********************************************/

        public UUID OpenXMLRPCChannel(uint localID, UUID itemID, UUID channelID)
        {
            UUID newChannel = UUID.Zero;

            // This should no longer happen, but the check is reasonable anyway
            if (null == m_openChannels)
            {
                m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete");
                return newChannel;
            }

            //Is a dupe?
            foreach (RPCChannelInfo ci in m_openChannels.Values)
            {
                if (ci.GetItemID().Equals(itemID))
                {
                    // return the original channel ID for this item
                    newChannel = ci.GetChannelID();
                    break;
                }
            }

            if (newChannel == UUID.Zero)
            {
                newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID;
                RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel);
                lock (XMLRPCListLock)
                {
                    m_openChannels.Add(newChannel, rpcChanInfo);
                }
            }

            return newChannel;
        }
示例#4
0
        /**********************************************
         * OpenXMLRPCChannel
         *
         * Generate a UUID channel key and add it and
         * the prim id to dictionary <channelUUID, primUUID>
         *
         * A custom channel key can be proposed.
         * Otherwise, passing UUID.Zero will generate
         * and return a random channel
         *
         * First check if there is a channel assigned for
         * this itemID.  If there is, then someone called
         * llOpenRemoteDataChannel twice.  Just return the
         * original channel.  Other option is to delete the
         * current channel and assign a new one.
         *
         * ********************************************/

        public UUID OpenXMLRPCChannel(UUID primID, UUID itemID, UUID channelID)
        {
            UUID newChannel = UUID.Zero;

            // This should no longer happen, but the check is reasonable anyway
            if (null == m_openChannels)
            {
                MainConsole.Instance.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete");
                return newChannel;
            }

            //Is a dupe?
#if (!ISWIN)
            foreach (RPCChannelInfo ci in m_openChannels.Values)
            {
                if (ci.GetItemID().Equals(itemID))
                {
                    // return the original channel ID for this item
                    newChannel = ci.GetChannelID();
                    break;
                }
            }
#else
            foreach (RPCChannelInfo ci in m_openChannels.Values.Where(ci => ci.GetItemID().Equals(itemID)))
            {
                // return the original channel ID for this item
                newChannel = ci.GetChannelID();
                break;
            }
#endif

            if (newChannel == UUID.Zero)
            {
                newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID;
                RPCChannelInfo rpcChanInfo = new RPCChannelInfo(primID, itemID, newChannel);
                lock (XMLRPCListLock)
                {
                    m_openChannels.Add(newChannel, rpcChanInfo);
                }
            }

            //Make sure that the cmd handler thread is running
            m_scriptModule.PokeThreads(itemID);

            return newChannel;
        }
示例#5
0
        /**********************************************
         * OpenXMLRPCChannel
         *
         * Generate a UUID channel key and add it and
         * the prim id to dictionary <channelUUID, primUUID>
         *
         * A custom channel key can be proposed.
         * Otherwise, passing UUID.Zero will generate
         * and return a random channel
         *
         * First check if there is a channel assigned for
         * this itemID.  If there is, then someone called
         * llOpenRemoteDataChannel twice.  Just return the
         * original channel.  Other option is to delete the
         * current channel and assign a new one.
         *
         * ********************************************/

        public UUID OpenXMLRPCChannel(uint localID, UUID itemID, UUID channelID)
        {
            UUID newChannel = UUID.Zero;

            //Is a dupe?
            try
            {
                m_openChannels.ForEach(delegate(RPCChannelInfo ci)
                {
                    if (ci.GetItemID().Equals(itemID))
                    {
                        // return the original channel ID for this item
                        throw new ThreadedClasses.ReturnValueException<UUID>(ci.GetChannelID());
                    }
                });
            }
            catch(ThreadedClasses.ReturnValueException<UUID> e)
            {
                return e.Value;
            }

            newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID;
            RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel);

            m_openChannels.Add(newChannel, rpcChanInfo);

            return newChannel;
        }