diff options
author | Teravus Ovares | 2007-11-28 06:18:07 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-28 06:18:07 +0000 |
commit | b7d596a6af51bea7dba642cdc768ac5ff77af5f3 (patch) | |
tree | 967b749b10b548f6ed687d8ade4680e411793da4 /OpenSim | |
parent | build ThrottleCheck function to clear up bits of the throttle (diff) | |
download | opensim-SC_OLD-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.zip opensim-SC_OLD-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.gz opensim-SC_OLD-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.bz2 opensim-SC_OLD-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.xz |
* Restaring the sim works fine in grid mode now. Sims announce themselves to their neighbors when they start up. Neighbors get this message and tell their agents that there's a new sim up.
* Certain unrecoverable physics based crashes in ODE are now hooked up to the 'restart the sim' routine.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/IInterRegionCommunications.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 14 | ||||
-rw-r--r-- | OpenSim/Framework/SerializableRegionInfo.cs | 195 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalBackEndServices.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 22 |
13 files changed, 354 insertions, 47 deletions
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 55616a4..a492c51 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Framework.Communications | |||
35 | string rdebugRegionName{ get; set; } | 35 | string rdebugRegionName{ get; set; } |
36 | bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); | 36 | bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); |
37 | bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); | 37 | bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); |
38 | bool RegionUp(RegionInfo region); | 38 | bool RegionUp(SearializableRegionInfo region); |
39 | 39 | ||
40 | bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); | 40 | bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
41 | bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying); | 41 | bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying); |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index c604d53..dd4078b 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Framework | |||
69 | 69 | ||
70 | public LLUUID RegionID = LLUUID.Zero; | 70 | public LLUUID RegionID = LLUUID.Zero; |
71 | 71 | ||
72 | private uint m_remotingPort; | 72 | public uint m_remotingPort; |
73 | public uint RemotingPort | 73 | public uint RemotingPort |
74 | { | 74 | { |
75 | get | 75 | get |
@@ -184,7 +184,7 @@ namespace OpenSim.Framework | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | } | 186 | } |
187 | [Serializable] | 187 | |
188 | public class RegionInfo : SimpleRegionInfo | 188 | public class RegionInfo : SimpleRegionInfo |
189 | { | 189 | { |
190 | public string RegionName = ""; | 190 | public string RegionName = ""; |
@@ -235,7 +235,15 @@ namespace OpenSim.Framework | |||
235 | { | 235 | { |
236 | 236 | ||
237 | } | 237 | } |
238 | 238 | public RegionInfo(SearializableRegionInfo ConvertFrom) | |
239 | { | ||
240 | m_regionLocX = ConvertFrom.RegionLocX; | ||
241 | m_regionLocY = ConvertFrom.RegionLocY; | ||
242 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
243 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
244 | m_remotingPort = ConvertFrom.RemotingPort; | ||
245 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
246 | } | ||
239 | //not in use, should swap to nini though. | 247 | //not in use, should swap to nini though. |
240 | public void LoadFromNiniSource(IConfigSource source) | 248 | public void LoadFromNiniSource(IConfigSource source) |
241 | { | 249 | { |
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs new file mode 100644 index 0000000..cd59b75 --- /dev/null +++ b/OpenSim/Framework/SerializableRegionInfo.cs | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Globalization; | ||
30 | using System.Net; | ||
31 | using System.Xml; | ||
32 | using System.Net.Sockets; | ||
33 | using libsecondlife; | ||
34 | |||
35 | |||
36 | |||
37 | |||
38 | namespace OpenSim.Framework | ||
39 | { | ||
40 | [Serializable] | ||
41 | public class SearializableRegionInfo | ||
42 | { | ||
43 | public SearializableRegionInfo() | ||
44 | { | ||
45 | } | ||
46 | public SearializableRegionInfo(RegionInfo ConvertFrom) | ||
47 | { | ||
48 | m_regionLocX = ConvertFrom.RegionLocX; | ||
49 | m_regionLocY = ConvertFrom.RegionLocY; | ||
50 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
51 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
52 | m_remotingPort = ConvertFrom.RemotingPort; | ||
53 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
54 | |||
55 | } | ||
56 | public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | ||
57 | { | ||
58 | |||
59 | m_regionLocX = regionLocX; | ||
60 | m_regionLocY = regionLocY; | ||
61 | |||
62 | m_internalEndPoint = internalEndPoint; | ||
63 | m_externalHostName = externalUri; | ||
64 | } | ||
65 | |||
66 | public SearializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) | ||
67 | { | ||
68 | |||
69 | m_regionLocX = regionLocX; | ||
70 | m_regionLocY = regionLocY; | ||
71 | |||
72 | m_externalHostName = externalUri; | ||
73 | |||
74 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
75 | } | ||
76 | |||
77 | public LLUUID RegionID = LLUUID.Zero; | ||
78 | |||
79 | public uint m_remotingPort; | ||
80 | public uint RemotingPort | ||
81 | { | ||
82 | get | ||
83 | { | ||
84 | return m_remotingPort; | ||
85 | } | ||
86 | set | ||
87 | { | ||
88 | m_remotingPort = value; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public string RemotingAddress; | ||
93 | |||
94 | |||
95 | public IPEndPoint ExternalEndPoint | ||
96 | { | ||
97 | get | ||
98 | { | ||
99 | // Old one defaults to IPv6 | ||
100 | //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port ); | ||
101 | |||
102 | IPAddress ia = null; | ||
103 | // If it is already an IP, don't resolve it - just return directly | ||
104 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
105 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
106 | |||
107 | // Reset for next check | ||
108 | ia = null; | ||
109 | |||
110 | |||
111 | // New method favors IPv4 | ||
112 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
113 | { | ||
114 | if (ia == null) | ||
115 | ia = Adr; | ||
116 | |||
117 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
118 | { | ||
119 | ia = Adr; | ||
120 | break; | ||
121 | } | ||
122 | |||
123 | } | ||
124 | |||
125 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
126 | } | ||
127 | |||
128 | set | ||
129 | { | ||
130 | m_externalHostName = value.ToString(); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | protected string m_externalHostName; | ||
135 | public string ExternalHostName | ||
136 | { | ||
137 | get | ||
138 | { | ||
139 | return m_externalHostName; | ||
140 | } | ||
141 | set | ||
142 | { | ||
143 | m_externalHostName = value; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | protected IPEndPoint m_internalEndPoint; | ||
148 | public IPEndPoint InternalEndPoint | ||
149 | { | ||
150 | get | ||
151 | { | ||
152 | return m_internalEndPoint; | ||
153 | } | ||
154 | set | ||
155 | { | ||
156 | m_internalEndPoint = value; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | protected uint? m_regionLocX; | ||
161 | public uint RegionLocX | ||
162 | { | ||
163 | get | ||
164 | { | ||
165 | return m_regionLocX.Value; | ||
166 | } | ||
167 | set | ||
168 | { | ||
169 | m_regionLocX = value; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | protected uint? m_regionLocY; | ||
174 | public uint RegionLocY | ||
175 | { | ||
176 | get | ||
177 | { | ||
178 | return m_regionLocY.Value; | ||
179 | } | ||
180 | set | ||
181 | { | ||
182 | m_regionLocY = value; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | public ulong RegionHandle | ||
187 | { | ||
188 | get | ||
189 | { | ||
190 | return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | |||
195 | } | ||
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index eab4827..5877aa6 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -601,6 +601,8 @@ namespace OpenSim | |||
601 | m_log.Error("show uptime - show simulator startup and uptime."); | 601 | m_log.Error("show uptime - show simulator startup and uptime."); |
602 | m_log.Error("show users - show info about connected users."); | 602 | m_log.Error("show users - show info about connected users."); |
603 | m_log.Error("show modules - shows info aboutloaded modules."); | 603 | m_log.Error("show modules - shows info aboutloaded modules."); |
604 | m_log.Error("change-region - sets the region that many of these commands affect."); | ||
605 | m_log.Error("restart - disconnects all clients and restarts the sims in the instance."); | ||
604 | m_log.Error("shutdown - disconnect all clients and shutdown."); | 606 | m_log.Error("shutdown - disconnect all clients and shutdown."); |
605 | m_log.Error("terrain help - show help for terrain commands."); | 607 | m_log.Error("terrain help - show help for terrain commands."); |
606 | m_log.Error("quit - equivalent to shutdown."); | 608 | m_log.Error("quit - equivalent to shutdown."); |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 6e807ec..0f3ec73 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -106,7 +106,6 @@ namespace OpenSim.Region.Communications.Local | |||
106 | 106 | ||
107 | return regionHost; | 107 | return regionHost; |
108 | } | 108 | } |
109 | return null; | ||
110 | } | 109 | } |
111 | 110 | ||
112 | public bool DeregisterRegion(RegionInfo regionInfo) | 111 | public bool DeregisterRegion(RegionInfo regionInfo) |
@@ -201,8 +200,9 @@ namespace OpenSim.Region.Communications.Local | |||
201 | /// <param name="agentData"></param> | 200 | /// <param name="agentData"></param> |
202 | /// <returns></returns> | 201 | /// <returns></returns> |
203 | /// | 202 | /// |
204 | public bool RegionUp(RegionInfo region) | 203 | public bool RegionUp(SearializableRegionInfo sregion) |
205 | { | 204 | { |
205 | RegionInfo region = new RegionInfo(sregion); | ||
206 | foreach (RegionCommsListener listener in m_regionListeners.Values) | 206 | foreach (RegionCommsListener listener in m_regionListeners.Values) |
207 | { | 207 | { |
208 | listener.TriggerRegionUp(region); | 208 | listener.TriggerRegionUp(region); |
@@ -213,8 +213,13 @@ namespace OpenSim.Region.Communications.Local | |||
213 | 213 | ||
214 | public bool TriggerRegionUp(RegionInfo region) | 214 | public bool TriggerRegionUp(RegionInfo region) |
215 | { | 215 | { |
216 | |||
217 | foreach (RegionCommsListener listener in m_regionListeners.Values) | ||
218 | { | ||
219 | listener.TriggerRegionUp(region); | ||
220 | } | ||
216 | 221 | ||
217 | return false; | 222 | return true; |
218 | } | 223 | } |
219 | 224 | ||
220 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | 225 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 282b720..b0442d2 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -133,14 +133,10 @@ namespace OpenSim.Region.Communications.OGS1 | |||
133 | } | 133 | } |
134 | else | 134 | else |
135 | { | 135 | { |
136 | //m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); | 136 | m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); |
137 | 137 | ||
138 | 138 | ||
139 | } | 139 | } |
140 | //SimpleRegionInfo regiondata = new SimpleRegionInfo(); | ||
141 | //regiondata.RegionID = griddatahash["UUID"]; | ||
142 | //regiondata.RemotingAddress = | ||
143 | |||
144 | return m_localBackend.RegisterRegion(regionInfo); | 140 | return m_localBackend.RegisterRegion(regionInfo); |
145 | } | 141 | } |
146 | 142 | ||
@@ -458,7 +454,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
458 | InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; | 454 | InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; |
459 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; | 455 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; |
460 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; | 456 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; |
461 | InterRegionSingleton.Instance.OnRegionUp += RegionUp; | 457 | //InterRegionSingleton.Instance.OnRegionUp += RegionUp; |
462 | } | 458 | } |
463 | 459 | ||
464 | #region Methods called by regions in this instance | 460 | #region Methods called by regions in this instance |
@@ -541,11 +537,10 @@ namespace OpenSim.Region.Communications.OGS1 | |||
541 | MainLog.Instance.Debug(e.ToString()); | 537 | MainLog.Instance.Debug(e.ToString()); |
542 | return false; | 538 | return false; |
543 | } | 539 | } |
544 | return true; | ||
545 | } | 540 | } |
546 | 541 | ||
547 | // UGLY! | 542 | // UGLY! |
548 | public bool RegionUp(RegionInfo region) | 543 | public bool RegionUp(SearializableRegionInfo region) |
549 | { | 544 | { |
550 | 545 | ||
551 | // This is stupid. For this to work, when the region registers it must request nearby map blocks. | 546 | // This is stupid. For this to work, when the region registers it must request nearby map blocks. |
@@ -558,11 +553,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
558 | { | 553 | { |
559 | return true; | 554 | return true; |
560 | } | 555 | } |
561 | return true; | 556 | |
562 | foreach (SimpleRegionInfo knownregion in m_knownRegions) | 557 | foreach (SimpleRegionInfo knownregion in m_knownRegions) |
563 | { | 558 | { |
564 | // Wha? | 559 | |
565 | RegionInfo regInfo = RequestNeighbourInfo(knownregion.RegionID); | 560 | SearializableRegionInfo regInfo = new SearializableRegionInfo(RequestNeighbourInfo(knownregion.RegionID)); |
566 | 561 | ||
567 | try | 562 | try |
568 | { | 563 | { |
@@ -572,7 +567,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
572 | //don't want to be creating a new link to the remote instance every time like we are here | 567 | //don't want to be creating a new link to the remote instance every time like we are here |
573 | bool retValue = false; | 568 | bool retValue = false; |
574 | 569 | ||
575 | 570 | ||
576 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 571 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
577 | typeof(OGS1InterRegionRemoting), | 572 | typeof(OGS1InterRegionRemoting), |
578 | "tcp://" + regInfo.RemotingAddress + | 573 | "tcp://" + regInfo.RemotingAddress + |
@@ -588,38 +583,38 @@ namespace OpenSim.Region.Communications.OGS1 | |||
588 | Console.WriteLine("remoting object not found"); | 583 | Console.WriteLine("remoting object not found"); |
589 | } | 584 | } |
590 | remObject = null; | 585 | remObject = null; |
591 | //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + region.RegionName + " and got " + retValue.ToString()); | 586 | MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
592 | 587 | ||
593 | } | 588 | } |
594 | 589 | ||
595 | } | 590 | } |
596 | catch (RemotingException e) | 591 | catch (RemotingException e) |
597 | { | 592 | { |
598 | MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 593 | MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
599 | MainLog.Instance.Debug(e.ToString()); | 594 | MainLog.Instance.Debug(e.ToString()); |
600 | //return false; | 595 | //return false; |
601 | } | 596 | } |
602 | catch (SocketException e) | 597 | catch (SocketException e) |
603 | { | 598 | { |
604 | MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 599 | MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
605 | MainLog.Instance.Debug(e.ToString()); | 600 | MainLog.Instance.Debug(e.ToString()); |
606 | //return false; | 601 | //return false; |
607 | } | 602 | } |
608 | catch (InvalidCredentialException e) | 603 | catch (InvalidCredentialException e) |
609 | { | 604 | { |
610 | MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 605 | MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
611 | MainLog.Instance.Debug(e.ToString()); | 606 | MainLog.Instance.Debug(e.ToString()); |
612 | //return false; | 607 | //return false; |
613 | } | 608 | } |
614 | catch (AuthenticationException e) | 609 | catch (AuthenticationException e) |
615 | { | 610 | { |
616 | MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 611 | MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
617 | MainLog.Instance.Debug(e.ToString()); | 612 | MainLog.Instance.Debug(e.ToString()); |
618 | //return false; | 613 | //return false; |
619 | } | 614 | } |
620 | catch (Exception e) | 615 | catch (Exception e) |
621 | { | 616 | { |
622 | MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 617 | MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
623 | MainLog.Instance.Debug(e.ToString()); | 618 | MainLog.Instance.Debug(e.ToString()); |
624 | //return false; | 619 | //return false; |
625 | } | 620 | } |
@@ -702,7 +697,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
702 | MainLog.Instance.Debug(e.ToString()); | 697 | MainLog.Instance.Debug(e.ToString()); |
703 | return false; | 698 | return false; |
704 | } | 699 | } |
705 | return true; | ||
706 | } | 700 | } |
707 | /// <summary> | 701 | /// <summary> |
708 | /// | 702 | /// |
@@ -843,13 +837,13 @@ namespace OpenSim.Region.Communications.OGS1 | |||
843 | } | 837 | } |
844 | } | 838 | } |
845 | 839 | ||
846 | public bool TriggerRegionUp(RegionInfo regionData) | 840 | public bool TriggerRegionUp(SearializableRegionInfo regionData) |
847 | { | 841 | { |
848 | //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport " + regionData.RegionName); | 842 | MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport: " + regionData.RegionLocX + "," + regionData.RegionLocY); |
849 | 843 | ||
850 | try | 844 | try |
851 | { | 845 | { |
852 | return m_localBackend.TriggerRegionUp(regionData); | 846 | return m_localBackend.TriggerRegionUp(new RegionInfo(regionData)); |
853 | } | 847 | } |
854 | 848 | ||
855 | catch (RemotingException e) | 849 | catch (RemotingException e) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index aa6f59a..2f7e591 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
41 | 41 | ||
42 | public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); | 42 | public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); |
43 | 43 | ||
44 | public delegate bool RegionUP (RegionInfo region); | 44 | public delegate bool RegionUp (SearializableRegionInfo region); |
45 | 45 | ||
46 | public sealed class InterRegionSingleton | 46 | public sealed class InterRegionSingleton |
47 | { | 47 | { |
@@ -76,11 +76,12 @@ namespace OpenSim.Region.Communications.OGS1 | |||
76 | return false; | 76 | return false; |
77 | } | 77 | } |
78 | 78 | ||
79 | public bool RegionUp(RegionInfo region) | 79 | public bool RegionUp(SearializableRegionInfo sregion) |
80 | { | 80 | { |
81 | |||
81 | if (OnRegionUp != null) | 82 | if (OnRegionUp != null) |
82 | { | 83 | { |
83 | return OnRegionUp(region); | 84 | return OnRegionUp(sregion); |
84 | } | 85 | } |
85 | return false; | 86 | return false; |
86 | } | 87 | } |
@@ -129,7 +130,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
129 | return false; | 130 | return false; |
130 | } | 131 | } |
131 | } | 132 | } |
132 | public bool RegionUp(RegionInfo region) | 133 | public bool RegionUp(SearializableRegionInfo region) |
133 | { | 134 | { |
134 | try | 135 | try |
135 | { | 136 | { |
@@ -141,6 +142,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
141 | return false; | 142 | return false; |
142 | } | 143 | } |
143 | } | 144 | } |
145 | |||
144 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 146 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
145 | { | 147 | { |
146 | try | 148 | try |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 8f7cbee..c1acde4 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -11,8 +11,14 @@ using OpenSim.Region.Physics.Manager; | |||
11 | 11 | ||
12 | namespace OpenSim.Region.Environment.Scenes | 12 | namespace OpenSim.Region.Environment.Scenes |
13 | { | 13 | { |
14 | public delegate void PhysicsCrash(); | ||
15 | |||
14 | public class InnerScene | 16 | public class InnerScene |
15 | { | 17 | { |
18 | #region Events | ||
19 | public event PhysicsCrash UnRecoverableError; | ||
20 | #endregion | ||
21 | |||
16 | #region Fields | 22 | #region Fields |
17 | public Dictionary<LLUUID, ScenePresence> ScenePresences; | 23 | public Dictionary<LLUUID, ScenePresence> ScenePresences; |
18 | public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; | 24 | public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; |
@@ -26,17 +32,47 @@ namespace OpenSim.Region.Environment.Scenes | |||
26 | 32 | ||
27 | internal object m_syncRoot = new object(); | 33 | internal object m_syncRoot = new object(); |
28 | 34 | ||
29 | public PhysicsScene PhyScene; | 35 | public PhysicsScene _PhyScene; |
30 | #endregion | 36 | #endregion |
31 | 37 | ||
32 | public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) | 38 | public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) |
33 | { | 39 | { |
40 | |||
34 | m_parentScene = parent; | 41 | m_parentScene = parent; |
35 | m_regInfo = regInfo; | 42 | m_regInfo = regInfo; |
36 | PermissionsMngr = permissionsMngr; | 43 | PermissionsMngr = permissionsMngr; |
37 | QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); | 44 | QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); |
38 | QuadTree.Subdivide(); | 45 | QuadTree.Subdivide(); |
39 | QuadTree.Subdivide(); | 46 | QuadTree.Subdivide(); |
47 | |||
48 | |||
49 | } | ||
50 | public PhysicsScene PhyScene | ||
51 | { | ||
52 | get | ||
53 | { return _PhyScene; } | ||
54 | set | ||
55 | { | ||
56 | // If we're not doing the initial set | ||
57 | // Then we've got to remove the previous | ||
58 | // event handler | ||
59 | try | ||
60 | { | ||
61 | _PhyScene.OnPhysicsCrash -= physicsBasedCrash; | ||
62 | } | ||
63 | catch (System.NullReferenceException) | ||
64 | { | ||
65 | // This occurs when storing to _PhyScene the first time. | ||
66 | // Is there a better way to check the event handler before | ||
67 | // getting here | ||
68 | // This can be safely ignored. We're setting the first inital | ||
69 | // there are no event handler's registered. | ||
70 | } | ||
71 | |||
72 | _PhyScene = value; | ||
73 | |||
74 | _PhyScene.OnPhysicsCrash += physicsBasedCrash; | ||
75 | } | ||
40 | } | 76 | } |
41 | 77 | ||
42 | public void Close() | 78 | public void Close() |
@@ -55,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
55 | 91 | ||
56 | // PhysX does this (runs in the background). | 92 | // PhysX does this (runs in the background). |
57 | 93 | ||
58 | if (PhyScene.IsThreaded) | 94 | if (_PhyScene.IsThreaded) |
59 | { | 95 | { |
60 | PhyScene.GetResults(); | 96 | _PhyScene.GetResults(); |
61 | } | 97 | } |
62 | } | 98 | } |
63 | 99 | ||
@@ -75,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
75 | { | 111 | { |
76 | lock (m_syncRoot) | 112 | lock (m_syncRoot) |
77 | { | 113 | { |
78 | PhyScene.Simulate((float)elapsed); | 114 | _PhyScene.Simulate((float)elapsed); |
79 | } | 115 | } |
80 | } | 116 | } |
81 | 117 | ||
@@ -338,6 +374,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
338 | 374 | ||
339 | #region Other Methods | 375 | #region Other Methods |
340 | 376 | ||
377 | |||
378 | public void physicsBasedCrash() | ||
379 | { | ||
380 | if (UnRecoverableError != null) | ||
381 | { | ||
382 | UnRecoverableError(); | ||
383 | } | ||
384 | } | ||
385 | |||
341 | public LLUUID ConvertLocalIDToFullID(uint localID) | 386 | public LLUUID ConvertLocalIDToFullID(uint localID) |
342 | { | 387 | { |
343 | SceneObjectGroup group = GetGroupByPrim(localID); | 388 | SceneObjectGroup group = GetGroupByPrim(localID); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index bdafce8..1359bd2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -232,6 +232,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
232 | m_permissionManager.Initialise(this); | 232 | m_permissionManager.Initialise(this); |
233 | 233 | ||
234 | m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); | 234 | m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); |
235 | |||
236 | // If the Inner scene has an Unrecoverable error, restart this sim. | ||
237 | // Currently the only thing that causes it to happen is two kinds of specific | ||
238 | // Physics based crashes. | ||
239 | // | ||
240 | // Out of memory | ||
241 | // Operating system has killed the plugin | ||
242 | m_innerScene.UnRecoverableError += restartNOW; | ||
243 | |||
235 | m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); | 244 | m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); |
236 | 245 | ||
237 | RegisterDefaultSceneEvents(); | 246 | RegisterDefaultSceneEvents(); |
@@ -315,13 +324,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
315 | { | 324 | { |
316 | t_restartTimer.Stop(); | 325 | t_restartTimer.Stop(); |
317 | t_restartTimer.AutoReset = false; | 326 | t_restartTimer.AutoReset = false; |
318 | MainLog.Instance.Error("REGION", "Closing"); | 327 | restartNOW(); |
319 | Close(); | ||
320 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); | ||
321 | base.Restart(0); | ||
322 | } | 328 | } |
323 | 329 | ||
324 | } | 330 | } |
331 | public void restartNOW() | ||
332 | { | ||
333 | MainLog.Instance.Error("REGION", "Closing"); | ||
334 | Close(); | ||
335 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); | ||
336 | base.Restart(0); | ||
337 | } | ||
325 | public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) | 338 | public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) |
326 | { | 339 | { |
327 | m_restartWaitTimer.Stop(); | 340 | m_restartWaitTimer.Stop(); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 9a83710..892bf81 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -171,6 +171,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | public void RequestNeighbors(RegionInfo region) | ||
175 | { | ||
176 | List<SimpleRegionInfo> neighbours = | ||
177 | m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | ||
178 | //IPEndPoint blah = new IPEndPoint(); | ||
179 | |||
180 | //blah.Address = region.RemotingAddress; | ||
181 | //blah.Port = region.RemotingPort; | ||
182 | |||
183 | |||
184 | } | ||
185 | |||
174 | /// <summary> | 186 | /// <summary> |
175 | /// | 187 | /// |
176 | /// </summary> | 188 | /// </summary> |
@@ -311,7 +323,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
311 | public void InformNeighborsThatRegionisUp(RegionInfo region) | 323 | public void InformNeighborsThatRegionisUp(RegionInfo region) |
312 | { | 324 | { |
313 | //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); | 325 | //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); |
314 | bool val = m_commsProvider.InterRegion.RegionUp(region); | 326 | bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); |
315 | } | 327 | } |
316 | 328 | ||
317 | public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical) | 329 | public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index eba45fc..ed33bf7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | 216 | ||
217 | public void RestartCurrentScene() | 217 | public void RestartCurrentScene() |
218 | { | 218 | { |
219 | ForEachCurrentScene(delegate(Scene scene) { scene.Restart(15); }); | 219 | ForEachCurrentScene(delegate(Scene scene) { scene.restartNOW(); }); |
220 | 220 | ||
221 | } | 221 | } |
222 | 222 | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 651992c..635b208 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -32,12 +32,29 @@ using OpenSim.Region.Physics.Manager; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.Physics.Manager | 33 | namespace OpenSim.Region.Physics.Manager |
34 | { | 34 | { |
35 | public delegate void physicsCrash(); | ||
36 | |||
35 | public abstract class PhysicsScene | 37 | public abstract class PhysicsScene |
36 | { | 38 | { |
39 | // The only thing that should register for this event is the InnerScene | ||
40 | // Anything else could cause problems. | ||
41 | |||
42 | public event physicsCrash OnPhysicsCrash; | ||
43 | |||
37 | public static PhysicsScene Null | 44 | public static PhysicsScene Null |
38 | { | 45 | { |
39 | get { return new NullPhysicsScene(); } | 46 | get { return new NullPhysicsScene(); } |
40 | } | 47 | } |
48 | public virtual void TriggerPhysicsBasedRestart() | ||
49 | { | ||
50 | physicsCrash handler = OnPhysicsCrash; | ||
51 | if (handler != null) | ||
52 | { | ||
53 | OnPhysicsCrash(); | ||
54 | } | ||
55 | |||
56 | } | ||
57 | |||
41 | 58 | ||
42 | public abstract void Initialise(IMesher meshmerizer); | 59 | public abstract void Initialise(IMesher meshmerizer); |
43 | 60 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index ec7d04d..7193886 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -32,6 +32,7 @@ using Axiom.Math; | |||
32 | using Ode.NET; | 32 | using Ode.NET; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.Physics.Manager; |
35 | |||
35 | //using OpenSim.Region.Physics.OdePlugin.Meshing; | 36 | //using OpenSim.Region.Physics.OdePlugin.Meshing; |
36 | 37 | ||
37 | namespace OpenSim.Region.Physics.OdePlugin | 38 | namespace OpenSim.Region.Physics.OdePlugin |
@@ -234,9 +235,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
234 | //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); | 235 | //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); |
235 | } | 236 | } |
236 | 237 | ||
237 | int count; | 238 | int count = 0; |
238 | 239 | try | |
240 | { | ||
239 | count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); | 241 | count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); |
242 | } | ||
243 | catch (System.Runtime.InteropServices.SEHException) | ||
244 | { | ||
245 | OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); | ||
246 | base.TriggerPhysicsBasedRestart(); | ||
247 | } | ||
240 | 248 | ||
241 | for (int i = 0; i < count; i++) | 249 | for (int i = 0; i < count; i++) |
242 | { | 250 | { |
@@ -805,8 +813,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
805 | { | 813 | { |
806 | // Process 10 frames if the sim is running normal.. | 814 | // Process 10 frames if the sim is running normal.. |
807 | // process 5 frames if the sim is running slow | 815 | // process 5 frames if the sim is running slow |
808 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | 816 | try{ |
809 | 817 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | |
818 | } | ||
819 | catch (System.StackOverflowException) | ||
820 | { | ||
821 | OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); | ||
822 | base.TriggerPhysicsBasedRestart(); | ||
823 | } | ||
810 | 824 | ||
811 | int i = 0; | 825 | int i = 0; |
812 | while (step_time > 0.0f) | 826 | while (step_time > 0.0f) |