From 7df54d4ad2b874eed0e93f13a6bdc06cccf2077e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 26 Oct 2009 04:52:11 +0000 Subject: Thank you, RemedyTomm, for a patch to handle Xfer requests being dropped before the file data to be transfered is ready. --- .../Region/CoreModules/Agent/Xfer/XferModule.cs | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 834aa14..d275b7f 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 -- cgit v1.1