diff options
author | UbitUmarov | 2016-09-23 18:28:46 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-23 18:28:46 +0100 |
commit | f613b5f5177d153eaf3180ebf286fdd1a149cc8c (patch) | |
tree | f1cbddd28a45521a617adb839313ee27f8c9334c | |
parent | make clouds a bit diferent on regions running on same instance.. well should ... (diff) | |
download | opensim-SC-f613b5f5177d153eaf3180ebf286fdd1a149cc8c.zip opensim-SC-f613b5f5177d153eaf3180ebf286fdd1a149cc8c.tar.gz opensim-SC-f613b5f5177d153eaf3180ebf286fdd1a149cc8c.tar.bz2 opensim-SC-f613b5f5177d153eaf3180ebf286fdd1a149cc8c.tar.xz |
fix caching of wind and cloud packets in the case of several regions on a instance, that got broken with the necessary send to child agents.
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 87 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs | 5 |
2 files changed, 46 insertions, 46 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 90f0336..8194260 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -1375,44 +1375,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1375 | } | 1375 | } |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | /// <summary> | 1378 | |
1379 | /// Send the wind matrix to the client | ||
1380 | /// </summary> | ||
1381 | /// <param name="windSpeeds">16x16 array of wind speeds</param> | ||
1382 | /* | ||
1383 | public virtual void SendWindData(Vector2[] windSpeeds) | ||
1384 | { | ||
1385 | Util.FireAndForget(DoSendWindData, windSpeeds, "LLClientView.SendWindData"); | ||
1386 | DoSendWindData(windSpeeds); | ||
1387 | } | ||
1388 | */ | ||
1389 | /// <summary> | ||
1390 | /// Send the cloud matrix to the client | ||
1391 | /// </summary> | ||
1392 | /// <param name="windSpeeds">16x16 array of cloud densities</param> | ||
1393 | /* | ||
1394 | public virtual void SendCloudData(int version, float[] cloudDensity) | ||
1395 | { | ||
1396 | Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); | ||
1397 | } | ||
1398 | */ | ||
1399 | // wind caching | 1379 | // wind caching |
1400 | private static int lastWindVersion = 0; | 1380 | private static Dictionary<ulong,int> lastWindVersion = new Dictionary<ulong,int>(); |
1401 | private static List<LayerDataPacket> lastWindPackets = new List<LayerDataPacket>(); | 1381 | private static Dictionary<ulong,List<LayerDataPacket>> lastWindPackets = |
1382 | new Dictionary<ulong,List<LayerDataPacket>>(); | ||
1402 | 1383 | ||
1403 | 1384 | ||
1404 | /// <summary> | 1385 | /// <summary> |
1405 | /// Send wind layer information to the client. | 1386 | /// Send the wind matrix to the client |
1406 | /// </summary> | 1387 | /// </summary> |
1407 | /// <param name="o"></param> | 1388 | /// <param name="windSpeeds">16x16 array of wind speeds</param> |
1408 | // private void DoSendWindData(object o) | ||
1409 | public virtual void SendWindData(int version, Vector2[] windSpeeds) | 1389 | public virtual void SendWindData(int version, Vector2[] windSpeeds) |
1410 | { | 1390 | { |
1411 | // Vector2[] windSpeeds = (Vector2[])o; | 1391 | // Vector2[] windSpeeds = (Vector2[])o; |
1412 | 1392 | ||
1393 | ulong handle = this.Scene.RegionInfo.RegionHandle; | ||
1413 | bool isNewData; | 1394 | bool isNewData; |
1414 | lock(lastWindPackets) | 1395 | lock(lastWindPackets) |
1415 | isNewData = lastWindVersion != version; | 1396 | { |
1397 | if(!lastWindVersion.ContainsKey(handle) || | ||
1398 | !lastWindPackets.ContainsKey(handle)) | ||
1399 | { | ||
1400 | lastWindVersion[handle] = 0; | ||
1401 | lastWindPackets[handle] = new List<LayerDataPacket>(); | ||
1402 | isNewData = true; | ||
1403 | } | ||
1404 | else | ||
1405 | isNewData = lastWindVersion[handle] != version; | ||
1406 | } | ||
1416 | 1407 | ||
1417 | if(isNewData) | 1408 | if(isNewData) |
1418 | { | 1409 | { |
@@ -1435,32 +1426,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1435 | layerpack.Header.Zerocoded = true; | 1426 | layerpack.Header.Zerocoded = true; |
1436 | lock(lastWindPackets) | 1427 | lock(lastWindPackets) |
1437 | { | 1428 | { |
1438 | lastWindPackets.Clear(); | 1429 | lastWindPackets[handle].Clear(); |
1439 | lastWindPackets.Add(layerpack); | 1430 | lastWindPackets[handle].Add(layerpack); |
1440 | lastWindVersion = version; | 1431 | lastWindVersion[handle] = version; |
1441 | } | 1432 | } |
1442 | } | 1433 | } |
1443 | 1434 | ||
1444 | lock(lastWindPackets) | 1435 | lock(lastWindPackets) |
1445 | foreach(LayerDataPacket pkt in lastWindPackets) | 1436 | foreach(LayerDataPacket pkt in lastWindPackets[handle]) |
1446 | OutPacket(pkt, ThrottleOutPacketType.Wind); | 1437 | OutPacket(pkt, ThrottleOutPacketType.Wind); |
1447 | } | 1438 | } |
1448 | 1439 | ||
1449 | // cloud caching | 1440 | // cloud caching |
1450 | private static int lastCloudVersion = 0; | 1441 | private static Dictionary<ulong,int> lastCloudVersion = new Dictionary<ulong,int>(); |
1451 | private static List<LayerDataPacket> lastCloudPackets = new List<LayerDataPacket>(); | 1442 | private static Dictionary<ulong,List<LayerDataPacket>> lastCloudPackets = |
1443 | new Dictionary<ulong,List<LayerDataPacket>>(); | ||
1452 | 1444 | ||
1453 | /// <summary> | 1445 | /// <summary> |
1454 | /// Send cloud layer information to the client. | 1446 | /// Send the cloud matrix to the client |
1455 | /// </summary> | 1447 | /// </summary> |
1456 | /// <param name="o"></param> | 1448 | /// <param name="windSpeeds">16x16 array of cloud densities</param> |
1457 | // private void DoSendCloudData(object o) | ||
1458 | public virtual void SendCloudData(int version, float[] cloudDensity) | 1449 | public virtual void SendCloudData(int version, float[] cloudDensity) |
1459 | { | 1450 | { |
1460 | // float[] cloudDensity = (float[])o; | 1451 | ulong handle = this.Scene.RegionInfo.RegionHandle; |
1461 | bool isNewData; | 1452 | bool isNewData; |
1462 | lock(lastCloudPackets) | 1453 | lock(lastWindPackets) |
1463 | isNewData = lastCloudVersion != version; | 1454 | { |
1455 | if(!lastCloudVersion.ContainsKey(handle) || | ||
1456 | !lastCloudPackets.ContainsKey(handle)) | ||
1457 | { | ||
1458 | lastCloudVersion[handle] = 0; | ||
1459 | lastCloudPackets[handle] = new List<LayerDataPacket>(); | ||
1460 | isNewData = true; | ||
1461 | } | ||
1462 | else | ||
1463 | isNewData = lastCloudVersion[handle] != version; | ||
1464 | } | ||
1464 | 1465 | ||
1465 | if(isNewData) | 1466 | if(isNewData) |
1466 | { | 1467 | { |
@@ -1484,14 +1485,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1484 | layerpack.Header.Zerocoded = true; | 1485 | layerpack.Header.Zerocoded = true; |
1485 | lock(lastCloudPackets) | 1486 | lock(lastCloudPackets) |
1486 | { | 1487 | { |
1487 | lastCloudPackets.Clear(); | 1488 | lastCloudPackets[handle].Clear(); |
1488 | lastCloudPackets.Add(layerpack); | 1489 | lastCloudPackets[handle].Add(layerpack); |
1489 | lastCloudVersion = version; | 1490 | lastCloudVersion[handle] = version; |
1490 | } | 1491 | } |
1491 | } | 1492 | } |
1492 | 1493 | ||
1493 | lock(lastCloudPackets) | 1494 | lock(lastCloudPackets) |
1494 | foreach(LayerDataPacket pkt in lastCloudPackets) | 1495 | foreach(LayerDataPacket pkt in lastCloudPackets[handle]) |
1495 | OutPacket(pkt, ThrottleOutPacketType.Cloud); | 1496 | OutPacket(pkt, ThrottleOutPacketType.Cloud); |
1496 | } | 1497 | } |
1497 | 1498 | ||
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index a18225b..617c348 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs | |||
@@ -204,10 +204,9 @@ namespace OpenSim.Region.CoreModules.World | |||
204 | 204 | ||
205 | private void CloudUpdate() | 205 | private void CloudUpdate() |
206 | { | 206 | { |
207 | if ((!m_ready || m_cloudDensity == 0 || (m_frame++ % m_frameUpdateRate) != 0)) | 207 | if ((!m_ready || m_busy || m_cloudDensity == 0 || |
208 | { | 208 | (m_frame++ % m_frameUpdateRate) != 0)) |
209 | return; | 209 | return; |
210 | } | ||
211 | 210 | ||
212 | if(Monitor.TryEnter(cloudlock)) | 211 | if(Monitor.TryEnter(cloudlock)) |
213 | { | 212 | { |