aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/IRegionData.cs20
-rw-r--r--OpenSim/Framework/WebUtil.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs51
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs25
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs14
-rw-r--r--OpenSim/Server/Handlers/Map/MapGetServerConnector.cs6
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs7
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs4
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs2
-rw-r--r--OpenSim/Services/GridService/GridService.cs10
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs21
-rw-r--r--OpenSim/Services/MapImageService/MapImageService.cs4
18 files changed, 152 insertions, 74 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs
index 46dc4fb..546b5e8 100644
--- a/OpenSim/Data/IRegionData.cs
+++ b/OpenSim/Data/IRegionData.cs
@@ -37,10 +37,30 @@ namespace OpenSim.Data
37 public UUID RegionID; 37 public UUID RegionID;
38 public UUID ScopeID; 38 public UUID ScopeID;
39 public string RegionName; 39 public string RegionName;
40
41 /// <summary>
42 /// The position in meters of this region.
43 /// </summary>
40 public int posX; 44 public int posX;
45
46 /// <summary>
47 /// The position in meters of this region.
48 /// </summary>
41 public int posY; 49 public int posY;
50
42 public int sizeX; 51 public int sizeX;
43 public int sizeY; 52 public int sizeY;
53
54 /// <summary>
55 /// Return the x-coordinate of this region.
56 /// </summary>
57 public int coordX { get { return posX / (int)Constants.RegionSize; } }
58
59 /// <summary>
60 /// Return the y-coordinate of this region.
61 /// </summary>
62 public int coordY { get { return posY / (int)Constants.RegionSize; } }
63
44 public Dictionary<string, object> Data; 64 public Dictionary<string, object> Data;
45 } 65 }
46 66
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 60c1e15..6ce122b 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -298,7 +298,7 @@ namespace OpenSim.Framework
298 catch (Exception e) 298 catch (Exception e)
299 { 299 {
300 // don't need to treat this as an error... we're just guessing anyway 300 // don't need to treat this as an error... we're just guessing anyway
301 m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message); 301// m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message);
302 } 302 }
303 303
304 return result; 304 return result;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
index f71bf46..40cc536 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
@@ -25,11 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net;
29using Nini.Config;
30using System; 28using System;
31using System.Collections.Generic; 29using System.Collections.Generic;
32using System.Reflection; 30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Server.Base; 35using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
@@ -119,10 +120,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
119 120
120 #region INeighbourService 121 #region INeighbourService
121 122
122 public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 123 public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
123 { 124 {
124 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}.", 125 uint x, y;
125 thisRegion.RegionName, regionHandle); 126 Utils.LongToUInts(regionHandle, out x, out y);
127
128 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from region {0} to region at {1}-{2}",
129 thisRegion.RegionName, x / Constants.RegionSize, y / Constants.RegionSize);
130
126 foreach (Scene s in m_Scenes) 131 foreach (Scene s in m_Scenes)
127 { 132 {
128 if (s.RegionInfo.RegionHandle == regionHandle) 133 if (s.RegionInfo.RegionHandle == regionHandle)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 9714c36..faa1def 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -196,7 +196,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
196 } 196 }
197 } 197 }
198 198
199 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCreateChildAgent", destination.RegionName);
200 reason = "Did not find region " + destination.RegionName; 199 reason = "Did not find region " + destination.RegionName;
201 return false; 200 return false;
202 } 201 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index a93ffaa..4805ccb 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -86,6 +86,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
86 private volatile bool m_tainted; 86 private volatile bool m_tainted;
87 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); 87 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
88 88
89 /// <summary>
90 /// Human readable list of terrain file extensions that are supported.
91 /// </summary>
92 private string m_supportedFileExtensions = "";
93
89 #region ICommandableModule Members 94 #region ICommandableModule Members
90 95
91 public ICommander CommandInterface 96 public ICommander CommandInterface
@@ -135,6 +140,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
135 140
136 InstallDefaultEffects(); 141 InstallDefaultEffects();
137 LoadPlugins(); 142 LoadPlugins();
143
144 // Generate user-readable extensions list
145 string supportedFilesSeparator = "";
146
147 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
148 {
149 m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
150 supportedFilesSeparator = ", ";
151 }
138 } 152 }
139 153
140 public void RegionLoaded(Scene scene) 154 public void RegionLoaded(Scene scene)
@@ -251,20 +265,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
251 if (filename.EndsWith(loader.Key)) 265 if (filename.EndsWith(loader.Key))
252 { 266 {
253 loader.Value.SaveFile(filename, m_channel); 267 loader.Value.SaveFile(filename, m_channel);
268 m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename);
254 return; 269 return;
255 } 270 }
256 } 271 }
257 } 272 }
258 catch (NotImplementedException)
259 {
260 m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented.");
261 throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented"));
262 }
263 catch (IOException ioe) 273 catch (IOException ioe)
264 { 274 {
265 m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); 275 m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message));
266 throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message));
267 } 276 }
277
278 m_log.ErrorFormat(
279 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
280 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
268 } 281 }
269 282
270 /// <summary> 283 /// <summary>
@@ -345,6 +358,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
345 float duration = 0.25f; 358 float duration = 0.25f;
346 if (action == 0) 359 if (action == 0)
347 duration = 4.0f; 360 duration = 4.0f;
361
348 client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); 362 client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
349 } 363 }
350 364
@@ -534,6 +548,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
534 m_channel = channel; 548 m_channel = channel;
535 UpdateRevertMap(); 549 UpdateRevertMap();
536 } 550 }
551
537 return; 552 return;
538 } 553 }
539 } 554 }
@@ -566,10 +581,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
566 fileWidth, fileHeight, 581 fileWidth, fileHeight,
567 (int)Constants.RegionSize, 582 (int)Constants.RegionSize,
568 (int)Constants.RegionSize); 583 (int)Constants.RegionSize);
584
585 m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename);
569 } 586 }
587
570 return; 588 return;
571 } 589 }
572 } 590 }
591
592 m_log.ErrorFormat(
593 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
594 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
573 } 595 }
574 } 596 }
575 597
@@ -1126,32 +1148,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1126 1148
1127 private void InstallInterfaces() 1149 private void InstallInterfaces()
1128 { 1150 {
1129 // Load / Save
1130 string supportedFileExtensions = "";
1131 string supportedFilesSeparator = "";
1132 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
1133 {
1134 supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
1135 supportedFilesSeparator = ", ";
1136 }
1137
1138 Command loadFromFileCommand = 1151 Command loadFromFileCommand =
1139 new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file."); 1152 new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file.");
1140 loadFromFileCommand.AddArgument("filename", 1153 loadFromFileCommand.AddArgument("filename",
1141 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + 1154 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " +
1142 supportedFileExtensions, "String"); 1155 m_supportedFileExtensions, "String");
1143 1156
1144 Command saveToFileCommand = 1157 Command saveToFileCommand =
1145 new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file."); 1158 new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file.");
1146 saveToFileCommand.AddArgument("filename", 1159 saveToFileCommand.AddArgument("filename",
1147 "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " + 1160 "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " +
1148 supportedFileExtensions, "String"); 1161 m_supportedFileExtensions, "String");
1149 1162
1150 Command loadFromTileCommand = 1163 Command loadFromTileCommand =
1151 new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file."); 1164 new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file.");
1152 loadFromTileCommand.AddArgument("filename", 1165 loadFromTileCommand.AddArgument("filename",
1153 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + 1166 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " +
1154 supportedFileExtensions, "String"); 1167 m_supportedFileExtensions, "String");
1155 loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); 1168 loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
1156 loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); 1169 loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
1157 loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", 1170 loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
@@ -1163,7 +1176,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1163 new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); 1176 new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
1164 saveToTileCommand.AddArgument("filename", 1177 saveToTileCommand.AddArgument("filename",
1165 "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + 1178 "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
1166 supportedFileExtensions, "String"); 1179 m_supportedFileExtensions, "String");
1167 saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); 1180 saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
1168 saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); 1181 saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
1169 saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", 1182 saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 0049384..547e693 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -102,9 +102,10 @@ namespace OpenSim.Region.Framework.Scenes
102 102
103 public event OnPluginConsoleDelegate OnPluginConsole; 103 public event OnPluginConsoleDelegate OnPluginConsole;
104 104
105 public delegate void OnShutdownDelegate(); 105 /// <summary>
106 106 /// Triggered when the entire simulator is shutdown.
107 public event OnShutdownDelegate OnShutdown; 107 /// </summary>
108 public event Action OnShutdown;
108 109
109 public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); 110 public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
110 public delegate void ScriptResetDelegate(uint localID, UUID itemID); 111 public delegate void ScriptResetDelegate(uint localID, UUID itemID);
@@ -117,9 +118,14 @@ namespace OpenSim.Region.Framework.Scenes
117 118
118 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 119 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
119 120
120 public delegate void SceneShuttingDownDelegate(Scene scene); 121 /// <summary>
121 122 /// Triggered when an individual scene is shutdown.
122 public event SceneShuttingDownDelegate OnSceneShuttingDown; 123 /// </summary>
124 /// <remarks>
125 /// This does not automatically mean that the entire simulator is shutting down. Listen to OnShutdown for that
126 /// notification.
127 /// </remarks>
128 public event Action<Scene> OnSceneShuttingDown;
123 129
124 /// <summary> 130 /// <summary>
125 /// Fired when an object is touched/grabbed. 131 /// Fired when an object is touched/grabbed.
@@ -893,10 +899,10 @@ namespace OpenSim.Region.Framework.Scenes
893 899
894 public void TriggerShutdown() 900 public void TriggerShutdown()
895 { 901 {
896 OnShutdownDelegate handlerShutdown = OnShutdown; 902 Action handlerShutdown = OnShutdown;
897 if (handlerShutdown != null) 903 if (handlerShutdown != null)
898 { 904 {
899 foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList()) 905 foreach (Action d in handlerShutdown.GetInvocationList())
900 { 906 {
901 try 907 try
902 { 908 {
@@ -2236,10 +2242,10 @@ namespace OpenSim.Region.Framework.Scenes
2236 2242
2237 public void TriggerSceneShuttingDown(Scene s) 2243 public void TriggerSceneShuttingDown(Scene s)
2238 { 2244 {
2239 SceneShuttingDownDelegate handler = OnSceneShuttingDown; 2245 Action<Scene> handler = OnSceneShuttingDown;
2240 if (handler != null) 2246 if (handler != null)
2241 { 2247 {
2242 foreach (SceneShuttingDownDelegate d in handler.GetInvocationList()) 2248 foreach (Action<Scene> d in handler.GetInvocationList())
2243 { 2249 {
2244 try 2250 try
2245 { 2251 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0eeb22a..c581b5f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5218,18 +5218,16 @@ namespace OpenSim.Region.Framework.Scenes
5218 return offsets.ToArray(); 5218 return offsets.ToArray();
5219 } 5219 }
5220 5220
5221 /// <summary>
5222 /// Regenerate the maptile for this scene.
5223 /// </summary>
5224 /// <param name="sender"></param>
5225 /// <param name="e"></param>
5221 public void RegenerateMaptile(object sender, ElapsedEventArgs e) 5226 public void RegenerateMaptile(object sender, ElapsedEventArgs e)
5222 { 5227 {
5223 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); 5228 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
5224 if (mapModule != null) 5229 if (mapModule != null)
5225 {
5226 mapModule.GenerateMaptile(); 5230 mapModule.GenerateMaptile();
5227
5228 string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
5229
5230 if (error != String.Empty)
5231 throw new Exception(error);
5232 }
5233 } 5231 }
5234 5232
5235// public void CleanDroppedAttachments() 5233// public void CleanDroppedAttachments()
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 12058c8..27833e8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -174,7 +174,6 @@ namespace OpenSim.Region.Framework.Scenes
174 { 174 {
175 // We're ignoring a collection was modified error because this data gets old and outdated fast. 175 // We're ignoring a collection was modified error because this data gets old and outdated fast.
176 } 176 }
177
178 } 177 }
179 178
180 public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle); 179 public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
@@ -185,13 +184,12 @@ namespace OpenSim.Region.Framework.Scenes
185 /// </summary> 184 /// </summary>
186 protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle) 185 protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle)
187 { 186 {
188
189 //m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle);
190 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 187 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
191 188
192 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); 189 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
193 uint x = 0, y = 0; 190 uint x = 0, y = 0;
194 Utils.LongToUInts(regionHandle, out x, out y); 191 Utils.LongToUInts(regionHandle, out x, out y);
192
195 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); 193 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
196 m_scene.SimulationService.CloseChildAgent(destination, agentID); 194 m_scene.SimulationService.CloseChildAgent(destination, agentID);
197 } 195 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 402377d..65c7416 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -91,6 +91,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
91 private bool m_KillTimedOutScripts; 91 private bool m_KillTimedOutScripts;
92 private string m_ScriptEnginesPath = null; 92 private string m_ScriptEnginesPath = null;
93 93
94 /// <summary>
95 /// Is the entire simulator in the process of shutting down?
96 /// </summary>
97 private bool m_SimulatorShuttingDown;
98
94 private static List<XEngine> m_ScriptEngines = 99 private static List<XEngine> m_ScriptEngines =
95 new List<XEngine>(); 100 new List<XEngine>();
96 101
@@ -537,12 +542,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
537 // Must be done explicitly because they have infinite 542 // Must be done explicitly because they have infinite
538 // lifetime 543 // lifetime
539 // 544 //
540 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); 545 if (!m_SimulatorShuttingDown)
541 if (m_DomainScripts[instance.AppDomain].Count == 0)
542 { 546 {
543 m_DomainScripts.Remove(instance.AppDomain); 547 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
544 UnloadAppDomain(instance.AppDomain); 548 if (m_DomainScripts[instance.AppDomain].Count == 0)
549 {
550 m_DomainScripts.Remove(instance.AppDomain);
551 UnloadAppDomain(instance.AppDomain);
552 }
545 } 553 }
554
555 m_Scripts.Clear();
556 m_PrimObjects.Clear();
557 m_Assemblies.Clear();
558 m_DomainScripts.Clear();
546 } 559 }
547 lockScriptsForRead(false); 560 lockScriptsForRead(false);
548 lockScriptsForWrite(true); 561 lockScriptsForWrite(true);
@@ -1512,6 +1525,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1512 1525
1513 public void OnShutdown() 1526 public void OnShutdown()
1514 { 1527 {
1528 m_SimulatorShuttingDown = true;
1529
1515 List<IScriptInstance> instances = new List<IScriptInstance>(); 1530 List<IScriptInstance> instances = new List<IScriptInstance>();
1516 1531
1517 lockScriptsForRead(true); 1532 lockScriptsForRead(true);
@@ -1907,4 +1922,4 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1907 return true; 1922 return true;
1908 } 1923 }
1909 } 1924 }
1910} \ No newline at end of file 1925}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 5c89d0f..56f130e 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -99,7 +99,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
99 } 99 }
100 100
101 return FailureResult(); 101 return FailureResult();
102
103 } 102 }
104 103
105 #region Method-specific handlers 104 #region Method-specific handlers
@@ -127,7 +126,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
127 return FailureResult(); 126 return FailureResult();
128 } 127 }
129 128
130 string perms = "0";
131 FriendInfo[] friendsInfo = m_FriendsService.GetFriends(principalID); 129 FriendInfo[] friendsInfo = m_FriendsService.GetFriends(principalID);
132 foreach (FriendInfo finfo in friendsInfo) 130 foreach (FriendInfo finfo in friendsInfo)
133 { 131 {
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 99f98b6..8291107 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Server.Handlers.MapImage
79 79
80 public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 80 public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
81 { 81 {
82 m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); 82// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
83 StreamReader sr = new StreamReader(requestData); 83 StreamReader sr = new StreamReader(requestData);
84 string body = sr.ReadToEnd(); 84 string body = sr.ReadToEnd();
85 sr.Close(); 85 sr.Close();
@@ -97,9 +97,14 @@ namespace OpenSim.Server.Handlers.MapImage
97 int x = 0, y = 0; 97 int x = 0, y = 0;
98 Int32.TryParse(request["X"].ToString(), out x); 98 Int32.TryParse(request["X"].ToString(), out x);
99 Int32.TryParse(request["Y"].ToString(), out y); 99 Int32.TryParse(request["Y"].ToString(), out y);
100 string type = "image/jpeg"; 100
101 if (request.ContainsKey("TYPE")) 101 m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y);
102 type = request["TYPE"].ToString(); 102
103// string type = "image/jpeg";
104//
105// if (request.ContainsKey("TYPE"))
106// type = request["TYPE"].ToString();
107
103 byte[] data = Convert.FromBase64String(request["DATA"].ToString()); 108 byte[] data = Convert.FromBase64String(request["DATA"].ToString());
104 109
105 string reason = string.Empty; 110 string reason = string.Empty;
@@ -117,7 +122,6 @@ namespace OpenSim.Server.Handlers.MapImage
117 } 122 }
118 123
119 return FailureResult("Unexpected server error"); 124 return FailureResult("Unexpected server error");
120
121 } 125 }
122 126
123 private byte[] SuccessResult() 127 private byte[] SuccessResult()
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index e8a424f..501074d 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -42,7 +42,8 @@ namespace OpenSim.Server.Handlers.MapImage
42{ 42{
43 public class MapGetServiceConnector : ServiceConnector 43 public class MapGetServiceConnector : ServiceConnector
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
46 private IMapImageService m_MapService; 47 private IMapImageService m_MapService;
47 48
48 private string m_ConfigName = "MapImageService"; 49 private string m_ConfigName = "MapImageService";
@@ -69,7 +70,8 @@ namespace OpenSim.Server.Handlers.MapImage
69 70
70 class MapServerGetHandler : BaseStreamHandler 71 class MapServerGetHandler : BaseStreamHandler
71 { 72 {
72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 73// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74
73 private IMapImageService m_MapService; 75 private IMapImageService m_MapService;
74 76
75 public MapServerGetHandler(IMapImageService service) : 77 public MapServerGetHandler(IMapImageService service) :
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 9935e3c..78b09cd 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -243,14 +243,13 @@ namespace OpenSim.Server.Handlers.Simulation
243 responsedata["int_response_code"] = HttpStatusCode.OK; 243 responsedata["int_response_code"] = HttpStatusCode.OK;
244 responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); 244 responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
245 245
246 m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); 246 m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID);
247 } 247 }
248 248
249 protected virtual void ReleaseAgent(UUID regionID, UUID id) 249 protected virtual void ReleaseAgent(UUID regionID, UUID id)
250 { 250 {
251 m_SimulationService.ReleaseAgent(regionID, id, ""); 251 m_SimulationService.ReleaseAgent(regionID, id, "");
252 } 252 }
253
254 } 253 }
255 254
256 public class AgentPostHandler : BaseStreamHandler 255 public class AgentPostHandler : BaseStreamHandler
@@ -275,7 +274,7 @@ namespace OpenSim.Server.Handlers.Simulation
275 public override byte[] Handle(string path, Stream request, 274 public override byte[] Handle(string path, Stream request,
276 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 275 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
277 { 276 {
278 m_log.DebugFormat("[SIMULATION]: Stream handler called"); 277// m_log.DebugFormat("[SIMULATION]: Stream handler called");
279 278
280 Hashtable keysvals = new Hashtable(); 279 Hashtable keysvals = new Hashtable();
281 Hashtable headervals = new Hashtable(); 280 Hashtable headervals = new Hashtable();
@@ -462,7 +461,7 @@ namespace OpenSim.Server.Handlers.Simulation
462 public override byte[] Handle(string path, Stream request, 461 public override byte[] Handle(string path, Stream request,
463 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 462 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
464 { 463 {
465 m_log.DebugFormat("[SIMULATION]: Stream handler called"); 464// m_log.DebugFormat("[SIMULATION]: Stream handler called");
466 465
467 Hashtable keysvals = new Hashtable(); 466 Hashtable keysvals = new Hashtable();
468 Hashtable headervals = new Hashtable(); 467 Hashtable headervals = new Hashtable();
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs
index 69e2d17..e46714e 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs
@@ -129,7 +129,9 @@ namespace OpenSim.Services.Connectors
129 129
130 } 130 }
131 else 131 else
132 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RegisterRegion received null reply"); 132 {
133 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
134 }
133 } 135 }
134 catch (Exception e) 136 catch (Exception e)
135 { 137 {
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 6fb583c..24a23dd 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.Simulation
371 371
372 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 372 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
373 { 373 {
374 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); 374// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
375 375
376 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 376 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
377 377
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 05cfe5f..89f0716 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -156,6 +156,7 @@ namespace OpenSim.Services.GridService
156 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 156 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
157 return "Region overlaps another region"; 157 return "Region overlaps another region";
158 } 158 }
159
159 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 160 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
160 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 161 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
161 { 162 {
@@ -236,18 +237,21 @@ namespace OpenSim.Services.GridService
236 } 237 }
237 238
238 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", 239 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
239 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 240 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY);
240 241
241 return String.Empty; 242 return String.Empty;
242 } 243 }
243 244
244 public bool DeregisterRegion(UUID regionID) 245 public bool DeregisterRegion(UUID regionID)
245 { 246 {
246 m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
247 RegionData region = m_Database.Get(regionID, UUID.Zero); 247 RegionData region = m_Database.Get(regionID, UUID.Zero);
248 if (region == null) 248 if (region == null)
249 return false; 249 return false;
250 250
251 m_log.DebugFormat(
252 "[GRID SERVICE]: Deregistering region {0} ({1}) at {2}-{3}",
253 region.RegionName, region.RegionID, region.coordX, region.coordY);
254
251 int flags = Convert.ToInt32(region.Data["flags"]); 255 int flags = Convert.ToInt32(region.Data["flags"]);
252 256
253 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) 257 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0)
@@ -292,7 +296,7 @@ namespace OpenSim.Services.GridService
292 } 296 }
293 } 297 }
294 298
295 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); 299// m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count);
296 } 300 }
297 else 301 else
298 { 302 {
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index a084309..2b0b947 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -103,9 +103,8 @@ namespace OpenSim.Services.Interfaces
103 int GetRegionFlags(UUID scopeID, UUID regionID); 103 int GetRegionFlags(UUID scopeID, UUID regionID);
104 } 104 }
105 105
106 public class GridRegion : Object 106 public class GridRegion
107 { 107 {
108
109 /// <summary> 108 /// <summary>
110 /// The port by which http communication occurs with the region 109 /// The port by which http communication occurs with the region
111 /// </summary> 110 /// </summary>
@@ -149,6 +148,19 @@ namespace OpenSim.Services.Interfaces
149 148
150 protected IPEndPoint m_internalEndPoint; 149 protected IPEndPoint m_internalEndPoint;
151 150
151 /// <summary>
152 /// The co-ordinate of this region.
153 /// </summary>
154 public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } }
155
156 /// <summary>
157 /// The co-ordinate of this region
158 /// </summary>
159 public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } }
160
161 /// <summary>
162 /// The location of this region in meters.
163 /// </summary>
152 public int RegionLocX 164 public int RegionLocX
153 { 165 {
154 get { return m_regionLocX; } 166 get { return m_regionLocX; }
@@ -156,6 +168,9 @@ namespace OpenSim.Services.Interfaces
156 } 168 }
157 protected int m_regionLocX; 169 protected int m_regionLocX;
158 170
171 /// <summary>
172 /// The location of this region in meters.
173 /// </summary>
159 public int RegionLocY 174 public int RegionLocY
160 { 175 {
161 get { return m_regionLocY; } 176 get { return m_regionLocY; }
@@ -417,8 +432,6 @@ namespace OpenSim.Services.Interfaces
417 432
418 if (kvp.ContainsKey("Token")) 433 if (kvp.ContainsKey("Token"))
419 Token = kvp["Token"].ToString(); 434 Token = kvp["Token"].ToString();
420
421 } 435 }
422 } 436 }
423
424} 437}
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs
index 7e7391c..a85ee70 100644
--- a/OpenSim/Services/MapImageService/MapImageService.cs
+++ b/OpenSim/Services/MapImageService/MapImageService.cs
@@ -138,6 +138,8 @@ namespace OpenSim.Services.MapImageService
138 138
139 public byte[] GetMapTile(string fileName, out string format) 139 public byte[] GetMapTile(string fileName, out string format)
140 { 140 {
141// m_log.DebugFormat("[MAP IMAGE SERVICE]: Getting map tile {0}", fileName);
142
141 format = ".jpg"; 143 format = ".jpg";
142 string fullName = Path.Combine(m_TilesStoragePath, fileName); 144 string fullName = Path.Combine(m_TilesStoragePath, fileName);
143 if (File.Exists(fullName)) 145 if (File.Exists(fullName))
@@ -206,7 +208,7 @@ namespace OpenSim.Services.MapImageService
206 208
207 private bool CreateTile(uint zoomLevel, int x, int y) 209 private bool CreateTile(uint zoomLevel, int x, int y)
208 { 210 {
209 m_log.DebugFormat("[MAP IMAGE SERVICE]: Create tile for {0} {1}, zoom {2}", x, y, zoomLevel); 211// m_log.DebugFormat("[MAP IMAGE SERVICE]: Create tile for {0} {1}, zoom {2}", x, y, zoomLevel);
210 int prevWidth = (int)Math.Pow(2, (double)zoomLevel - 2); 212 int prevWidth = (int)Math.Pow(2, (double)zoomLevel - 2);
211 int thisWidth = (int)Math.Pow(2, (double)zoomLevel - 1); 213 int thisWidth = (int)Math.Pow(2, (double)zoomLevel - 1);
212 214