Пример #1
0
        private void AddTerrainUploadTransaction(TerrainUploadTransaction t, UUID fromSceneID)
        {
            var id = UUID.Random;

            t.XferID = NextXferID;
            m_TerrainTransactions.Add(id, t.XferID, t);
            var m = new RequestXfer
            {
                ID        = t.XferID,
                VFileType = 0,
                VFileID   = id,
                FilePath  = 0,
                Filename  = t.Filename
            };

            SendMessageAlways(m, fromSceneID);
        }
Пример #2
0
        private UUID AddAssetUploadTransaction(UUID transactionID, AssetUploadTransaction t, UUID fromSceneID)
        {
#if DEBUG
            m_Log.DebugFormat("AddAssetUploadTransaction(): Added asset upload transaction {0} for {1}", transactionID, Owner.ToString());
#endif
            UInt64 XferID = NextXferID;
            m_AssetTransactions.Add(transactionID, XferID, t);
            t.XferID = XferID;
            var m = new RequestXfer
            {
                ID        = t.XferID,
                VFileType = (short)t.AssetType,
                VFileID   = t.AssetID,
                FilePath  = 0,
                Filename  = t.Filename
            };
            SendMessageAlways(m, fromSceneID);

            return(transactionID);
        }
Пример #3
0
        public void HandleAssetUploadRequest(Message m)
        {
            var req = (AssetUploadRequest)m;
            AssetUploadTransaction transaction;

            lock (m_AssetTransactionsAddLock)
            {
                if (!m_AssetTransactions.TryGetValue(req.TransactionID, out transaction))
                {
                    UInt64 XferID = NextXferID;
#if DEBUG
                    m_Log.DebugFormat("HandleAssetUploadRequest(): Add transaction TransactionID={0} XferID={1}", req.TransactionID, XferID);
#endif
                    transaction = new AssetUploadTransaction {
                        SceneID = req.CircuitSceneID
                    };
                    m_AssetTransactions.Add(req.TransactionID, XferID, transaction);
                    transaction.XferID = XferID;
                }
            }

            UUID vfileID;
            /* what a crazy work-around in the protocol */
            byte[] md5input = new byte[32];
            req.TransactionID.ToBytes(md5input, 0);
            m_SecureSessionID.ToBytes(md5input, 16);
            using (MD5 md5 = MD5.Create())
            {
                vfileID = new UUID(md5.ComputeHash(md5input), 0);
            }

            transaction.AssetID     = vfileID;
            transaction.AssetType   = req.AssetType;
            transaction.IsTemporary = req.IsTemporary;
            transaction.IsLocal     = req.StoreLocal;
            transaction.Creator     = Owner;
            if (req.AssetData.Length > 2)
            {
#if DEBUG
                m_Log.DebugFormat("HandleAssetUploadRequest(): Added asset upload transaction {0} for {1}: Single packet", req.TransactionID, Owner.ToString());
#endif
                transaction.DataBlocks.Add(req.AssetData);
                lock (transaction)
                {
                    if (transaction.HasActions)
                    {
                        AssetUploadCompleted(transaction, m.CircuitSceneID);
                    }
                    else
                    {
                        transaction.IsCompleted = true;
                    }
                }
            }
            else
            {
#if DEBUG
                m_Log.DebugFormat("AssetUploadRequest(): Added asset upload transaction {0} for {1}: Xfer packets", req.TransactionID, Owner.ToString());
#endif
                var reqxfer = new RequestXfer
                {
                    ID        = transaction.XferID,
                    VFileType = (short)transaction.AssetType,
                    VFileID   = vfileID,
                    FilePath  = 0,
                    Filename  = string.Empty
                };
                SendMessageAlways(reqxfer, m.CircuitSceneID);
            }
        }