aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-27 13:46:52 +0000
committerTeravus Ovares2007-11-27 13:46:52 +0000
commit082f2baebe300e1313a34444c42dcc0a20c44baf (patch)
tree71616106c7a7dc1a3e21ea14c2f4b6d09fc642a5 /OpenSim/Region/Communications
parentMainMap workaround. Map still does not fill in automatically, but one click o... (diff)
downloadopensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.zip
opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.tar.gz
opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.tar.bz2
opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.tar.xz
Fixed an event in the events chain in inter-region communications.
As a consequence, restarting sims in the same process instance now shows them when they come back up in grid mode and standalone mode.
Diffstat (limited to 'OpenSim/Region/Communications')
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs58
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs183
2 files changed, 191 insertions, 50 deletions
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);