aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs97
-rw-r--r--OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs1
2 files changed, 89 insertions, 9 deletions
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