aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs1
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs2
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs1
-rw-r--r--OpenSim/Framework/RegionInfo.cs3
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs3
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs3
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs58
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs183
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs73
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs6
11 files changed, 293 insertions, 71 deletions
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index c1fb9c4..b67db89 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -32,6 +32,7 @@ namespace OpenSim.Framework.Communications
32{ 32{
33 public interface IGridServices 33 public interface IGridServices
34 { 34 {
35 string gdebugRegionName { get; set; }
35 RegionCommsListener RegisterRegion(RegionInfo regionInfos); 36 RegionCommsListener RegisterRegion(RegionInfo regionInfos);
36 bool DeregisterRegion(RegionInfo regionInfo); 37 bool DeregisterRegion(RegionInfo regionInfo);
37 List<SimpleRegionInfo> RequestNeighbours(uint x, uint y); 38 List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index c64abb5..55616a4 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -31,6 +31,8 @@ namespace OpenSim.Framework.Communications
31{ 31{
32 public interface IInterRegionCommunications 32 public interface IInterRegionCommunications
33 { 33 {
34
35 string rdebugRegionName{ get; set; }
34 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); 36 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
35 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); 37 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
36 bool RegionUp(RegionInfo region); 38 bool RegionUp(RegionInfo region);
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index 449c073..d209ff4 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Framework
43 public event AcknowledgePrimCross OnAcknowledgePrimCrossed; 43 public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
44 public event CloseAgentConnection OnCloseAgentConnection; 44 public event CloseAgentConnection OnCloseAgentConnection;
45 public event RegionUp OnRegionUp; 45 public event RegionUp OnRegionUp;
46 public string debugRegionName="";
46 47
47 48
48 /// <summary> 49 /// <summary>
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 75923ee..c604d53 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework;
39 39
40namespace OpenSim.Framework 40namespace OpenSim.Framework
41{ 41{
42 [Serializable]
42 public class SimpleRegionInfo 43 public class SimpleRegionInfo
43 { 44 {
44 public SimpleRegionInfo() 45 public SimpleRegionInfo()
@@ -183,7 +184,7 @@ namespace OpenSim.Framework
183 } 184 }
184 } 185 }
185 } 186 }
186 187 [Serializable]
187 public class RegionInfo : SimpleRegionInfo 188 public class RegionInfo : SimpleRegionInfo
188 { 189 {
189 public string RegionName = ""; 190 public string RegionName = "";
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 2e04052..691ed57 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -350,6 +350,7 @@ namespace OpenSim.Grid.GridServer
350 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); 350 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
351 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); 351 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
352 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); 352 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
353 NeighbourBlock["regionHandle"] = aSim.Value.regionHandle.ToString();
353 354
354 if (aSim.Value.UUID != TheSim.UUID) 355 if (aSim.Value.UUID != TheSim.UUID)
355 SimNeighboursData.Add(NeighbourBlock); 356 SimNeighboursData.Add(NeighbourBlock);
@@ -376,6 +377,7 @@ namespace OpenSim.Grid.GridServer
376 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); 377 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
377 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); 378 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
378 NeighbourBlock["UUID"] = neighbour.UUID.ToString(); 379 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
380 NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString();
379 381
380 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); 382 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
381 } 383 }
@@ -438,6 +440,7 @@ namespace OpenSim.Grid.GridServer
438 responseData["region_locy"] = simData.regionLocY.ToString(); 440 responseData["region_locy"] = simData.regionLocY.ToString();
439 responseData["region_UUID"] = simData.UUID.UUID.ToString(); 441 responseData["region_UUID"] = simData.UUID.UUID.ToString();
440 responseData["region_name"] = simData.regionName; 442 responseData["region_name"] = simData.regionName;
443 responseData["regionHandle"] = simData.regionHandle.ToString();
441 } 444 }
442 445
443 XmlRpcResponse response = new XmlRpcResponse(); 446 XmlRpcResponse response = new XmlRpcResponse();
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 1afa74a..eab4827 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -722,6 +722,9 @@ namespace OpenSim
722 case "shutdown": 722 case "shutdown":
723 Shutdown(); 723 Shutdown();
724 break; 724 break;
725 case "restart":
726 m_sceneManager.RestartCurrentScene();
727 break;
725 728
726 case "change-region": 729 case "change-region":
727 if (cmdparams.Length > 0) 730 if (cmdparams.Length > 0)
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 746a19a..6e807ec 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -42,6 +42,28 @@ namespace OpenSim.Region.Communications.Local
42 42
43 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); 43 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
44 44
45 public string _gdebugRegionName = "";
46
47 public string gdebugRegionName
48 {
49 get { return _gdebugRegionName; }
50 set
51 {
52 _gdebugRegionName = value;
53
54 }
55 }
56 public string _rdebugRegionName = "";
57
58 public string rdebugRegionName
59 {
60 get { return _rdebugRegionName; }
61 set
62 {
63 _rdebugRegionName = value;
64
65 }
66 }
45 public LocalBackEndServices() 67 public LocalBackEndServices()
46 { 68 {
47 } 69 }
@@ -54,18 +76,36 @@ namespace OpenSim.Region.Communications.Local
54 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 76 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
55 { 77 {
56 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); 78 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
57 if (!m_regions.ContainsKey( regionInfo.RegionHandle)) 79 if (!m_regions.ContainsKey(regionInfo.RegionHandle))
58 { 80 {
59 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); 81 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
60 m_regions.Add(regionInfo.RegionHandle, regionInfo); 82 m_regions.Add(regionInfo.RegionHandle, regionInfo);
61 83
62 RegionCommsListener regionHost = new RegionCommsListener(); 84 RegionCommsListener regionHost = new RegionCommsListener();
85 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
86 {
87 OpenSim.Framework.Console.MainLog.Instance.Error("INTERREGION", "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
88 m_regionListeners.Remove(regionInfo.RegionHandle);
89 }
63 m_regionListeners.Add(regionInfo.RegionHandle, regionHost); 90 m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
64 91
65 return regionHost; 92 return regionHost;
66 } 93 }
94 else
95 {
96 // Already in our list, so the region went dead and restarted.
97 m_regions.Remove(regionInfo.RegionHandle);
98 OpenSim.Framework.Console.MainLog.Instance.Warn("INTERREGION", "Region registered twice. Region went down and came back up.");
67 99
68 //already in our list of regions so for now lets return null 100 RegionCommsListener regionHost = new RegionCommsListener();
101 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
102 {
103 m_regionListeners.Remove(regionInfo.RegionHandle);
104 }
105 m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
106
107 return regionHost;
108 }
69 return null; 109 return null;
70 } 110 }
71 111
@@ -168,7 +208,7 @@ namespace OpenSim.Region.Communications.Local
168 listener.TriggerRegionUp(region); 208 listener.TriggerRegionUp(region);
169 } 209 }
170 210
171 return true; 211 return false;
172 } 212 }
173 213
174 public bool TriggerRegionUp(RegionInfo region) 214 public bool TriggerRegionUp(RegionInfo region)
@@ -181,10 +221,14 @@ namespace OpenSim.Region.Communications.Local
181 //should change from agentCircuitData 221 //should change from agentCircuitData
182 { 222 {
183 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); 223 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
224 //OpenSim.Framework.Console.MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
225
184 if (m_regionListeners.ContainsKey(regionHandle)) 226 if (m_regionListeners.ContainsKey(regionHandle))
185 { 227 {
186 // Console.WriteLine("CommsManager- Informing a region to expect child agent"); 228 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
187 m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData); 229 m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
230 //OpenSim.Framework.Console.MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
231
188 return true; 232 return true;
189 } 233 }
190 return false; 234 return false;
@@ -277,8 +321,12 @@ namespace OpenSim.Region.Communications.Local
277 321
278 public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) 322 public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
279 { 323 {
324 //OpenSim.Framework.Console.MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
325
280 if (m_regionListeners.ContainsKey(regionHandle)) 326 if (m_regionListeners.ContainsKey(regionHandle))
281 { 327 {
328 //OpenSim.Framework.Console.MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
329
282 m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent); 330 m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent);
283 } 331 }
284 } 332 }
@@ -327,8 +375,12 @@ namespace OpenSim.Region.Communications.Local
327 375
328 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) 376 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
329 { 377 {
378 // OpenSim.Framework.Console.MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
379
330 if (m_regionListeners.ContainsKey(regionHandle)) 380 if (m_regionListeners.ContainsKey(regionHandle))
331 { 381 {
382 //OpenSim.Framework.Console.MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname);
383
332 TriggerExpectUser(regionHandle, agentData); 384 TriggerExpectUser(regionHandle, agentData);
333 return true; 385 return true;
334 } 386 }
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index a0d6bd3..282b720 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -49,11 +49,33 @@ namespace OpenSim.Region.Communications.OGS1
49 { 49 {
50 private LocalBackEndServices m_localBackend = new LocalBackEndServices(); 50 private LocalBackEndServices m_localBackend = new LocalBackEndServices();
51 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); 51 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
52 private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>();
52 53
53 public BaseHttpServer httpListener; 54 public BaseHttpServer httpListener;
54 public NetworkServersInfo serversInfo; 55 public NetworkServersInfo serversInfo;
55 public BaseHttpServer httpServer; 56 public BaseHttpServer httpServer;
57 public string _gdebugRegionName = "";
56 58
59 public string gdebugRegionName
60 {
61 get { return _gdebugRegionName; }
62 set
63 {
64 _gdebugRegionName = value;
65
66 }
67 }
68 public string _rdebugRegionName = "";
69
70 public string rdebugRegionName
71 {
72 get { return _rdebugRegionName; }
73 set
74 {
75 _rdebugRegionName = value;
76
77 }
78 }
57 /// <summary> 79 /// <summary>
58 /// 80 ///
59 /// </summary> 81 /// </summary>
@@ -105,10 +127,19 @@ namespace OpenSim.Region.Communications.OGS1
105 // Process Response 127 // Process Response
106 if (GridRespData.ContainsKey("error")) 128 if (GridRespData.ContainsKey("error"))
107 { 129 {
108 string errorstring = (string) GridRespData["error"]; 130 string errorstring = (string)GridRespData["error"];
109 MainLog.Instance.Error("Unable to connect to grid: " + errorstring); 131 MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
110 return null; 132 return null;
111 } 133 }
134 else
135 {
136 //m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
137
138
139 }
140 //SimpleRegionInfo regiondata = new SimpleRegionInfo();
141 //regiondata.RegionID = griddatahash["UUID"];
142 //regiondata.RemotingAddress =
112 143
113 return m_localBackend.RegisterRegion(regionInfo); 144 return m_localBackend.RegisterRegion(regionInfo);
114 } 145 }
@@ -155,7 +186,53 @@ namespace OpenSim.Region.Communications.OGS1
155 return neighbours; 186 return neighbours;
156 } 187 }
157 188
189 /// <summary>
190 ///
191 /// </summary>
192 /// <param name="regionHandle"></param>
193 /// <returns></returns>
194 public RegionInfo RequestNeighbourInfo(LLUUID Region_UUID)
195 {
196 RegionInfo regionInfo;
197 Hashtable requestData = new Hashtable();
198 requestData["region_UUID"] = Region_UUID.ToStringHyphenated();
199 requestData["authkey"] = serversInfo.GridSendKey;
200 ArrayList SendParams = new ArrayList();
201 SendParams.Add(requestData);
202 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
203 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
204
205 Hashtable responseData = (Hashtable)GridResp.Value;
158 206
207 if (responseData.ContainsKey("error"))
208 {
209 Console.WriteLine("error received from grid server" + responseData["error"]);
210 return null;
211 }
212
213 uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
214 uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
215 string internalIpStr = (string)responseData["sim_ip"];
216 uint port = Convert.ToUInt32(responseData["sim_port"]);
217 string externalUri = (string)responseData["sim_uri"];
218
219 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
220 string neighbourExternalUri = externalUri;
221 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
222
223 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
224 regionInfo.RemotingAddress = internalIpStr;
225
226 regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]);
227 regionInfo.RegionName = (string)responseData["region_name"];
228
229 if (requestData.ContainsKey("regionHandle"))
230 {
231 m_remoteRegionInfoCache.Add(Convert.ToUInt64((string)requestData["regionHandle"]), regionInfo);
232 }
233
234 return regionInfo;
235 }
159 /// <summary> 236 /// <summary>
160 /// 237 ///
161 /// </summary> 238 /// </summary>
@@ -381,7 +458,7 @@ namespace OpenSim.Region.Communications.OGS1
381 InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; 458 InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
382 InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; 459 InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
383 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; 460 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
384 461 InterRegionSingleton.Instance.OnRegionUp += RegionUp;
385 } 462 }
386 463
387 #region Methods called by regions in this instance 464 #region Methods called by regions in this instance
@@ -427,7 +504,7 @@ namespace OpenSim.Region.Communications.OGS1
427 Console.WriteLine("remoting object not found"); 504 Console.WriteLine("remoting object not found");
428 } 505 }
429 remObject = null; 506 remObject = null;
430 507 MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + agentData.firstname + " " + agentData.lastname + " and got " + retValue.ToString());
431 508
432 return retValue; 509 return retValue;
433 } 510 }
@@ -470,17 +547,27 @@ namespace OpenSim.Region.Communications.OGS1
470 // UGLY! 547 // UGLY!
471 public bool RegionUp(RegionInfo region) 548 public bool RegionUp(RegionInfo region)
472 { 549 {
473 RegionInfo regInfo = null; 550
474 try 551 // This is stupid. For this to work, when the region registers it must request nearby map blocks.
552 // In addition to filling the map blocks, it fills a 'known regions' list.
553
554 // This known regions list then gets queried on here to get the remoting data from the neighbors.
555 // *Pull yourself up by your bootstraps?*
556
557 if (m_localBackend.RegionUp(region))
475 { 558 {
476 if (m_localBackend.RegionUp(region)) 559 return true;
477 { 560 }
478 return true; 561 return true;
479 } 562 foreach (SimpleRegionInfo knownregion in m_knownRegions)
480 foreach (RegionInfo remoteInfo in m_remoteRegionInfoCache.Values) 563 {
481 { 564 // Wha?
482 regInfo = RequestNeighbourInfo(remoteInfo.RegionHandle); 565 RegionInfo regInfo = RequestNeighbourInfo(knownregion.RegionID);
483 if (regInfo != null) 566
567 try
568 {
569
570 if ((!(regInfo.Equals(null)) && regInfo.RemotingAddress.Length > 0))
484 { 571 {
485 //don't want to be creating a new link to the remote instance every time like we are here 572 //don't want to be creating a new link to the remote instance every time like we are here
486 bool retValue = false; 573 bool retValue = false;
@@ -501,43 +588,41 @@ namespace OpenSim.Region.Communications.OGS1
501 Console.WriteLine("remoting object not found"); 588 Console.WriteLine("remoting object not found");
502 } 589 }
503 remObject = null; 590 remObject = null;
591 //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + region.RegionName + " and got " + retValue.ToString());
504 592
505 } 593 }
506 594
507 } 595 }
508 596 catch (RemotingException e)
509 597 {
510 return true; 598 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
511 } 599 MainLog.Instance.Debug(e.ToString());
512 catch (RemotingException e) 600 //return false;
513 { 601 }
514 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 602 catch (SocketException e)
515 MainLog.Instance.Debug(e.ToString()); 603 {
516 return false; 604 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
517 } 605 MainLog.Instance.Debug(e.ToString());
518 catch (SocketException e) 606 //return false;
519 { 607 }
520 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 608 catch (InvalidCredentialException e)
521 MainLog.Instance.Debug(e.ToString()); 609 {
522 return false; 610 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
523 } 611 MainLog.Instance.Debug(e.ToString());
524 catch (InvalidCredentialException e) 612 //return false;
525 { 613 }
526 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 614 catch (AuthenticationException e)
527 MainLog.Instance.Debug(e.ToString()); 615 {
528 return false; 616 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
529 } 617 MainLog.Instance.Debug(e.ToString());
530 catch (AuthenticationException e) 618 //return false;
531 { 619 }
532 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 620 catch (Exception e)
533 MainLog.Instance.Debug(e.ToString()); 621 {
534 return false; 622 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
535 } 623 MainLog.Instance.Debug(e.ToString());
536 catch (Exception e) 624 //return false;
537 { 625 }
538 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
539 MainLog.Instance.Debug(e.ToString());
540 return false;
541 } 626 }
542 return true; 627 return true;
543 } 628 }
@@ -745,19 +830,23 @@ namespace OpenSim.Region.Communications.OGS1
745 /// <returns></returns> 830 /// <returns></returns>
746 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) 831 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
747 { 832 {
833 //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname);
834
748 try 835 try
749 { 836 {
750 return m_localBackend.IncomingChildAgent(regionHandle, agentData); 837 return m_localBackend.IncomingChildAgent(regionHandle, agentData);
751 } 838 }
752 catch (RemotingException e) 839 catch (RemotingException e)
753 { 840 {
754 MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); 841 //MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
755 return false; 842 return false;
756 } 843 }
757 } 844 }
758 845
759 public bool TriggerRegionUp(RegionInfo regionData) 846 public bool TriggerRegionUp(RegionInfo regionData)
760 { 847 {
848 //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport " + regionData.RegionName);
849
761 try 850 try
762 { 851 {
763 return m_localBackend.TriggerRegionUp(regionData); 852 return m_localBackend.TriggerRegionUp(regionData);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a9791ee..d8723f6 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -57,6 +57,9 @@ namespace OpenSim.Region.Environment.Scenes
57 { 57 {
58 #region Fields 58 #region Fields
59 protected Timer m_heartbeatTimer = new Timer(); 59 protected Timer m_heartbeatTimer = new Timer();
60 protected Timer m_restartWaitTimer = new Timer();
61
62 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
60 63
61 public InnerScene m_innerScene; 64 public InnerScene m_innerScene;
62 65
@@ -210,6 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
210 m_authenticateHandler = authen; 213 m_authenticateHandler = authen;
211 CommsManager = commsMan; 214 CommsManager = commsMan;
212 m_sceneGridService = sceneGridService; 215 m_sceneGridService = sceneGridService;
216 m_sceneGridService.debugRegionName = regInfo.RegionName;
213 m_storageManager = storeManager; 217 m_storageManager = storeManager;
214 AssetCache = assetCach; 218 AssetCache = assetCach;
215 m_regInfo = regInfo; 219 m_regInfo = regInfo;
@@ -244,6 +248,8 @@ namespace OpenSim.Region.Environment.Scenes
244 248
245 httpListener = httpServer; 249 httpListener = httpServer;
246 m_dumpAssetsToFile = dumpAssetsToFile; 250 m_dumpAssetsToFile = dumpAssetsToFile;
251
252 // This function was moved to terrain for some kind of map hack by babble
247 RegisterRegionWithComms(); 253 RegisterRegionWithComms();
248 } 254 }
249 255
@@ -262,29 +268,23 @@ namespace OpenSim.Region.Environment.Scenes
262 { 268 {
263 // Another region is up. We have to tell all our ScenePresences about it 269 // Another region is up. We have to tell all our ScenePresences about it
264 // This fails to get the desired effect and needs further work. 270 // This fails to get the desired effect and needs further work.
265 try 271 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
266 { 272 {
267 273 if (!(m_regionRestartNotifyList.Contains(otherRegion)))
268 ForEachScenePresence(delegate(ScenePresence agent)
269 { 274 {
270 if (!(agent.IsChildAgent)) 275 m_regionRestartNotifyList.Add(otherRegion);
271 { 276
272 this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 277 m_restartWaitTimer = new Timer(20000);
273 InformClientOfNeighbor(agent, otherRegion); 278 m_restartWaitTimer.AutoReset = false;
274 } 279 m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed);
280 m_restartWaitTimer.Start();
275 } 281 }
276
277 );
278 }
279 catch (System.NullReferenceException)
280 {
281 // This means that we're not booted up completely yet.
282 } 282 }
283 return true; 283 return true;
284 } 284 }
285 public virtual void Restart(float seconds) 285 public virtual void Restart(float seconds)
286 { 286 {
287 if (seconds < 100) 287 if (seconds < 15)
288 { 288 {
289 t_restartTimer.Stop(); 289 t_restartTimer.Stop();
290 SendGeneralAlert("Restart Aborted"); 290 SendGeneralAlert("Restart Aborted");
@@ -314,6 +314,7 @@ namespace OpenSim.Region.Environment.Scenes
314 else 314 else
315 { 315 {
316 t_restartTimer.Stop(); 316 t_restartTimer.Stop();
317 t_restartTimer.AutoReset = false;
317 MainLog.Instance.Error("REGION", "Closing"); 318 MainLog.Instance.Error("REGION", "Closing");
318 Close(); 319 Close();
319 MainLog.Instance.Error("REGION", "Firing Region Restart Message"); 320 MainLog.Instance.Error("REGION", "Firing Region Restart Message");
@@ -321,6 +322,34 @@ namespace OpenSim.Region.Environment.Scenes
321 } 322 }
322 323
323 } 324 }
325 public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e)
326 {
327 m_restartWaitTimer.Stop();
328 foreach (RegionInfo region in m_regionRestartNotifyList)
329 {
330 try
331 {
332
333 ForEachScenePresence(delegate(ScenePresence agent)
334 {
335 if (!(agent.IsChildAgent))
336 {
337 //agent.ControllingClient.new
338 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
339 InformClientOfNeighbor(agent, region);
340 }
341 }
342
343 );
344 }
345 catch (System.NullReferenceException)
346 {
347 // This means that we're not booted up completely yet.
348 }
349 }
350 // Reset list to nothing.
351 m_regionRestartNotifyList = new List<RegionInfo>();
352 }
324 public override void Close() 353 public override void Close()
325 { 354 {
326 ForEachScenePresence(delegate(ScenePresence avatar) 355 ForEachScenePresence(delegate(ScenePresence avatar)
@@ -642,7 +671,11 @@ namespace OpenSim.Region.Environment.Scenes
642 } 671 }
643 672
644 CreateTerrainTextureInitial(); 673 CreateTerrainTextureInitial();
645 CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map 674 //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map
675
676 // These two 'commands' *must be* next to each other or sim rebooting fails.
677 m_sceneGridService.RegisterRegion(RegionInfo);
678 m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
646 } 679 }
647 catch (Exception e) 680 catch (Exception e)
648 { 681 {
@@ -1073,13 +1106,17 @@ namespace OpenSim.Region.Environment.Scenes
1073 /// </summary> 1106 /// </summary>
1074 public void RegisterRegionWithComms() 1107 public void RegisterRegionWithComms()
1075 { 1108 {
1076 m_sceneGridService.RegisterRegion(m_regInfo); 1109 // Don't register here. babblefro moved registration to *after *the map
1110 // functions on line 675 so that a proper map will generate and get sent to grid services
1111 // Double registrations will cause inter region communication issues
1112
1113 //m_sceneGridService.RegisterRegion(m_regInfo);
1077 m_sceneGridService.OnExpectUser += NewUserConnection; 1114 m_sceneGridService.OnExpectUser += NewUserConnection;
1078 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 1115 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
1079 m_sceneGridService.OnCloseAgentConnection += CloseConnection; 1116 m_sceneGridService.OnCloseAgentConnection += CloseConnection;
1080 m_sceneGridService.OnRegionUp += OtherRegionUp; 1117 m_sceneGridService.OnRegionUp += OtherRegionUp;
1081 // Tell Other regions that I'm here. 1118 // Tell Other regions that I'm here.
1082 m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); 1119
1083 } 1120 }
1084 public void UnRegisterReginWithComms() 1121 public void UnRegisterReginWithComms()
1085 { 1122 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 18ce34d..0355a1b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -22,25 +22,48 @@ namespace OpenSim.Region.Environment.Scenes
22 public event CloseAgentConnection OnCloseAgentConnection; 22 public event CloseAgentConnection OnCloseAgentConnection;
23 public event PrimCrossing OnPrimCrossingIntoRegion; 23 public event PrimCrossing OnPrimCrossingIntoRegion;
24 public event RegionUp OnRegionUp; 24 public event RegionUp OnRegionUp;
25 25 public string _debugRegionName = "";
26
27 public string debugRegionName
28 {
29 get { return _debugRegionName; }
30 set
31 {
32 _debugRegionName = value;
33
34
35
36 }
37 }
26 38
27 public SceneCommunicationService(CommunicationsManager commsMan) 39 public SceneCommunicationService(CommunicationsManager commsMan)
28 { 40 {
29 m_commsProvider = commsMan; 41 m_commsProvider = commsMan;
42 m_commsProvider.GridService.gdebugRegionName = _debugRegionName;
43 m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
30 } 44 }
31 45
32 public void RegisterRegion(RegionInfo regionInfos) 46 public void RegisterRegion(RegionInfo regionInfos)
33 { 47 {
34 m_regionInfo = regionInfos; 48 m_regionInfo = regionInfos;
35 regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); 49 regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
50
36 if (regionCommsHost != null) 51 if (regionCommsHost != null)
37 { 52 {
53 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
54
55 regionCommsHost.debugRegionName = _debugRegionName;
38 regionCommsHost.OnExpectUser += NewUserConnection; 56 regionCommsHost.OnExpectUser += NewUserConnection;
39 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; 57 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
40 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing; 58 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
41 regionCommsHost.OnCloseAgentConnection += CloseConnection; 59 regionCommsHost.OnCloseAgentConnection += CloseConnection;
42 regionCommsHost.OnRegionUp += newRegionUp; 60 regionCommsHost.OnRegionUp += newRegionUp;
43 61
62
63 }
64 else
65 {
66 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
44 67
45 } 68 }
46 } 69 }
@@ -70,6 +93,7 @@ namespace OpenSim.Region.Environment.Scenes
70 { 93 {
71 if (OnExpectUser != null) 94 if (OnExpectUser != null)
72 { 95 {
96 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname);
73 OnExpectUser(regionHandle, agent); 97 OnExpectUser(regionHandle, agent);
74 } 98 }
75 } 99 }
@@ -78,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
78 { 102 {
79 if (OnRegionUp != null) 103 if (OnRegionUp != null)
80 { 104 {
105 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
81 OnRegionUp(region); 106 OnRegionUp(region);
82 } 107 }
83 return true; 108 return true;
@@ -188,6 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
188 /// <returns></returns> 213 /// <returns></returns>
189 public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) 214 public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
190 { 215 {
216 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString());
191 return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle); 217 return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
192 } 218 }
193 219
@@ -275,6 +301,7 @@ namespace OpenSim.Region.Environment.Scenes
275 301
276 public void InformNeighborsThatRegionisUp(RegionInfo region) 302 public void InformNeighborsThatRegionisUp(RegionInfo region)
277 { 303 {
304 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
278 bool val = m_commsProvider.InterRegion.RegionUp(region); 305 bool val = m_commsProvider.InterRegion.RegionUp(region);
279 } 306 }
280 307
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index c28269e..eba45fc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -214,6 +214,12 @@ namespace OpenSim.Region.Environment.Scenes
214 } 214 }
215 } 215 }
216 216
217 public void RestartCurrentScene()
218 {
219 ForEachCurrentScene(delegate(Scene scene) { scene.Restart(15); });
220
221 }
222
217 public void BackupCurrentScene() 223 public void BackupCurrentScene()
218 { 224 {
219 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); 225 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });