add a lock

0.9.1.0-post-fixes
UbitUmarov 2019-06-12 02:41:20 +01:00
parent da90da220e
commit 878d0defc7
1 changed files with 15 additions and 16 deletions

View File

@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
if(!inTimeTick) if(!inTimeTick)
{ {
double now = Util.GetTimeStampMS(); double now = Util.GetTimeStampMS();
if(now - lastTimeTick > 500.0) if(now - lastTimeTick > 750.0)
{ {
if(Transfers.Count == 0 && NewFiles.Count == 0) if(Transfers.Count == 0 && NewFiles.Count == 0)
@ -334,7 +334,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
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 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)
{ {
@ -397,7 +396,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
private void SendBurst(double now) private void SendBurst(double now)
{ {
inBurst = true; lock(myLock)
{
lastACKTimeMS = (int)now; // reset timeout lastACKTimeMS = (int)now; // reset timeout
int start = lastAckPacket + 1; int start = lastAckPacket + 1;
int end = start + burstSize; int end = start + burstSize;
@ -405,7 +405,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
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)
@ -458,7 +458,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
double now = Util.GetTimeStampMS(); double now = Util.GetTimeStampMS();
lastACKTimeMS = (int)now; lastACKTimeMS = (int)now;
retries = 0; retries = 0;
if (!inBurst)
SendPacket(lastSentPacket + 1, now); SendPacket(lastSentPacket + 1, now);
return false; return false;
} }
@ -468,15 +467,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
{ {
if (Monitor.TryEnter(myLock)) if (Monitor.TryEnter(myLock))
{ {
if (!isDeleted && !inBurst) if (!isDeleted)
{ {
double timeMS = now - lastACKTimeMS; double timeMS = now - lastACKTimeMS;
double tout = 5 * remoteClient.PingTimeMS; double tout = 5 * remoteClient.PingTimeMS;
if(tout > 10000) if(tout > 10000)
tout = 10000; tout = 10000;
else if (tout < 500) else if (tout < 1000)
tout = 500; tout = 1000;
if (timeMS > tout) if (timeMS > tout)
{ {
if (++retries >= 4) if (++retries >= 4)