aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHomer Horwitz2008-10-11 22:42:59 +0000
committerHomer Horwitz2008-10-11 22:42:59 +0000
commitb48885ece4518c201bf0b8c27c1abb5c86b8167b (patch)
tree65ffdfcd79980658941b242a24d52f2a65f87099
parentImplement the hook needed for the CanTeleport check (diff)
downloadopensim-SC_OLD-b48885ece4518c201bf0b8c27c1abb5c86b8167b.zip
opensim-SC_OLD-b48885ece4518c201bf0b8c27c1abb5c86b8167b.tar.gz
opensim-SC_OLD-b48885ece4518c201bf0b8c27c1abb5c86b8167b.tar.bz2
opensim-SC_OLD-b48885ece4518c201bf0b8c27c1abb5c86b8167b.tar.xz
The "About Landmark" code with the fake parcelIDs had a serious bug.
- Fix that bug. It will work with OSSearch now, too - Add some caching to reduce inter-region requests.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs65
1 files changed, 52 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
index 0245a9e..0ecfdd3 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
@@ -42,6 +42,13 @@ using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
42 42
43namespace OpenSim.Region.Environment.Modules.World.Land 43namespace OpenSim.Region.Environment.Modules.World.Land
44{ 44{
45 // used for caching
46 internal class ExtendedLandData {
47 public LandData landData;
48 public ulong regionHandle;
49 public uint x, y;
50 }
51
45 public class LandManagementModule : IRegionModule 52 public class LandManagementModule : IRegionModule
46 { 53 {
47 private static readonly ILog m_log = 54 private static readonly ILog m_log =
@@ -60,6 +67,9 @@ namespace OpenSim.Region.Environment.Modules.World.Land
60 67
61 private bool m_allowedForcefulBans = true; 68 private bool m_allowedForcefulBans = true;
62 69
70 // caches ExtendedLandData
71 private Cache parcelInfoCache;
72
63 #region IRegionModule Members 73 #region IRegionModule Members
64 74
65 public void Initialise(Scene scene, IConfigSource source) 75 public void Initialise(Scene scene, IConfigSource source)
@@ -68,6 +78,10 @@ namespace OpenSim.Region.Environment.Modules.World.Land
68 landIDList.Initialize(); 78 landIDList.Initialize();
69 landChannel = new LandChannel(scene, this); 79 landChannel = new LandChannel(scene, this);
70 80
81 parcelInfoCache = new Cache();
82 parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
83 parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
84
71 m_scene.EventManager.OnParcelPrimCountAdd += AddPrimToLandPrimCounts; 85 m_scene.EventManager.OnParcelPrimCountAdd += AddPrimToLandPrimCounts;
72 m_scene.EventManager.OnParcelPrimCountUpdate += UpdateLandPrimCounts; 86 m_scene.EventManager.OnParcelPrimCountUpdate += UpdateLandPrimCounts;
73 m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel); 87 m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
@@ -1173,23 +1187,48 @@ namespace OpenSim.Region.Environment.Modules.World.Land
1173 if (parcelID == UUID.Zero) 1187 if (parcelID == UUID.Zero)
1174 return; 1188 return;
1175 1189
1176 // assume we've got the parcelID we just computed in RemoteParcelRequest 1190 ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID, delegate(UUID parcel) {
1177 ulong regionHandle; 1191 // assume we've got the parcelID we just computed in RemoteParcelRequest
1178 uint x, y; 1192 ExtendedLandData extLandData = new ExtendedLandData();
1179 Util.ParseFakeParcelID(parcelID, out regionHandle, out x, out y); 1193 Util.ParseFakeParcelID(parcel, out extLandData.regionHandle, out extLandData.x, out extLandData.y);
1180 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", regionHandle, x, y); 1194 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
1195 extLandData.regionHandle, extLandData.x, extLandData.y);
1181 1196
1182 LandData landData; 1197 // for this region or for somewhere else?
1183 if (regionHandle == m_scene.RegionInfo.RegionHandle) 1198 if (extLandData.regionHandle == m_scene.RegionInfo.RegionHandle)
1184 landData = this.GetLandObject(x, y).landData; 1199 {
1185 else 1200 extLandData.landData = this.GetLandObject(extLandData.x, extLandData.y).landData;
1186 landData = m_scene.CommsManager.GridService.RequestLandData(regionHandle, x, y); 1201 }
1202 else
1203 {
1204 extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle,
1205 extLandData.x,
1206 extLandData.y);
1207 if (extLandData.landData == null)
1208 {
1209 // we didn't find the region/land => don't cache
1210 return null;
1211 }
1212 }
1213 return extLandData;
1214 });
1187 1215
1188 if (landData != null) 1216 if (data != null) // if we found some data, send it
1189 { 1217 {
1218 RegionInfo info;
1219 if (data.regionHandle == m_scene.RegionInfo.RegionHandle)
1220 {
1221 info = m_scene.RegionInfo;
1222 }
1223 else
1224 {
1225 // most likely still cached from building the extLandData entry
1226 info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle);
1227 }
1190 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. 1228 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
1191 m_log.Debug("[LAND] got parcelinfo; sending"); 1229 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
1192 remoteClient.SendParcelInfo(m_scene.RegionInfo, landData, parcelID, x, y); 1230 data.landData.Name, data.regionHandle);
1231 remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y);
1193 } 1232 }
1194 else 1233 else
1195 m_log.Debug("[LAND] got no parcelinfo; not sending"); 1234 m_log.Debug("[LAND] got no parcelinfo; not sending");