diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 834aa141d0..d275b7f1da 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -40,6 +40,12 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private Scene m_scene; public Dictionary NewFiles = new Dictionary(); public Dictionary Transfers = new Dictionary(); + public Dictionary Requests = new Dictionary(); + public struct XferRequest + { + public IClientAPI remoteClient; + public ulong xferID; + } #region IRegionModule Members @@ -86,6 +92,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer NewFiles.Add(fileName, data); } } + + if (Requests.ContainsKey(fileName)) + { + RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName); + Requests.Remove(fileName); + } + return true; } @@ -105,7 +118,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer /// public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) { - lock (NewFiles) { if (NewFiles.ContainsKey(fileName)) @@ -114,6 +126,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { byte[] fileData = NewFiles[fileName]; XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); + Transfers.Add(xferID, transaction); NewFiles.Remove(fileName); @@ -123,6 +136,16 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } } } + else + { + if (!Requests.ContainsKey(fileName)) + { + XferRequest nRequest = new XferRequest(); + nRequest.remoteClient = remoteClient; + nRequest.xferID = xferID; + Requests.Add(fileName, nRequest); + } + } } } @@ -177,7 +200,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4); Array.Copy(Data, 0, transferData, 4, Data.Length); Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); - complete = true; } else