diff options
author | UbitUmarov | 2019-06-12 02:41:20 +0100 |
---|---|---|
committer | UbitUmarov | 2019-06-12 02:41:20 +0100 |
commit | 878d0defc7d32d180b8e0b7eb9994ac953cd2ee3 (patch) | |
tree | 01b1d2d02b5d64ac7fed7b7713f288c2c7b7bde9 | |
parent | still a few more changes to lludp Xfer download for lost udp case (diff) | |
download | opensim-SC-878d0defc7d32d180b8e0b7eb9994ac953cd2ee3.zip opensim-SC-878d0defc7d32d180b8e0b7eb9994ac953cd2ee3.tar.gz opensim-SC-878d0defc7d32d180b8e0b7eb9994ac953cd2ee3.tar.bz2 opensim-SC-878d0defc7d32d180b8e0b7eb9994ac953cd2ee3.tar.xz |
add a lock
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 056e786..b897d04 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
122 | if(!inTimeTick) | 122 | if(!inTimeTick) |
123 | { | 123 | { |
124 | double now = Util.GetTimeStampMS(); | 124 | double now = Util.GetTimeStampMS(); |
125 | if(now - lastTimeTick > 500.0) | 125 | if(now - lastTimeTick > 750.0) |
126 | { | 126 | { |
127 | 127 | ||
128 | if(Transfers.Count == 0 && NewFiles.Count == 0) | 128 | if(Transfers.Count == 0 && NewFiles.Count == 0) |
@@ -334,7 +334,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
334 | private int lastAckPacket; | 334 | private int lastAckPacket; |
335 | private int burstSize; // additional packets, so can be zero | 335 | private int burstSize; // additional packets, so can be zero |
336 | private int retries; | 336 | private int retries; |
337 | private bool inBurst; | ||
338 | 337 | ||
339 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz) | 338 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz) |
340 | { | 339 | { |
@@ -397,15 +396,16 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
397 | 396 | ||
398 | private void SendBurst(double now) | 397 | private void SendBurst(double now) |
399 | { | 398 | { |
400 | inBurst = true; | 399 | lock(myLock) |
401 | lastACKTimeMS = (int)now; // reset timeout | 400 | { |
402 | int start = lastAckPacket + 1; | 401 | lastACKTimeMS = (int)now; // reset timeout |
403 | int end = start + burstSize; | 402 | int start = lastAckPacket + 1; |
404 | if (end > LastPacket) | 403 | int end = start + burstSize; |
405 | end = LastPacket; | 404 | if (end > LastPacket) |
406 | while (start <= end) | 405 | end = LastPacket; |
407 | SendPacket(start++ , now); | 406 | while (start <= end) |
408 | inBurst = false; | 407 | SendPacket(start++ , now); |
408 | } | ||
409 | } | 409 | } |
410 | 410 | ||
411 | private void SendPacket(int pkt, double now) | 411 | private void SendPacket(int pkt, double now) |
@@ -458,8 +458,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
458 | double now = Util.GetTimeStampMS(); | 458 | double now = Util.GetTimeStampMS(); |
459 | lastACKTimeMS = (int)now; | 459 | lastACKTimeMS = (int)now; |
460 | retries = 0; | 460 | retries = 0; |
461 | if (!inBurst) | 461 | SendPacket(lastSentPacket + 1, now); |
462 | SendPacket(lastSentPacket + 1, now); | ||
463 | return false; | 462 | return false; |
464 | } | 463 | } |
465 | } | 464 | } |
@@ -468,15 +467,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
468 | { | 467 | { |
469 | if (Monitor.TryEnter(myLock)) | 468 | if (Monitor.TryEnter(myLock)) |
470 | { | 469 | { |
471 | if (!isDeleted && !inBurst) | 470 | if (!isDeleted) |
472 | { | 471 | { |
473 | double timeMS = now - lastACKTimeMS; | 472 | double timeMS = now - lastACKTimeMS; |
474 | 473 | ||
475 | double tout = 5 * remoteClient.PingTimeMS; | 474 | double tout = 5 * remoteClient.PingTimeMS; |
476 | if(tout > 10000) | 475 | if(tout > 10000) |
477 | tout = 10000; | 476 | tout = 10000; |
478 | else if (tout < 500) | 477 | else if (tout < 1000) |
479 | tout = 500; | 478 | tout = 1000; |
480 | if (timeMS > tout) | 479 | if (timeMS > tout) |
481 | { | 480 | { |
482 | if (++retries >= 4) | 481 | if (++retries >= 4) |