diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
11 files changed, 128 insertions, 68 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 834aa14..ef7dce8 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | |||
@@ -38,9 +38,20 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
38 | public class XferModule : IRegionModule, IXfer | 38 | public class XferModule : IRegionModule, IXfer |
39 | { | 39 | { |
40 | private Scene m_scene; | 40 | private Scene m_scene; |
41 | private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); | ||
42 | private List<XferRequest> RequestTime = new List<XferRequest>(); | ||
41 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 43 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); |
42 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 44 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
45 | |||
43 | 46 | ||
47 | public struct XferRequest | ||
48 | { | ||
49 | public IClientAPI remoteClient; | ||
50 | public ulong xferID; | ||
51 | public string fileName; | ||
52 | public DateTime timeStamp; | ||
53 | } | ||
54 | |||
44 | #region IRegionModule Members | 55 | #region IRegionModule Members |
45 | 56 | ||
46 | public void Initialise(Scene scene, IConfigSource config) | 57 | public void Initialise(Scene scene, IConfigSource config) |
@@ -86,6 +97,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
86 | NewFiles.Add(fileName, data); | 97 | NewFiles.Add(fileName, data); |
87 | } | 98 | } |
88 | } | 99 | } |
100 | |||
101 | if (Requests.ContainsKey(fileName)) | ||
102 | { | ||
103 | RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName); | ||
104 | Requests.Remove(fileName); | ||
105 | } | ||
106 | |||
89 | return true; | 107 | return true; |
90 | } | 108 | } |
91 | 109 | ||
@@ -105,7 +123,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
105 | /// <param name="fileName"></param> | 123 | /// <param name="fileName"></param> |
106 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) | 124 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) |
107 | { | 125 | { |
108 | |||
109 | lock (NewFiles) | 126 | lock (NewFiles) |
110 | { | 127 | { |
111 | if (NewFiles.ContainsKey(fileName)) | 128 | if (NewFiles.ContainsKey(fileName)) |
@@ -114,6 +131,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
114 | { | 131 | { |
115 | byte[] fileData = NewFiles[fileName]; | 132 | byte[] fileData = NewFiles[fileName]; |
116 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); | 133 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); |
134 | |||
117 | Transfers.Add(xferID, transaction); | 135 | Transfers.Add(xferID, transaction); |
118 | NewFiles.Remove(fileName); | 136 | NewFiles.Remove(fileName); |
119 | 137 | ||
@@ -123,6 +141,30 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
123 | } | 141 | } |
124 | } | 142 | } |
125 | } | 143 | } |
144 | else | ||
145 | { | ||
146 | if (RequestTime.Count > 0) | ||
147 | { | ||
148 | TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks); | ||
149 | if (ts.TotalSeconds > 30) | ||
150 | { | ||
151 | Requests.Remove(RequestTime[0].fileName); | ||
152 | RequestTime.RemoveAt(0); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | if (!Requests.ContainsKey(fileName)) | ||
157 | { | ||
158 | XferRequest nRequest = new XferRequest(); | ||
159 | nRequest.remoteClient = remoteClient; | ||
160 | nRequest.xferID = xferID; | ||
161 | nRequest.fileName = fileName; | ||
162 | nRequest.timeStamp = DateTime.UtcNow; | ||
163 | Requests.Add(fileName, nRequest); | ||
164 | RequestTime.Add(nRequest); | ||
165 | } | ||
166 | |||
167 | } | ||
126 | } | 168 | } |
127 | } | 169 | } |
128 | 170 | ||
@@ -177,7 +219,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
177 | Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4); | 219 | Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4); |
178 | Array.Copy(Data, 0, transferData, 4, Data.Length); | 220 | Array.Copy(Data, 0, transferData, 4, Data.Length); |
179 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); | 221 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); |
180 | |||
181 | complete = true; | 222 | complete = true; |
182 | } | 223 | } |
183 | else | 224 | else |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 9387bce..61b6d65 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -96,12 +96,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
96 | else | 96 | else |
97 | { | 97 | { |
98 | bool foundResult = false; | 98 | bool foundResult = false; |
99 | string resultstring = ""; | 99 | string resultstring = String.Empty; |
100 | List<ScenePresence> allav = DeadAvatar.Scene.GetScenePresences(); | 100 | ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences(); |
101 | try | 101 | try |
102 | { | 102 | { |
103 | foreach (ScenePresence av in allav) | 103 | for (int i = 0; i < allav.Length; i++) |
104 | { | 104 | { |
105 | ScenePresence av = allav[i]; | ||
106 | |||
105 | if (av.LocalId == killerObjectLocalID) | 107 | if (av.LocalId == killerObjectLocalID) |
106 | { | 108 | { |
107 | av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname); | 109 | av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index ebebaf9..72ec869 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -85,10 +85,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
85 | 85 | ||
86 | public void SendAlertToUser(string firstName, string lastName, string message, bool modal) | 86 | public void SendAlertToUser(string firstName, string lastName, string message, bool modal) |
87 | { | 87 | { |
88 | List<ScenePresence> presenceList = m_scene.GetScenePresences(); | 88 | ScenePresence[] presenceList = m_scene.GetScenePresences(); |
89 | 89 | ||
90 | foreach (ScenePresence presence in presenceList) | 90 | for (int i = 0; i < presenceList.Length; i++) |
91 | { | 91 | { |
92 | ScenePresence presence = presenceList[i]; | ||
93 | |||
92 | if (presence.Firstname == firstName && presence.Lastname == lastName) | 94 | if (presence.Firstname == firstName && presence.Lastname == lastName) |
93 | { | 95 | { |
94 | presence.ControllingClient.SendAgentAlertMessage(message, modal); | 96 | presence.ControllingClient.SendAgentAlertMessage(message, modal); |
@@ -99,10 +101,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
99 | 101 | ||
100 | public void SendGeneralAlert(string message) | 102 | public void SendGeneralAlert(string message) |
101 | { | 103 | { |
102 | List<ScenePresence> presenceList = m_scene.GetScenePresences(); | 104 | ScenePresence[] presenceList = m_scene.GetScenePresences(); |
103 | 105 | ||
104 | foreach (ScenePresence presence in presenceList) | 106 | for (int i = 0; i < presenceList.Length; i++) |
105 | { | 107 | { |
108 | ScenePresence presence = presenceList[i]; | ||
109 | |||
106 | if (!presence.IsChildAgent) | 110 | if (!presence.IsChildAgent) |
107 | presence.ControllingClient.SendAlertMessage(message); | 111 | presence.ControllingClient.SendAlertMessage(message); |
108 | } | 112 | } |
@@ -150,10 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
150 | public void SendNotificationToUsersInRegion( | 154 | public void SendNotificationToUsersInRegion( |
151 | UUID fromAvatarID, string fromAvatarName, string message) | 155 | UUID fromAvatarID, string fromAvatarName, string message) |
152 | { | 156 | { |
153 | List<ScenePresence> presenceList = m_scene.GetScenePresences(); | 157 | ScenePresence[] presences = m_scene.GetScenePresences(); |
154 | 158 | ||
155 | foreach (ScenePresence presence in presenceList) | 159 | for (int i = 0; i < presences.Length; i++) |
156 | { | 160 | { |
161 | ScenePresence presence = presences[i]; | ||
157 | if (!presence.IsChildAgent) | 162 | if (!presence.IsChildAgent) |
158 | presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); | 163 | presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); |
159 | } | 164 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 7855862..273c128 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | |||
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
114 | { | 114 | { |
115 | string reasonStr = Utils.BytesToString(reason); | 115 | string reasonStr = Utils.BytesToString(reason); |
116 | 116 | ||
117 | m_scene.ClientManager.ForEach( | 117 | m_scene.ForEachClient( |
118 | delegate(IClientAPI controller) | 118 | delegate(IClientAPI controller) |
119 | { | 119 | { |
120 | if (controller.AgentId != godID) | 120 | if (controller.AgentId != godID) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index ad05bab..f5ab454 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -274,8 +274,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
274 | } | 274 | } |
275 | m_RootAgents[agentID] = scene; | 275 | m_RootAgents[agentID] = scene; |
276 | } | 276 | } |
277 | |||
277 | // inform messaging server that agent changed the region | 278 | // inform messaging server that agent changed the region |
278 | NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); | 279 | Util.FireAndForget( |
280 | delegate(object o) | ||
281 | { | ||
282 | NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); | ||
283 | } | ||
284 | ); | ||
279 | } | 285 | } |
280 | 286 | ||
281 | private void OnEconomyDataRequest(UUID agentID) | 287 | private void OnEconomyDataRequest(UUID agentID) |
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index d636b1c..62500a2 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -1208,10 +1208,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
1208 | if (homeScene.TryGetAvatar(avatarId,out avatar)) | 1208 | if (homeScene.TryGetAvatar(avatarId,out avatar)) |
1209 | { | 1209 | { |
1210 | KillAUser ku = new KillAUser(avatar,mod); | 1210 | KillAUser ku = new KillAUser(avatar,mod); |
1211 | Thread ta = new Thread(ku.ShutdownNoLogout); | 1211 | Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); |
1212 | ta.IsBackground = true; | ||
1213 | ta.Name = "ShutdownThread"; | ||
1214 | ta.Start(); | ||
1215 | } | 1212 | } |
1216 | } | 1213 | } |
1217 | 1214 | ||
@@ -1261,7 +1258,13 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
1261 | 1258 | ||
1262 | avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false; | 1259 | avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false; |
1263 | 1260 | ||
1264 | Thread.Sleep(30000); | 1261 | int sleepMS = 30000; |
1262 | while (sleepMS > 0) | ||
1263 | { | ||
1264 | Watchdog.UpdateThread(); | ||
1265 | Thread.Sleep(1000); | ||
1266 | sleepMS -= 1000; | ||
1267 | } | ||
1265 | 1268 | ||
1266 | // test for child agent because they might have come back | 1269 | // test for child agent because they might have come back |
1267 | if (avToBeKilled.IsChildAgent) | 1270 | if (avToBeKilled.IsChildAgent) |
@@ -1270,6 +1273,8 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
1270 | avToBeKilled.ControllingClient.Close(); | 1273 | avToBeKilled.ControllingClient.Close(); |
1271 | } | 1274 | } |
1272 | } | 1275 | } |
1276 | |||
1277 | Watchdog.RemoveThread(); | ||
1273 | } | 1278 | } |
1274 | 1279 | ||
1275 | } | 1280 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index fe9c8d9..c9fce91 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
128 | if (m_repliesRequired == 0) | 128 | if (m_repliesRequired == 0) |
129 | { | 129 | { |
130 | m_requestState = RequestState.Completed; | 130 | m_requestState = RequestState.Completed; |
131 | PerformAssetsRequestCallback(); | 131 | PerformAssetsRequestCallback(null); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
@@ -246,9 +246,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
246 | 246 | ||
247 | // We want to stop using the asset cache thread asap | 247 | // We want to stop using the asset cache thread asap |
248 | // as we now need to do the work of producing the rest of the archive | 248 | // as we now need to do the work of producing the rest of the archive |
249 | Thread newThread = new Thread(PerformAssetsRequestCallback); | 249 | Util.FireAndForget(PerformAssetsRequestCallback); |
250 | newThread.Name = "OpenSimulator archiving thread post assets receipt"; | ||
251 | newThread.Start(); | ||
252 | } | 250 | } |
253 | else | 251 | else |
254 | { | 252 | { |
@@ -265,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
265 | /// <summary> | 263 | /// <summary> |
266 | /// Perform the callback on the original requester of the assets | 264 | /// Perform the callback on the original requester of the assets |
267 | /// </summary> | 265 | /// </summary> |
268 | protected void PerformAssetsRequestCallback() | 266 | protected void PerformAssetsRequestCallback(object o) |
269 | { | 267 | { |
270 | try | 268 | try |
271 | { | 269 | { |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 3bb162e..e3a395e 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -414,9 +414,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
414 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) | 414 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) |
415 | { | 415 | { |
416 | // Get a fresh list that will not change as people get teleported away | 416 | // Get a fresh list that will not change as people get teleported away |
417 | List<ScenePresence> prescences = m_scene.GetScenePresences(); | 417 | ScenePresence[] presences = m_scene.GetScenePresences(); |
418 | foreach (ScenePresence p in prescences) | 418 | |
419 | for (int i = 0; i < presences.Length; i++) | ||
419 | { | 420 | { |
421 | ScenePresence p = presences[i]; | ||
422 | |||
420 | if (p.UUID != senderID) | 423 | if (p.UUID != senderID) |
421 | { | 424 | { |
422 | // make sure they are still there, we could be working down a long list | 425 | // make sure they are still there, we could be working down a long list |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 53c64cb..93a949a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -264,10 +264,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
264 | avatar.ControllingClient.SendAlertMessage( | 264 | avatar.ControllingClient.SendAlertMessage( |
265 | "You are not allowed on this parcel because you are banned. Please go away."); | 265 | "You are not allowed on this parcel because you are banned. Please go away."); |
266 | 266 | ||
267 | avatar.PhysicsActor.Position = | 267 | avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition; |
268 | new PhysicsVector(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y, | 268 | avatar.PhysicsActor.Velocity = Vector3.Zero; |
269 | avatar.lastKnownAllowedPosition.Z); | ||
270 | avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0); | ||
271 | } | 269 | } |
272 | else | 270 | else |
273 | { | 271 | { |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 5fd8369..285d36a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | |||
@@ -98,27 +98,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
98 | } | 98 | } |
99 | terrainRenderer.Initialise(m_scene, m_config); | 99 | terrainRenderer.Initialise(m_scene, m_config); |
100 | 100 | ||
101 | Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize); | 101 | using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) |
102 | //long t = System.Environment.TickCount; | 102 | { |
103 | //for (int i = 0; i < 10; ++i) { | 103 | //long t = System.Environment.TickCount; |
104 | //for (int i = 0; i < 10; ++i) { | ||
104 | terrainRenderer.TerrainToBitmap(mapbmp); | 105 | terrainRenderer.TerrainToBitmap(mapbmp); |
105 | //} | 106 | //} |
106 | //t = System.Environment.TickCount - t; | 107 | //t = System.Environment.TickCount - t; |
107 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | 108 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); |
108 | 109 | ||
109 | 110 | ||
110 | if (drawPrimVolume) | 111 | if (drawPrimVolume) |
111 | { | 112 | { |
112 | DrawObjectVolume(m_scene, mapbmp); | 113 | DrawObjectVolume(m_scene, mapbmp); |
113 | } | 114 | } |
114 | 115 | ||
115 | try | 116 | try |
116 | { | 117 | { |
117 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); | 118 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); |
118 | } | 119 | } |
119 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | 120 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke |
120 | { | 121 | { |
121 | m_log.Error("Failed generating terrain map: " + e); | 122 | m_log.Error("Failed generating terrain map: " + e); |
123 | } | ||
122 | } | 124 | } |
123 | 125 | ||
124 | return imageData; | 126 | return imageData; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 4e40084..f4b54aa 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | 59 | ||
60 | private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg"; | 60 | private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg"; |
61 | 61 | private static readonly UUID STOP_UUID = UUID.Random(); | |
62 | private static readonly string m_mapLayerPath = "0001/"; | 62 | private static readonly string m_mapLayerPath = "0001/"; |
63 | 63 | ||
64 | private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); | 64 | private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); |
@@ -74,7 +74,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
74 | private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); | 74 | private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); |
75 | private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); | 75 | private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); |
76 | private List<UUID> m_rootAgents = new List<UUID>(); | 76 | private List<UUID> m_rootAgents = new List<UUID>(); |
77 | private Thread mapItemReqThread; | ||
78 | private volatile bool threadrunning = false; | 77 | private volatile bool threadrunning = false; |
79 | 78 | ||
80 | //private int CacheRegionsDistance = 256; | 79 | //private int CacheRegionsDistance = 256; |
@@ -338,13 +337,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
338 | { | 337 | { |
339 | if (threadrunning) return; | 338 | if (threadrunning) return; |
340 | threadrunning = true; | 339 | threadrunning = true; |
340 | |||
341 | m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); | 341 | m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); |
342 | mapItemReqThread = new Thread(new ThreadStart(process)); | 342 | |
343 | mapItemReqThread.IsBackground = true; | 343 | Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true); |
344 | mapItemReqThread.Name = "MapItemRequestThread"; | ||
345 | mapItemReqThread.Priority = ThreadPriority.BelowNormal; | ||
346 | mapItemReqThread.SetApartmentState(ApartmentState.MTA); | ||
347 | mapItemReqThread.Start(); | ||
348 | } | 344 | } |
349 | 345 | ||
350 | /// <summary> | 346 | /// <summary> |
@@ -353,7 +349,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
353 | private void StopThread() | 349 | private void StopThread() |
354 | { | 350 | { |
355 | MapRequestState st = new MapRequestState(); | 351 | MapRequestState st = new MapRequestState(); |
356 | st.agentID=UUID.Zero; | 352 | st.agentID=STOP_UUID; |
357 | st.EstateID=0; | 353 | st.EstateID=0; |
358 | st.flags=0; | 354 | st.flags=0; |
359 | st.godlike=false; | 355 | st.godlike=false; |
@@ -441,26 +437,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
441 | { | 437 | { |
442 | while (true) | 438 | while (true) |
443 | { | 439 | { |
444 | MapRequestState st = requests.Dequeue(); | 440 | MapRequestState st = requests.Dequeue(1000); |
445 | 441 | ||
446 | // end gracefully | 442 | // end gracefully |
447 | if (st.agentID == UUID.Zero) | 443 | if (st.agentID == STOP_UUID) |
448 | { | ||
449 | break; | 444 | break; |
450 | } | ||
451 | 445 | ||
452 | bool dorequest = true; | 446 | if (st.agentID != UUID.Zero) |
453 | lock (m_rootAgents) | ||
454 | { | 447 | { |
455 | if (!m_rootAgents.Contains(st.agentID)) | 448 | bool dorequest = true; |
456 | dorequest = false; | 449 | lock (m_rootAgents) |
457 | } | 450 | { |
451 | if (!m_rootAgents.Contains(st.agentID)) | ||
452 | dorequest = false; | ||
453 | } | ||
458 | 454 | ||
459 | if (dorequest) | 455 | if (dorequest) |
460 | { | 456 | { |
461 | OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); | 457 | OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); |
462 | RequestMapItemsCompleted(response); | 458 | RequestMapItemsCompleted(response); |
459 | } | ||
463 | } | 460 | } |
461 | |||
462 | Watchdog.UpdateThread(); | ||
464 | } | 463 | } |
465 | } | 464 | } |
466 | catch (Exception e) | 465 | catch (Exception e) |
@@ -469,6 +468,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
469 | } | 468 | } |
470 | 469 | ||
471 | threadrunning = false; | 470 | threadrunning = false; |
471 | Watchdog.RemoveThread(); | ||
472 | } | 472 | } |
473 | 473 | ||
474 | /// <summary> | 474 | /// <summary> |