コード例 #1
0
ファイル: XferModule.cs プロジェクト: BogusCurry/opensim-1
        /// <summary>
        ///
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="xferID"></param>
        /// <param name="fileName"></param>
        public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
        {
            lock (NewFiles)
            {
                if (NewFiles.ContainsKey(fileName))
                {
                    lock (Transfers)
                    {
                        if (!Transfers.ContainsKey(xferID))
                        {
                            byte[] fileData  = NewFiles[fileName].Data;
                            int    burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10;
                            burstSize  *= remoteClient.PingTimeMS;
                            burstSize >>= 10; //  ping is ms, 1 round trip
                            if (burstSize > 32)
                            {
                                burstSize = 32;
                            }
                            XferDownLoad transaction =
                                new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize);

                            Transfers.Add(xferID, transaction);
                            transaction.StartSend();

                            // The transaction for this file is on its way
                            RemoveOrDecrementFile(fileName);
                        }
                    }
                }
                else
                {
                    m_log.WarnFormat("[Xfer]: {0} not found", fileName);
                }
            }
        }