aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-07-10 20:52:43 +0000
committerMW2007-07-10 20:52:43 +0000
commitf0ecc1de4ccb40ed23b5bc925130bda3ff07c1a6 (patch)
treed7f269f36b7f29e980b9f70ebe273569afb964c6
parentFixed the crashing when trying to look at the map in grid mode. Although the ... (diff)
downloadopensim-SC_OLD-f0ecc1de4ccb40ed23b5bc925130bda3ff07c1a6.zip
opensim-SC_OLD-f0ecc1de4ccb40ed23b5bc925130bda3ff07c1a6.tar.gz
opensim-SC_OLD-f0ecc1de4ccb40ed23b5bc925130bda3ff07c1a6.tar.bz2
opensim-SC_OLD-f0ecc1de4ccb40ed23b5bc925130bda3ff07c1a6.tar.xz
preliminary inter region communications (between regions in different instances) now works, so child agents and border crossings (and teleporting) now work.
The .net remoting is still very basic: we need security sinks added. And we really need the OGS 2 protocol as soon as possible.
-rw-r--r--OpenSim/Framework/General/Types/AgentCiruitData.cs2
-rw-r--r--OpenSim/Framework/General/Types/RegionInfo.cs1
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs6
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs97
-rw-r--r--OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs1
5 files changed, 97 insertions, 10 deletions
diff --git a/OpenSim/Framework/General/Types/AgentCiruitData.cs b/OpenSim/Framework/General/Types/AgentCiruitData.cs
index 00e9d0a..ed9ee3c 100644
--- a/OpenSim/Framework/General/Types/AgentCiruitData.cs
+++ b/OpenSim/Framework/General/Types/AgentCiruitData.cs
@@ -26,9 +26,11 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using System;
29 30
30namespace OpenSim.Framework.Types 31namespace OpenSim.Framework.Types
31{ 32{
33 [Serializable]
32 public class AgentCircuitData 34 public class AgentCircuitData
33 { 35 {
34 public AgentCircuitData() { } 36 public AgentCircuitData() { }
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs
index 72d1a4c..cfc0925 100644
--- a/OpenSim/Framework/General/Types/RegionInfo.cs
+++ b/OpenSim/Framework/General/Types/RegionInfo.cs
@@ -130,6 +130,7 @@ namespace OpenSim.Framework.Types
130 m_remotingPort = value; 130 m_remotingPort = value;
131 } 131 }
132 } 132 }
133 public string RemotingAddress;
133 134
134 public string DataStore = ""; 135 public string DataStore = "";
135 public bool isSandbox = false; 136 public bool isSandbox = false;
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 6ddb921..1f97f53 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -266,6 +266,7 @@ namespace OpenSim.Grid.GridServer
266 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); 266 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
267 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); 267 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
268 TheSim.regionLocZ = 0; 268 TheSim.regionLocZ = 0;
269 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
269 270
270 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 271 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
271 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle); 272 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
@@ -392,16 +393,19 @@ namespace OpenSim.Grid.GridServer
392 } 393 }
393 else if (requestData.ContainsKey("region_handle")) 394 else if (requestData.ContainsKey("region_handle"))
394 { 395 {
396 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]);
395 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); 397 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
396 } 398 }
397 399
398 if (simData == null) 400 if (simData == null)
399 { 401 {
400 //Sim does not exist 402 //Sim does not exist
403 Console.WriteLine("region not found");
401 responseData["error"] = "Sim does not exist"; 404 responseData["error"] = "Sim does not exist";
402 } 405 }
403 else 406 else
404 { 407 {
408 Console.WriteLine("found region");
405 responseData["sim_ip"] = simData.serverIP; 409 responseData["sim_ip"] = simData.serverIP;
406 responseData["sim_port"] = simData.serverPort.ToString(); 410 responseData["sim_port"] = simData.serverPort.ToString();
407 responseData["http_port"] = simData.httpPort.ToString(); 411 responseData["http_port"] = simData.httpPort.ToString();
@@ -493,7 +497,7 @@ namespace OpenSim.Grid.GridServer
493 simProfileBlock["region-flags"] = 0; 497 simProfileBlock["region-flags"] = 0;
494 simProfileBlock["water-height"] = 20; 498 simProfileBlock["water-height"] = 20;
495 simProfileBlock["agents"] = 1; 499 simProfileBlock["agents"] = 1;
496 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); 500 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated();
497 501
498 // For Sugilite compatibility 502 // For Sugilite compatibility
499 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); 503 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 1cadf9b..66c1739 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -29,6 +29,7 @@ namespace OpenSim.Region.Communications.OGS1
29 serversInfo = servers_info; 29 serversInfo = servers_info;
30 httpServer = httpServe; 30 httpServer = httpServe;
31 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); 31 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser);
32 this.StartRemoting();
32 } 33 }
33 34
34 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 35 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
@@ -52,6 +53,7 @@ namespace OpenSim.Region.Communications.OGS1
52 GridParams["sim_name"] = regionInfo.RegionName; 53 GridParams["sim_name"] = regionInfo.RegionName;
53 GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); 54 GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
54 GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString(); 55 GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString();
56 GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated();
55 57
56 // Package into an XMLRPC Request 58 // Package into an XMLRPC Request
57 ArrayList SendParams = new ArrayList(); 59 ArrayList SendParams = new ArrayList();
@@ -97,7 +99,7 @@ namespace OpenSim.Region.Communications.OGS1
97 99
98 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) 100 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
99 { 101 {
100 102
101 Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); 103 Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1);
102 104
103 List<RegionInfo> neighbours = new List<RegionInfo>(); 105 List<RegionInfo> neighbours = new List<RegionInfo>();
@@ -141,8 +143,40 @@ namespace OpenSim.Region.Communications.OGS1
141 return this.regions[regionHandle]; 143 return this.regions[regionHandle];
142 } 144 }
143 //TODO not a region in this instance so ask remote grid server 145 //TODO not a region in this instance so ask remote grid server
144 MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); 146
145 return null; 147 Hashtable requestData = new Hashtable();
148 requestData["region_handle"] = regionHandle.ToString();
149 requestData["authkey"] = this.serversInfo.GridSendKey;
150 ArrayList SendParams = new ArrayList();
151 SendParams.Add(requestData);
152 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
153 XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000);
154
155 Hashtable responseData = (Hashtable)GridResp.Value;
156
157 if (responseData.ContainsKey("error"))
158 {
159 Console.WriteLine("error received from grid server" + responseData["error"]);
160 return null;
161 }
162
163 uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
164 uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
165 string internalIpStr = (string)responseData["sim_ip"];
166 uint port = Convert.ToUInt32(responseData["sim_port"]);
167 string externalUri = (string)responseData["sim_uri"];
168
169 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
170 string neighbourExternalUri = externalUri;
171 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
172
173 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
174 regionInfo.RemotingAddress = internalIpStr;
175
176 regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]);
177 regionInfo.RegionName = (string)responseData["region_name"];
178
179 return regionInfo;
146 } 180 }
147 181
148 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 182 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
@@ -164,7 +198,7 @@ namespace OpenSim.Region.Communications.OGS1
164 neighbour.Access = Convert.ToByte(n["access"]); 198 neighbour.Access = Convert.ToByte(n["access"]);
165 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); 199 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
166 neighbour.WaterHeight = Convert.ToByte(n["water-height"]); 200 neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
167 neighbour.MapImageId = (string)n["map-image-id"]; 201 neighbour.MapImageId = new LLUUID((string)n["map-image-id"]);
168 202
169 neighbours.Add(neighbour); 203 neighbours.Add(neighbour);
170 } 204 }
@@ -237,10 +271,10 @@ namespace OpenSim.Region.Communications.OGS1
237 #region InterRegion Comms 271 #region InterRegion Comms
238 private void StartRemoting() 272 private void StartRemoting()
239 { 273 {
240 TcpChannel ch = new TcpChannel(8895); 274 TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
241 ChannelServices.RegisterChannel(ch, true); 275 ChannelServices.RegisterChannel(ch, true);
242 276
243 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); 277 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
244 RemotingConfiguration.RegisterWellKnownServiceType(wellType); 278 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
245 InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; 279 InterRegionSingleton.Instance.OnArrival += this.IncomingArrival;
246 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; 280 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
@@ -254,9 +288,31 @@ namespace OpenSim.Region.Communications.OGS1
254 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); 288 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
255 return true; 289 return true;
256 } 290 }
257 //TODO need to see if we know about where this region is and use .net remoting 291 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
258 // to inform it. 292 if (regInfo != null)
259 Console.WriteLine("Inform remote region of child agent not implemented yet"); 293 {
294 //don't want to be creating a new link to the remote instance every time like we are here
295 bool retValue = false;
296
297
298 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
299 typeof(OGS1InterRegionRemoting),
300 "tcp://"+ regInfo.RemotingAddress+":"+regInfo.RemotingPort+"/InterRegions");
301 if (remObject != null)
302 {
303
304 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
305 }
306 else
307 {
308 Console.WriteLine("remoting object not found");
309 }
310 remObject = null;
311
312
313 return retValue;
314 }
315
260 return false; 316 return false;
261 } 317 }
262 318
@@ -267,6 +323,29 @@ namespace OpenSim.Region.Communications.OGS1
267 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); 323 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
268 return true; 324 return true;
269 } 325 }
326 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
327 if (regInfo != null)
328 {
329 bool retValue = false;
330
331
332 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
333 typeof(OGS1InterRegionRemoting),
334 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions");
335 if (remObject != null)
336 {
337
338 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position);
339 }
340 else
341 {
342 Console.WriteLine("remoting object not found");
343 }
344 remObject = null;
345
346
347 return retValue;
348 }
270 //TODO need to see if we know about where this region is and use .net remoting 349 //TODO need to see if we know about where this region is and use .net remoting
271 // to inform it. 350 // to inform it.
272 return false; 351 return false;
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
index bd303e1..54d43a1 100644
--- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
+++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
@@ -269,6 +269,7 @@ namespace OpenSim.Region.GridInterfaces.Local
269 } 269 }
270 catch (Exception e) 270 catch (Exception e)
271 { 271 {
272 Console.WriteLine("exception loading default assets into database");
272 Console.WriteLine(e.Message); 273 Console.WriteLine(e.Message);
273 } 274 }
274 275