* Adds AbortXfer to the ClientAPI mix
* Adds an item that checks to see if the top request has been there for longer then 30 seconds without an update and sends an AbortXfer if it encounters one. This allows the client to cancel the Xfer on it's side so you can re-select the prim and get the inventory when it fails the first time. * Some interesting locking... Using NewFiles to lock the rest of them. We'll see how that goes. * The goal of this is to ensure that Xfers are restartable when they fail. The client will not do that on it's own.viewer-2-initial-appearance
parent
1c3e77b728
commit
25ecd62b1f
|
@ -1116,6 +1116,12 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
// SL Specific, Ignore. (Remove from IClient)
|
// SL Specific, Ignore. (Remove from IClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
|
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
|
||||||
{
|
{
|
||||||
// SL Specific, Ignore. (Remove from IClient)
|
// SL Specific, Ignore. (Remove from IClient)
|
||||||
|
|
|
@ -669,6 +669,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
|
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
|
|
|
@ -1057,6 +1057,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendXferPacket(ulong xferID, uint packet, byte[] data);
|
void SendXferPacket(ulong xferID, uint packet, byte[] data);
|
||||||
|
|
||||||
|
void SendAbortXferPacket(ulong xferID);
|
||||||
|
|
||||||
void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
||||||
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent,
|
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent,
|
||||||
float PriceObjectScaleFactor,
|
float PriceObjectScaleFactor,
|
||||||
|
|
|
@ -2078,6 +2078,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OutPacket(sendXfer, ThrottleOutPacketType.Asset);
|
OutPacket(sendXfer, ThrottleOutPacketType.Asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
AbortXferPacket xferItem = (AbortXferPacket)PacketPool.Instance.GetPacket(PacketType.AbortXfer);
|
||||||
|
xferItem.XferID.ID = xferID;
|
||||||
|
OutPacket(xferItem, ThrottleOutPacketType.Asset);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
||||||
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
|
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
|
||||||
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
|
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
|
||||||
|
|
|
@ -97,6 +97,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
NewFiles.Add(fileName, data);
|
NewFiles.Add(fileName, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
string filename = string.Empty;
|
||||||
|
|
||||||
if (Requests.ContainsKey(fileName))
|
if (Requests.ContainsKey(fileName))
|
||||||
{
|
{
|
||||||
|
@ -113,6 +114,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
{
|
{
|
||||||
client.OnRequestXfer += RequestXfer;
|
client.OnRequestXfer += RequestXfer;
|
||||||
client.OnConfirmXfer += AckPacket;
|
client.OnConfirmXfer += AckPacket;
|
||||||
|
client.OnAbortXfer += AbortXfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -125,6 +127,17 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
{
|
{
|
||||||
lock (NewFiles)
|
lock (NewFiles)
|
||||||
{
|
{
|
||||||
|
if (RequestTime.Count > 0)
|
||||||
|
{
|
||||||
|
TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
|
||||||
|
if (ts.TotalSeconds > 30)
|
||||||
|
{
|
||||||
|
ulong zxferid = RequestTime[0].xferID;
|
||||||
|
remoteClient.SendAbortXferPacket(zxferid);
|
||||||
|
RemoveXferData(zxferid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (NewFiles.ContainsKey(fileName))
|
if (NewFiles.ContainsKey(fileName))
|
||||||
{
|
{
|
||||||
if (!Transfers.ContainsKey(xferID))
|
if (!Transfers.ContainsKey(xferID))
|
||||||
|
@ -137,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
|
|
||||||
if (transaction.StartSend())
|
if (transaction.StartSend())
|
||||||
{
|
{
|
||||||
Transfers.Remove(xferID);
|
RemoveXferData(xferID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +163,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
{
|
{
|
||||||
Requests.Remove(RequestTime[0].fileName);
|
Requests.Remove(RequestTime[0].fileName);
|
||||||
RequestTime.RemoveAt(0);
|
RequestTime.RemoveAt(0);
|
||||||
|
// Do we want to abort this here?
|
||||||
|
//remoteClient.SendAbortXfer(xferID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,22 +180,69 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
|
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
|
||||||
{
|
{
|
||||||
if (Transfers.ContainsKey(xferID))
|
lock (NewFiles) // This is actually to lock Transfers
|
||||||
{
|
{
|
||||||
if (Transfers[xferID].AckPacket(packet))
|
if (Transfers.ContainsKey(xferID))
|
||||||
{
|
{
|
||||||
|
XferDownLoad dl = Transfers[xferID];
|
||||||
|
if (Transfers[xferID].AckPacket(packet))
|
||||||
{
|
{
|
||||||
Transfers.Remove(xferID);
|
{
|
||||||
|
RemoveXferData(xferID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if (Requests.ContainsKey(dl.FileName))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XferRequest req = Requests[dl.FileName];
|
||||||
|
req.timeStamp = DateTime.UtcNow;
|
||||||
|
Requests[dl.FileName] = req;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RemoveXferData(ulong xferID)
|
||||||
|
{
|
||||||
|
// NewFiles must be locked!
|
||||||
|
if (Transfers.ContainsKey(xferID))
|
||||||
|
{
|
||||||
|
// Qualifier distinguishes between the OpenMetaverse version and the nested class
|
||||||
|
|
||||||
|
XferModule.XferDownLoad xferItem = Transfers[xferID];
|
||||||
|
//string filename = xferItem.FileName;
|
||||||
|
Transfers.Remove(xferID);
|
||||||
|
xferItem.Data = new byte[0]; // Clear the data
|
||||||
|
xferItem.DataPointer = 0;
|
||||||
|
|
||||||
|
// If the abort comes in
|
||||||
|
if (NewFiles.ContainsKey(xferItem.FileName))
|
||||||
|
NewFiles.Remove(xferItem.FileName);
|
||||||
|
|
||||||
|
if (Requests.ContainsKey(xferItem.FileName))
|
||||||
|
Requests.Remove(xferItem.FileName);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AbortXfer(IClientAPI remoteClient, ulong xferID)
|
||||||
|
{
|
||||||
|
lock (NewFiles)
|
||||||
|
{
|
||||||
|
RemoveXferData(xferID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Nested type: XferDownLoad
|
#region Nested type: XferDownLoad
|
||||||
|
|
||||||
public class XferDownLoad
|
public class XferDownLoad
|
||||||
|
|
|
@ -602,6 +602,12 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
||||||
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
|
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
|
||||||
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
|
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
|
||||||
|
|
|
@ -1117,6 +1117,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
|
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -686,6 +686,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
|
public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
public virtual void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
||||||
|
|
|
@ -696,6 +696,11 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SendAbortXferPacket(ulong xferID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
|
||||||
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
|
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
|
||||||
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
|
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
|
||||||
|
|
Loading…
Reference in New Issue