Thank you, RemedyTomm, for a patch to handle Xfer requests being dropped

before the file data to be transfered is ready.
0.6.8-post-fixes
Melanie 2009-10-26 04:52:11 +00:00
parent 3639f68411
commit 7df54d4ad2
1 changed files with 24 additions and 2 deletions

View File

@ -40,6 +40,12 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
private Scene m_scene;
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
public Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>();
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
/// <param name="fileName"></param>
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