a few more changes to lludp Xfer download
parent
2cba0d676e
commit
017253fae9
|
@ -2880,7 +2880,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
|
|
||||||
static private readonly byte[] SendXferPacketHeader = new byte[] {
|
static private readonly byte[] SendXferPacketHeader = new byte[] {
|
||||||
Helpers.MSG_RELIABLE,
|
0, //Helpers.MSG_RELIABLE, Xfer control must provide reliabialty
|
||||||
0, 0, 0, 0, // sequence number
|
0, 0, 0, 0, // sequence number
|
||||||
0, // extra
|
0, // extra
|
||||||
18 // ID (high frequency bigendian)
|
18 // ID (high frequency bigendian)
|
||||||
|
|
|
@ -273,8 +273,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
{
|
{
|
||||||
byte[] fileData = NewFiles[fileName].Data;
|
byte[] fileData = NewFiles[fileName].Data;
|
||||||
int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10;
|
int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10;
|
||||||
burstSize = burstSize * (remoteClient.PingTimeMS + 50);
|
burstSize *= remoteClient.PingTimeMS;
|
||||||
burstSize /= 1000; // ping is ms
|
burstSize >>= 9; // ping is ms, 2 round trips
|
||||||
XferDownLoad transaction =
|
XferDownLoad transaction =
|
||||||
new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize);
|
new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize);
|
||||||
|
|
||||||
|
@ -327,12 +327,14 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
public bool isDeleted = false;
|
public bool isDeleted = false;
|
||||||
|
|
||||||
private object myLock = new object();
|
private object myLock = new object();
|
||||||
private double lastsendTimeMS;
|
private double lastACKTimeMS;
|
||||||
private int LastPacket;
|
private int LastPacket;
|
||||||
private int lastBytes;
|
private int lastBytes;
|
||||||
private int lastSentPacket;
|
private int lastSentPacket;
|
||||||
private int lastAckPacket;
|
private int lastAckPacket;
|
||||||
private int burstSize; // additional packets, so can be zero
|
private int burstSize; // additional packets, so can be zero
|
||||||
|
private int retries;
|
||||||
|
private bool inBurst;
|
||||||
|
|
||||||
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz)
|
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz)
|
||||||
{
|
{
|
||||||
|
@ -394,12 +396,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
|
|
||||||
private void SendBurst(double now)
|
private void SendBurst(double now)
|
||||||
{
|
{
|
||||||
|
inBurst = true;
|
||||||
|
lastACKTimeMS = now; // reset timeout
|
||||||
int start = lastAckPacket + 1;
|
int start = lastAckPacket + 1;
|
||||||
int end = start + burstSize;
|
int end = start + burstSize;
|
||||||
if (end > LastPacket)
|
if (end > LastPacket)
|
||||||
end = LastPacket;
|
end = LastPacket;
|
||||||
while(start <= end)
|
while (start <= end)
|
||||||
SendPacket(start++ , now);
|
SendPacket(start++ , now);
|
||||||
|
inBurst = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendPacket(int pkt, double now)
|
private void SendPacket(int pkt, double now)
|
||||||
|
@ -422,8 +427,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
|
|
||||||
Client.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true);
|
Client.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true);
|
||||||
|
|
||||||
|
retries = 0;
|
||||||
lastSentPacket = pkt;
|
lastSentPacket = pkt;
|
||||||
lastsendTimeMS = now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -447,7 +452,11 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
done();
|
done();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
double now = Util.GetTimeStampMS();
|
double now = Util.GetTimeStampMS();
|
||||||
|
lastACKTimeMS = now;
|
||||||
|
retries = 0;
|
||||||
|
if (!inBurst)
|
||||||
SendPacket(lastSentPacket + 1, now);
|
SendPacket(lastSentPacket + 1, now);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -455,22 +464,25 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
|
|
||||||
public bool checkTime(double now)
|
public bool checkTime(double now)
|
||||||
{
|
{
|
||||||
if(Monitor.TryEnter(myLock))
|
if (Monitor.TryEnter(myLock))
|
||||||
{
|
{
|
||||||
if(!isDeleted)
|
if (!isDeleted && !inBurst)
|
||||||
{
|
{
|
||||||
double timeMS = now - lastsendTimeMS;
|
if (++retries >= 4)
|
||||||
if(timeMS > 90000.0)
|
|
||||||
done();
|
done();
|
||||||
else if(timeMS > 3500.0)
|
else
|
||||||
{
|
{
|
||||||
burstSize = 0; // cancel burst mode
|
double timeMS = now - lastACKTimeMS;
|
||||||
|
if(timeMS > 3000.0)
|
||||||
|
{
|
||||||
|
burstSize >>= 2;
|
||||||
SendBurst(now);
|
SendBurst(now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
bool isdel = isDeleted;
|
||||||
Monitor.Exit(myLock);
|
Monitor.Exit(myLock);
|
||||||
return isDeleted;
|
return isdel;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue