Exemplo n.º 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(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("[XMLRPC]: Attempt to open channel before initialization is complete");
                return(newChannel);
            }

            //Is a dupe?
            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;
            }

            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);
        }
        /**********************************************
         * 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("[XMLRPC]: Attempt to open channel before initialization is complete");
                return newChannel;
            }

            //Is a dupe?
            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;
            }

            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;
        }