aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorCharles Krinke2008-08-16 19:20:14 +0000
committerCharles Krinke2008-08-16 19:20:14 +0000
commitd9cc908471922a1239bb8a757e07084072852982 (patch)
tree3390870e039a51194efa9c2e1e20142c9266dddd /OpenSim/Region/Environment
parent* Fix a rare maptile shading error, terrain difference mod 1 = 0 + abs = oops. (diff)
downloadopensim-SC-d9cc908471922a1239bb8a757e07084072852982.zip
opensim-SC-d9cc908471922a1239bb8a757e07084072852982.tar.gz
opensim-SC-d9cc908471922a1239bb8a757e07084072852982.tar.bz2
opensim-SC-d9cc908471922a1239bb8a757e07084072852982.tar.xz
Mantis#1965. Thank you kindly, HomerHorwitz for a patch that:
Places touched: - Added two events for in-packets to LLCLientView: RegionHandleRequest and ParcelInfoRequest - Added sending of two out-packets to LLCLientView: RegionIDAndHandleReply and ParcelInfoReply. - Scene handles the RegionHandleRequest, LandManagementModule the ParcelInfoRequest - Added inter-region request for LandData by RegionHandle and local position. This was implemented as XML-RPC request. The returned LandData isn't complete, it only contains the data necessary for answering the ParcelInfoRequest - Added new CAPS (0009) for RemoteParcelRequest and some methods for LandData handling to LandManagementModule - Added methods for fake parcelID creation and parsing to Util - Fixed missing implementation of interface methods. - Added new file: OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs NOTE: This is part of the patch, too. Due to the many places touched, I would consider this patch as experimental.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs120
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs16
4 files changed, 164 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
index 92eda80..46f108e 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
@@ -26,19 +26,30 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
30using libsecondlife; 32using libsecondlife;
33using log4net;
31using Nini.Config; 34using Nini.Config;
32using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
34using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Communications.Capabilities;
35using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
36using Axiom.Math; 41using Axiom.Math;
42using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
37 43
38namespace OpenSim.Region.Environment.Modules.World.Land 44namespace OpenSim.Region.Environment.Modules.World.Land
39{ 45{
40 public class LandManagementModule : IRegionModule 46 public class LandManagementModule : IRegionModule
41 { 47 {
48 private static readonly ILog m_log =
49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private static readonly string remoteParcelRequestPath = "0009/";
52
42 private LandChannel landChannel; 53 private LandChannel landChannel;
43 private Scene m_scene; 54 private Scene m_scene;
44 55
@@ -75,6 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
75 m_scene.EventManager.OnSetAllowForcefulBan += this.SetAllowedForcefulBans; 86 m_scene.EventManager.OnSetAllowForcefulBan += this.SetAllowedForcefulBans;
76 m_scene.EventManager.OnRequestParcelPrimCountUpdate += this.PerformParcelPrimCountUpdate; 87 m_scene.EventManager.OnRequestParcelPrimCountUpdate += this.PerformParcelPrimCountUpdate;
77 m_scene.EventManager.OnParcelPrimCountTainted += this.SetPrimsTainted; 88 m_scene.EventManager.OnParcelPrimCountTainted += this.SetPrimsTainted;
89 m_scene.EventManager.OnRegisterCaps += this.OnRegisterCaps;
78 90
79 lock (m_scene) 91 lock (m_scene)
80 { 92 {
@@ -95,7 +107,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
95 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(handleParcelAccessUpdateRequest); 107 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(handleParcelAccessUpdateRequest);
96 client.OnParcelAbandonRequest += new ParcelAbandonRequest(handleParcelAbandonRequest); 108 client.OnParcelAbandonRequest += new ParcelAbandonRequest(handleParcelAbandonRequest);
97 client.OnParcelReclaim += new ParcelReclaim(handleParcelReclaim); 109 client.OnParcelReclaim += new ParcelReclaim(handleParcelReclaim);
98 110 client.OnParcelInfoRequest += new ParcelInfoRequest(handleParcelInfo);
99 if (m_scene.Entities.ContainsKey(client.AgentId)) 111 if (m_scene.Entities.ContainsKey(client.AgentId))
100 { 112 {
101 SendLandUpdate((ScenePresence)m_scene.Entities[client.AgentId], true); 113 SendLandUpdate((ScenePresence)m_scene.Entities[client.AgentId], true);
@@ -1084,6 +1096,112 @@ namespace OpenSim.Region.Environment.Modules.World.Land
1084 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) 1096 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
1085 { 1097 {
1086 } 1098 }
1099
1100 #region CAPS handler
1101 private void OnRegisterCaps(LLUUID agentID, Caps caps)
1102 {
1103 string capsBase = "/CAPS/" + caps.CapsObjectPath;
1104 caps.RegisterHandler("RemoteParcelRequest",
1105 new RestStreamHandler("POST", capsBase + remoteParcelRequestPath,
1106 delegate(string request, string path, string param,
1107 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1108 {
1109 return RemoteParcelRequest(request, path, param, agentID, caps);
1110 }));
1111 }
1112
1113 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1114 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1115 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
1116 // and y coordinate (each 8 bit), encoded in a LLUUID (128 bit).
1117 //
1118 // Request format:
1119 // <llsd>
1120 // <map>
1121 // <key>location</key>
1122 // <array>
1123 // <real>1.23</real>
1124 // <real>45..6</real>
1125 // <real>78.9</real>
1126 // </array>
1127 // <key>region_id</key>
1128 // <uuid>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</uuid>
1129 // </map>
1130 // </llsd>
1131 private string RemoteParcelRequest(string request, string path, string param, LLUUID agentID, Caps caps)
1132 {
1133 LLUUID parcelID = LLUUID.Zero;
1134 try
1135 {
1136 Hashtable hash = new Hashtable();
1137 hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request));
1138 if(hash.ContainsKey("region_id") && hash.ContainsKey("location"))
1139 {
1140 LLUUID regionID = (LLUUID)hash["region_id"];
1141 ArrayList list = (ArrayList)hash["location"];
1142 uint x = (uint)(double)list[0];
1143 uint y = (uint)(double)list[1];
1144 if(hash.ContainsKey("region_handle"))
1145 {
1146 // if you do a "About Landmark" on a landmark a second time, the viewer sends the
1147 // region_handle it got earlier via RegionHandleRequest
1148 ulong regionHandle = Helpers.BytesToUInt64((byte[])hash["region_handle"]);
1149 parcelID = Util.BuildFakeParcelID(regionHandle, x, y);
1150 }
1151 else if(regionID == m_scene.RegionInfo.RegionID)
1152 {
1153 // a parcel request for a local parcel => no need to query the grid
1154 parcelID = Util.BuildFakeParcelID(m_scene.RegionInfo.RegionHandle, x, y);
1155 }
1156 else
1157 {
1158 // a parcel request for a parcel in another region. Ask the grid about the region
1159 RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID);
1160 if(info != null) parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
1161 }
1162 }
1163 }
1164 catch (LLSD.LLSDParseException e)
1165 {
1166 m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message);
1167 m_log.ErrorFormat("[LAND] ... in request {0}", request);
1168 }
1169 catch(InvalidCastException)
1170 {
1171 m_log.ErrorFormat("[LAND] Wrong type in request {0}", request);
1172 }
1173
1174 LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse();
1175 response.parcel_id = parcelID;
1176 m_log.DebugFormat("[LAND] got parcelID {0}", parcelID);
1177
1178 return LLSDHelpers.SerialiseLLSDReply(response);
1179 }
1180
1181 #endregion
1182
1183 private void handleParcelInfo(IClientAPI remoteClient, LLUUID parcelID)
1184 {
1185 if(parcelID == LLUUID.Zero) return;
1186
1187 // assume we've got the parcelID we just computed in RemoteParcelRequest
1188 ulong regionHandle;
1189 uint x, y;
1190 Util.ParseFakeParcelID(parcelID, out regionHandle, out x, out y);
1191 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", regionHandle, x, y);
1192
1193 LandData landData;
1194 if(regionHandle == m_scene.RegionInfo.RegionHandle) landData = this.GetLandObject(x, y).landData;
1195 else landData = m_scene.CommsManager.GridService.RequestLandData(regionHandle, x, y);
1196
1197 if(landData != null)
1198 {
1199 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
1200 m_log.Debug("[LAND] got parcelinfo; sending");
1201 remoteClient.SendParcelInfo(m_scene.RegionInfo, landData, parcelID, x, y);
1202 }
1203 else m_log.Debug("[LAND] got no parcelinfo; not sending");
1204 }
1087 } 1205 }
1088 1206
1089} 1207}
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 5853b87..7b05027 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -302,6 +302,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
302 public event UpdateVector OnAutoPilotGo; 302 public event UpdateVector OnAutoPilotGo;
303 303
304 public event TerrainUnacked OnUnackedTerrain; 304 public event TerrainUnacked OnUnackedTerrain;
305
306 public event RegionHandleRequest OnRegionHandleRequest;
307 public event ParcelInfoRequest OnParcelInfoRequest;
308
305#pragma warning restore 67 309#pragma warning restore 67
306 310
307 #endregion 311 #endregion
@@ -832,5 +836,13 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
832 public void SendClearFollowCamProperties (LLUUID objectID) 836 public void SendClearFollowCamProperties (LLUUID objectID)
833 { 837 {
834 } 838 }
839
840 public void SendRegionHandle (LLUUID regoinID, ulong handle)
841 {
842 }
843
844 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y)
845 {
846 }
835 } 847 }
836} 848}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 2e89e4b..9b0b53a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2170,6 +2170,8 @@ namespace OpenSim.Region.Environment.Scenes
2170 client.OnScriptReset += ProcessScriptReset; 2170 client.OnScriptReset += ProcessScriptReset;
2171 client.OnGetScriptRunning += GetScriptRunning; 2171 client.OnGetScriptRunning += GetScriptRunning;
2172 client.OnSetScriptRunning += SetScriptRunning; 2172 client.OnSetScriptRunning += SetScriptRunning;
2173
2174 client.OnRegionHandleRequest += RegionHandleRequest;
2173 2175
2174 client.OnUnackedTerrain += TerrainUnAcked; 2176 client.OnUnackedTerrain += TerrainUnAcked;
2175 2177
@@ -2502,6 +2504,7 @@ namespace OpenSim.Region.Environment.Scenes
2502 m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 2504 m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
2503 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; 2505 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
2504 m_sceneGridService.KillObject += SendKillObject; 2506 m_sceneGridService.KillObject += SendKillObject;
2507 m_sceneGridService.OnGetLandData += GetLandData;
2505 } 2508 }
2506 2509
2507 /// <summary> 2510 /// <summary>
@@ -2518,6 +2521,7 @@ namespace OpenSim.Region.Environment.Scenes
2518 m_sceneGridService.OnExpectUser -= NewUserConnection; 2521 m_sceneGridService.OnExpectUser -= NewUserConnection;
2519 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 2522 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
2520 m_sceneGridService.OnCloseAgentConnection -= CloseConnection; 2523 m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
2524 m_sceneGridService.OnGetLandData -= GetLandData;
2521 2525
2522 m_sceneGridService.Close(); 2526 m_sceneGridService.Close();
2523 } 2527 }
@@ -3436,6 +3440,12 @@ namespace OpenSim.Region.Environment.Scenes
3436 return LandChannel.GetLandObject(x, y).landData; 3440 return LandChannel.GetLandObject(x, y).landData;
3437 } 3441 }
3438 3442
3443 public LandData GetLandData(uint x, uint y)
3444 {
3445 m_log.DebugFormat("[SCENE] returning land for {0},{1}", x, y);
3446 return LandChannel.GetLandObject((int)x, (int)y).landData;
3447 }
3448
3439 public void SetLandMusicURL(float x, float y, string url) 3449 public void SetLandMusicURL(float x, float y, string url)
3440 { 3450 {
3441 ILandObject land = LandChannel.GetLandObject(x, y); 3451 ILandObject land = LandChannel.GetLandObject(x, y);
@@ -3833,6 +3843,14 @@ namespace OpenSim.Region.Environment.Scenes
3833// client.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); 3843// client.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0);
3834// }); 3844// });
3835 } 3845 }
3846
3847 public void RegionHandleRequest(IClientAPI client, LLUUID regionID)
3848 {
3849 RegionInfo info;
3850 if(regionID == RegionInfo.RegionID) info = RegionInfo;
3851 else info = CommsManager.GridService.RequestNeighbourInfo(regionID);
3852 if(info != null) client.SendRegionHandle(regionID, info.RegionHandle);
3853 }
3836 3854
3837 3855
3838 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) 3856 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY)
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 008d67a..35a7434 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -59,7 +59,8 @@ namespace OpenSim.Region.Environment.Scenes
59 public event ChildAgentUpdate OnChildAgentUpdate; 59 public event ChildAgentUpdate OnChildAgentUpdate;
60 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; 60 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
61 public event LogOffUser OnLogOffUser; 61 public event LogOffUser OnLogOffUser;
62 62 public event GetLandData OnGetLandData;
63
63 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; 64 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
64 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; 65 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
65 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; 66 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
@@ -69,6 +70,7 @@ namespace OpenSim.Region.Environment.Scenes
69 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 70 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
70 private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; 71 private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
71 private LogOffUser handlerLogOffUser = null; 72 private LogOffUser handlerLogOffUser = null;
73 private GetLandData handlerGetLandData = null; // OnGetLandData
72 74
73 public KillObjectDelegate KillObject; 75 public KillObjectDelegate KillObject;
74 public string _debugRegionName = String.Empty; 76 public string _debugRegionName = String.Empty;
@@ -108,6 +110,7 @@ namespace OpenSim.Region.Environment.Scenes
108 regionCommsHost.OnRegionUp += newRegionUp; 110 regionCommsHost.OnRegionUp += newRegionUp;
109 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; 111 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
110 regionCommsHost.OnLogOffUser += GridLogOffUser; 112 regionCommsHost.OnLogOffUser += GridLogOffUser;
113 regionCommsHost.OnGetLandData += FetchLandData;
111 } 114 }
112 else 115 else
113 { 116 {
@@ -131,6 +134,7 @@ namespace OpenSim.Region.Environment.Scenes
131 regionCommsHost.OnExpectPrim -= IncomingPrimCrossing; 134 regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
132 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; 135 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
133 regionCommsHost.OnCloseAgentConnection -= CloseConnection; 136 regionCommsHost.OnCloseAgentConnection -= CloseConnection;
137 regionCommsHost.OnGetLandData -= FetchLandData;
134 m_commsProvider.GridService.DeregisterRegion(m_regionInfo); 138 m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
135 regionCommsHost = null; 139 regionCommsHost = null;
136 } 140 }
@@ -227,6 +231,16 @@ namespace OpenSim.Region.Environment.Scenes
227 return false; 231 return false;
228 } 232 }
229 233
234 protected LandData FetchLandData(uint x, uint y)
235 {
236 handlerGetLandData = OnGetLandData;
237 if (handlerGetLandData != null)
238 {
239 return handlerGetLandData(x, y);
240 }
241 return null;
242 }
243
230 #endregion 244 #endregion
231 245
232 #region Inform Client of Neighbours 246 #region Inform Client of Neighbours