diff options
Diffstat (limited to 'OpenSim/Region')
46 files changed, 756 insertions, 750 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3d4269f..cdf8cb1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -2668,6 +2668,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2668 | 2668 | ||
2669 | public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) | 2669 | public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) |
2670 | { | 2670 | { |
2671 | float dwell = 0.0f; | ||
2672 | IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | ||
2673 | if (dwellModule != null) | ||
2674 | dwell = dwellModule.GetDwell(land.GlobalID); | ||
2671 | ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); | 2675 | ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); |
2672 | reply.AgentData.AgentID = m_agentId; | 2676 | reply.AgentData.AgentID = m_agentId; |
2673 | reply.Data.ParcelID = parcelID; | 2677 | reply.Data.ParcelID = parcelID; |
@@ -2692,7 +2696,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2692 | reply.Data.GlobalZ = pos.Z; | 2696 | reply.Data.GlobalZ = pos.Z; |
2693 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); | 2697 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); |
2694 | reply.Data.SnapshotID = land.SnapshotID; | 2698 | reply.Data.SnapshotID = land.SnapshotID; |
2695 | reply.Data.Dwell = land.Dwell; | 2699 | reply.Data.Dwell = dwell; |
2696 | reply.Data.SalePrice = land.SalePrice; | 2700 | reply.Data.SalePrice = land.SalePrice; |
2697 | reply.Data.AuctionID = (int)land.AuctionID; | 2701 | reply.Data.AuctionID = (int)land.AuctionID; |
2698 | 2702 | ||
@@ -3525,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3525 | 3529 | ||
3526 | private void ProcessEntityUpdates(int maxUpdates) | 3530 | private void ProcessEntityUpdates(int maxUpdates) |
3527 | { | 3531 | { |
3528 | Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | 3532 | OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); |
3529 | Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); | 3533 | OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); |
3530 | Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | 3534 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); |
3531 | 3535 | ||
3532 | if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; | 3536 | if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; |
3533 | int updatesThisCall = 0; | 3537 | int updatesThisCall = 0; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6555b54..7270304 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -264,8 +264,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
264 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | 264 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) |
265 | tainted = true; | 265 | tainted = true; |
266 | 266 | ||
267 | AttachObject(remoteClient, objatt, AttachmentPt, false); | 267 | // This will throw if the attachment fails |
268 | //objatt.ScheduleGroupForFullUpdate(); | 268 | try |
269 | { | ||
270 | AttachObject(remoteClient, objatt, AttachmentPt, false); | ||
271 | } | ||
272 | catch | ||
273 | { | ||
274 | // Make sure the object doesn't stick around and bail | ||
275 | m_scene.DeleteSceneObject(objatt, false); | ||
276 | return null; | ||
277 | } | ||
269 | 278 | ||
270 | if (tainted) | 279 | if (tainted) |
271 | objatt.HasGroupChanged = true; | 280 | objatt.HasGroupChanged = true; |
@@ -427,7 +436,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
427 | 436 | ||
428 | // We can NOT use the dictionries here, as we are looking | 437 | // We can NOT use the dictionries here, as we are looking |
429 | // for an entity by the fromAssetID, which is NOT the prim UUID | 438 | // for an entity by the fromAssetID, which is NOT the prim UUID |
430 | List<EntityBase> detachEntities = m_scene.GetEntities(); | 439 | EntityBase[] detachEntities = m_scene.GetEntities(); |
431 | SceneObjectGroup group; | 440 | SceneObjectGroup group; |
432 | 441 | ||
433 | foreach (EntityBase entity in detachEntities) | 442 | foreach (EntityBase entity in detachEntities) |
@@ -594,4 +603,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
594 | so.HasGroupChanged = false; | 603 | so.HasGroupChanged = false; |
595 | } | 604 | } |
596 | } | 605 | } |
597 | } \ No newline at end of file | 606 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 6f044cb..4e4eee9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
54 | public UUID PrincipalID; | 54 | public UUID PrincipalID; |
55 | public FriendInfo[] Friends; | 55 | public FriendInfo[] Friends; |
56 | public int Refcount; | 56 | public int Refcount; |
57 | public UUID RegionID; | ||
58 | 57 | ||
59 | public bool IsFriend(string friend) | 58 | public bool IsFriend(string friend) |
60 | { | 59 | { |
@@ -67,7 +66,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
67 | return false; | 66 | return false; |
68 | } | 67 | } |
69 | } | 68 | } |
70 | 69 | ||
70 | private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0]; | ||
71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
72 | 72 | ||
73 | protected List<Scene> m_Scenes = new List<Scene>(); | 73 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
79 | protected Dictionary<UUID, UserFriendData> m_Friends = | 79 | protected Dictionary<UUID, UserFriendData> m_Friends = |
80 | new Dictionary<UUID, UserFriendData>(); | 80 | new Dictionary<UUID, UserFriendData>(); |
81 | 81 | ||
82 | protected List<UUID> m_NeedsListOfFriends = new List<UUID>(); | 82 | protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>(); |
83 | 83 | ||
84 | protected IPresenceService PresenceService | 84 | protected IPresenceService PresenceService |
85 | { | 85 | { |
@@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
146 | // Instantiate the request handler | 146 | // Instantiate the request handler |
147 | IHttpServer server = MainServer.GetHttpServer((uint)mPort); | 147 | IHttpServer server = MainServer.GetHttpServer((uint)mPort); |
148 | server.AddStreamHandler(new FriendsRequestHandler(this)); | 148 | server.AddStreamHandler(new FriendsRequestHandler(this)); |
149 | |||
150 | } | 149 | } |
151 | 150 | ||
152 | if (m_FriendsService == null) | 151 | if (m_FriendsService == null) |
@@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
173 | scene.EventManager.OnNewClient += OnNewClient; | 172 | scene.EventManager.OnNewClient += OnNewClient; |
174 | scene.EventManager.OnClientClosed += OnClientClosed; | 173 | scene.EventManager.OnClientClosed += OnClientClosed; |
175 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | 174 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; |
176 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; | ||
177 | scene.EventManager.OnClientLogin += OnClientLogin; | 175 | scene.EventManager.OnClientLogin += OnClientLogin; |
178 | } | 176 | } |
179 | 177 | ||
@@ -198,16 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
198 | 196 | ||
199 | public uint GetFriendPerms(UUID principalID, UUID friendID) | 197 | public uint GetFriendPerms(UUID principalID, UUID friendID) |
200 | { | 198 | { |
201 | if (!m_Friends.ContainsKey(principalID)) | 199 | FriendInfo[] friends = GetFriends(principalID); |
202 | return 0; | 200 | foreach (FriendInfo fi in friends) |
203 | |||
204 | UserFriendData data = m_Friends[principalID]; | ||
205 | |||
206 | foreach (FriendInfo fi in data.Friends) | ||
207 | { | 201 | { |
208 | if (fi.Friend == friendID.ToString()) | 202 | if (fi.Friend == friendID.ToString()) |
209 | return (uint)fi.TheirFlags; | 203 | return (uint)fi.TheirFlags; |
210 | } | 204 | } |
205 | |||
211 | return 0; | 206 | return 0; |
212 | } | 207 | } |
213 | 208 | ||
@@ -217,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
217 | client.OnApproveFriendRequest += OnApproveFriendRequest; | 212 | client.OnApproveFriendRequest += OnApproveFriendRequest; |
218 | client.OnDenyFriendRequest += OnDenyFriendRequest; | 213 | client.OnDenyFriendRequest += OnDenyFriendRequest; |
219 | client.OnTerminateFriendship += OnTerminateFriendship; | 214 | client.OnTerminateFriendship += OnTerminateFriendship; |
220 | |||
221 | client.OnGrantUserRights += OnGrantUserRights; | 215 | client.OnGrantUserRights += OnGrantUserRights; |
222 | 216 | ||
223 | lock (m_Friends) | 217 | // Asynchronously fetch the friends list or increment the refcount for the existing |
224 | { | 218 | // friends list |
225 | if (m_Friends.ContainsKey(client.AgentId)) | 219 | Util.FireAndForget( |
220 | delegate(object o) | ||
226 | { | 221 | { |
227 | m_Friends[client.AgentId].Refcount++; | 222 | lock (m_Friends) |
228 | return; | 223 | { |
229 | } | 224 | UserFriendData friendsData; |
230 | 225 | if (m_Friends.TryGetValue(client.AgentId, out friendsData)) | |
231 | UserFriendData newFriends = new UserFriendData(); | 226 | { |
232 | 227 | friendsData.Refcount++; | |
233 | newFriends.PrincipalID = client.AgentId; | 228 | } |
234 | newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); | 229 | else |
235 | newFriends.Refcount = 1; | 230 | { |
236 | newFriends.RegionID = UUID.Zero; | 231 | friendsData = new UserFriendData(); |
232 | friendsData.PrincipalID = client.AgentId; | ||
233 | friendsData.Friends = FriendsService.GetFriends(client.AgentId); | ||
234 | friendsData.Refcount = 1; | ||
237 | 235 | ||
238 | m_Friends.Add(client.AgentId, newFriends); | 236 | m_Friends[client.AgentId] = friendsData; |
239 | } | 237 | } |
240 | 238 | } | |
239 | } | ||
240 | ); | ||
241 | } | 241 | } |
242 | 242 | ||
243 | private void OnClientClosed(UUID agentID, Scene scene) | 243 | private void OnClientClosed(UUID agentID, Scene scene) |
244 | { | 244 | { |
245 | ScenePresence sp = scene.GetScenePresence(agentID); | 245 | ScenePresence sp = scene.GetScenePresence(agentID); |
246 | if (sp != null && !sp.IsChildAgent) | 246 | if (sp != null && !sp.IsChildAgent) |
247 | { | ||
247 | // do this for root agents closing out | 248 | // do this for root agents closing out |
248 | StatusChange(agentID, false); | 249 | StatusChange(agentID, false); |
250 | } | ||
249 | 251 | ||
250 | lock (m_Friends) | 252 | lock (m_Friends) |
251 | if (m_Friends.ContainsKey(agentID)) | 253 | { |
254 | UserFriendData friendsData; | ||
255 | if (m_Friends.TryGetValue(agentID, out friendsData)) | ||
252 | { | 256 | { |
253 | if (m_Friends[agentID].Refcount == 1) | 257 | friendsData.Refcount--; |
258 | if (friendsData.Refcount <= 0) | ||
254 | m_Friends.Remove(agentID); | 259 | m_Friends.Remove(agentID); |
255 | else | ||
256 | m_Friends[agentID].Refcount--; | ||
257 | } | 260 | } |
261 | } | ||
258 | } | 262 | } |
259 | 263 | ||
260 | private void OnMakeRootAgent(ScenePresence sp) | 264 | private void OnMakeRootAgent(ScenePresence sp) |
261 | { | 265 | { |
262 | UUID agentID = sp.ControllingClient.AgentId; | 266 | UUID agentID = sp.ControllingClient.AgentId; |
263 | 267 | UpdateFriendsCache(agentID); | |
264 | if (m_Friends.ContainsKey(agentID)) | ||
265 | { | ||
266 | // This is probably an overkill, but just | ||
267 | // to make sure we have the latest and greatest | ||
268 | // friends list -- always pull OnMakeRoot | ||
269 | m_Friends[agentID].Friends = | ||
270 | m_FriendsService.GetFriends(agentID); | ||
271 | |||
272 | m_Friends[agentID].RegionID = | ||
273 | sp.ControllingClient.Scene.RegionInfo.RegionID; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | |||
278 | private void OnMakeChildAgent(ScenePresence sp) | ||
279 | { | ||
280 | UUID agentID = sp.ControllingClient.AgentId; | ||
281 | |||
282 | if (m_Friends.ContainsKey(agentID)) | ||
283 | { | ||
284 | if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID) | ||
285 | m_Friends[agentID].RegionID = UUID.Zero; | ||
286 | } | ||
287 | } | 268 | } |
288 | 269 | ||
289 | private void OnClientLogin(IClientAPI client) | 270 | private void OnClientLogin(IClientAPI client) |
@@ -295,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
295 | 276 | ||
296 | // Register that we need to send the list of online friends to this user | 277 | // Register that we need to send the list of online friends to this user |
297 | lock (m_NeedsListOfFriends) | 278 | lock (m_NeedsListOfFriends) |
298 | if (!m_NeedsListOfFriends.Contains(agentID)) | 279 | m_NeedsListOfFriends.Add(agentID); |
299 | { | ||
300 | m_NeedsListOfFriends.Add(agentID); | ||
301 | } | ||
302 | } | 280 | } |
303 | 281 | ||
304 | public void SendFriendsOnlineIfNeeded(IClientAPI client) | 282 | public void SendFriendsOnlineIfNeeded(IClientAPI client) |
305 | { | 283 | { |
306 | UUID agentID = client.AgentId; | 284 | UUID agentID = client.AgentId; |
307 | if (m_NeedsListOfFriends.Contains(agentID)) | 285 | |
286 | // Check if the online friends list is needed | ||
287 | lock (m_NeedsListOfFriends) | ||
308 | { | 288 | { |
309 | if (!m_Friends.ContainsKey(agentID)) | 289 | if (!m_NeedsListOfFriends.Remove(agentID)) |
310 | { | ||
311 | m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID); | ||
312 | return; | 290 | return; |
313 | } | 291 | } |
314 | |||
315 | // | ||
316 | // Send the friends online | ||
317 | // | ||
318 | List<UUID> online = GetOnlineFriends(agentID); | ||
319 | if (online.Count > 0) | ||
320 | { | ||
321 | m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); | ||
322 | client.SendAgentOnline(online.ToArray()); | ||
323 | } | ||
324 | |||
325 | // | ||
326 | // Send outstanding friendship offers | ||
327 | // | ||
328 | if (m_Friends.ContainsKey(agentID)) | ||
329 | { | ||
330 | List<string> outstanding = new List<string>(); | ||
331 | 292 | ||
332 | foreach (FriendInfo fi in m_Friends[agentID].Friends) | 293 | // Send the friends online |
333 | if (fi.TheirFlags == -1) | 294 | List<UUID> online = GetOnlineFriends(agentID); |
334 | outstanding.Add(fi.Friend); | 295 | if (online.Count > 0) |
296 | { | ||
297 | m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); | ||
298 | client.SendAgentOnline(online.ToArray()); | ||
299 | } | ||
335 | 300 | ||
336 | GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); | 301 | // Send outstanding friendship offers |
337 | foreach (string fid in outstanding) | 302 | List<string> outstanding = new List<string>(); |
338 | { | 303 | FriendInfo[] friends = GetFriends(agentID); |
339 | try | 304 | foreach (FriendInfo fi in friends) |
340 | { | 305 | { |
341 | im.fromAgentID = new Guid(fid); | 306 | if (fi.TheirFlags == -1) |
342 | } | 307 | outstanding.Add(fi.Friend); |
343 | catch | 308 | } |
344 | { | ||
345 | continue; | ||
346 | } | ||
347 | 309 | ||
348 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); | 310 | GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered, |
349 | im.fromAgentName = account.FirstName + " " + account.LastName; | 311 | "Will you be my friend?", true, Vector3.Zero); |
350 | 312 | ||
351 | PresenceInfo presence = null; | 313 | foreach (string fid in outstanding) |
352 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); | 314 | { |
353 | if (presences != null && presences.Length > 0) | 315 | UUID fromAgentID; |
354 | presence = presences[0]; | 316 | if (!UUID.TryParse(fid, out fromAgentID)) |
355 | if (presence != null) | 317 | continue; |
356 | im.offline = 0; | ||
357 | 318 | ||
358 | im.imSessionID = im.fromAgentID; | 319 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); |
320 | PresenceInfo presence = PresenceService.GetAgent(fromAgentID); | ||
359 | 321 | ||
360 | // Finally | 322 | im.fromAgentID = fromAgentID.Guid; |
361 | LocalFriendshipOffered(agentID, im); | 323 | im.fromAgentName = account.FirstName + " " + account.LastName; |
362 | } | 324 | im.offline = (byte)((presence == null) ? 1 : 0); |
363 | } | 325 | im.imSessionID = im.fromAgentID; |
364 | 326 | ||
365 | lock (m_NeedsListOfFriends) | 327 | // Finally |
366 | m_NeedsListOfFriends.Remove(agentID); | 328 | LocalFriendshipOffered(agentID, im); |
367 | } | 329 | } |
368 | } | 330 | } |
369 | 331 | ||
@@ -372,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
372 | List<string> friendList = new List<string>(); | 334 | List<string> friendList = new List<string>(); |
373 | List<UUID> online = new List<UUID>(); | 335 | List<UUID> online = new List<UUID>(); |
374 | 336 | ||
375 | foreach (FriendInfo fi in m_Friends[userID].Friends) | 337 | FriendInfo[] friends = GetFriends(userID); |
338 | foreach (FriendInfo fi in friends) | ||
376 | { | 339 | { |
377 | if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) | 340 | if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) |
378 | friendList.Add(fi.Friend); | 341 | friendList.Add(fi.Friend); |
379 | } | 342 | } |
380 | 343 | ||
381 | if (friendList.Count == 0) | 344 | if (friendList.Count > 0) |
382 | // no friends whatsoever | 345 | { |
383 | return online; | 346 | PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); |
384 | 347 | foreach (PresenceInfo pi in presence) | |
385 | PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); | 348 | { |
386 | 349 | UUID presenceID; | |
387 | foreach (PresenceInfo pi in presence) | 350 | if (UUID.TryParse(pi.UserID, out presenceID)) |
388 | online.Add(new UUID(pi.UserID)); | 351 | online.Add(presenceID); |
389 | //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); | 352 | } |
353 | } | ||
390 | 354 | ||
391 | return online; | 355 | return online; |
392 | } | 356 | } |
393 | 357 | ||
394 | // | 358 | /// <summary> |
395 | // Find the client for a ID | 359 | /// Find the client for a ID |
396 | // | 360 | /// </summary> |
397 | public IClientAPI LocateClientObject(UUID agentID) | 361 | public IClientAPI LocateClientObject(UUID agentID) |
398 | { | 362 | { |
399 | Scene scene = GetClientScene(agentID); | 363 | Scene scene = GetClientScene(agentID); |
400 | if (scene == null) | 364 | if (scene != null) |
401 | return null; | 365 | { |
402 | 366 | ScenePresence presence = scene.GetScenePresence(agentID); | |
403 | ScenePresence presence = scene.GetScenePresence(agentID); | 367 | if (presence != null) |
404 | if (presence == null) | 368 | return presence.ControllingClient; |
405 | return null; | 369 | } |
406 | 370 | ||
407 | return presence.ControllingClient; | 371 | return null; |
408 | } | 372 | } |
409 | 373 | ||
410 | // | 374 | /// <summary> |
411 | // Find the scene for an agent | 375 | /// Find the scene for an agent |
412 | // | 376 | /// </summary> |
413 | private Scene GetClientScene(UUID agentId) | 377 | private Scene GetClientScene(UUID agentId) |
414 | { | 378 | { |
415 | lock (m_Scenes) | 379 | lock (m_Scenes) |
@@ -417,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
417 | foreach (Scene scene in m_Scenes) | 381 | foreach (Scene scene in m_Scenes) |
418 | { | 382 | { |
419 | ScenePresence presence = scene.GetScenePresence(agentId); | 383 | ScenePresence presence = scene.GetScenePresence(agentId); |
420 | if (presence != null) | 384 | if (presence != null && !presence.IsChildAgent) |
421 | { | 385 | return scene; |
422 | if (!presence.IsChildAgent) | ||
423 | return scene; | ||
424 | } | ||
425 | } | 386 | } |
426 | } | 387 | } |
388 | |||
427 | return null; | 389 | return null; |
428 | } | 390 | } |
429 | 391 | ||
@@ -434,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
434 | /// <param name="online"></param> | 396 | /// <param name="online"></param> |
435 | private void StatusChange(UUID agentID, bool online) | 397 | private void StatusChange(UUID agentID, bool online) |
436 | { | 398 | { |
437 | //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); | 399 | FriendInfo[] friends = GetFriends(agentID); |
438 | if (m_Friends.ContainsKey(agentID)) | 400 | if (friends.Length > 0) |
439 | { | 401 | { |
440 | //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length); | ||
441 | List<FriendInfo> friendList = new List<FriendInfo>(); | 402 | List<FriendInfo> friendList = new List<FriendInfo>(); |
442 | foreach (FriendInfo fi in m_Friends[agentID].Friends) | 403 | foreach (FriendInfo fi in friends) |
443 | { | 404 | { |
444 | if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) | 405 | if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) |
445 | friendList.Add(fi); | 406 | friendList.Add(fi); |
446 | } | 407 | } |
447 | 408 | ||
448 | Util.FireAndForget(delegate | 409 | Util.FireAndForget( |
449 | { | 410 | delegate |
450 | foreach (FriendInfo fi in friendList) | ||
451 | { | 411 | { |
452 | //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); | 412 | foreach (FriendInfo fi in friendList) |
453 | // Notify about this user status | 413 | { |
454 | StatusNotify(fi, agentID, online); | 414 | //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); |
415 | // Notify about this user status | ||
416 | StatusNotify(fi, agentID, online); | ||
417 | } | ||
455 | } | 418 | } |
456 | }); | 419 | ); |
457 | } | 420 | } |
458 | else | ||
459 | m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID); | ||
460 | } | 421 | } |
461 | 422 | ||
462 | private void StatusNotify(FriendInfo friend, UUID userID, bool online) | 423 | private void StatusNotify(FriendInfo friend, UUID userID, bool online) |
463 | { | 424 | { |
464 | UUID friendID = UUID.Zero; | 425 | UUID friendID; |
465 | |||
466 | if (UUID.TryParse(friend.Friend, out friendID)) | 426 | if (UUID.TryParse(friend.Friend, out friendID)) |
467 | { | 427 | { |
468 | // Try local | 428 | // Try local |
@@ -470,34 +430,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
470 | return; | 430 | return; |
471 | 431 | ||
472 | // The friend is not here [as root]. Let's forward. | 432 | // The friend is not here [as root]. Let's forward. |
473 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 433 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
474 | if (friendSessions != null && friendSessions.Length > 0) | 434 | if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check |
475 | { | 435 | { |
476 | PresenceInfo friendSession = null; | 436 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
477 | foreach (PresenceInfo pinfo in friendSessions) | 437 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); |
478 | if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad | 438 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); |
479 | { | ||
480 | friendSession = pinfo; | ||
481 | break; | ||
482 | } | ||
483 | |||
484 | if (friendSession != null) | ||
485 | { | ||
486 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
487 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); | ||
488 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); | ||
489 | } | ||
490 | } | 439 | } |
491 | |||
492 | // Friend is not online. Ignore. | ||
493 | } | 440 | } |
494 | else | 441 | else |
442 | { | ||
495 | m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); | 443 | m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); |
444 | } | ||
496 | } | 445 | } |
497 | 446 | ||
498 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 447 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
499 | { | 448 | { |
500 | if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) | 449 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) |
501 | { | 450 | { |
502 | // we got a friendship offer | 451 | // we got a friendship offer |
503 | UUID principalID = new UUID(im.fromAgentID); | 452 | UUID principalID = new UUID(im.fromAgentID); |
@@ -528,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
528 | return; | 477 | return; |
529 | 478 | ||
530 | // The prospective friend is not here [as root]. Let's forward. | 479 | // The prospective friend is not here [as root]. Let's forward. |
531 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 480 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
532 | if (friendSessions != null && friendSessions.Length > 0) | 481 | if (friendSession != null) |
533 | { | 482 | { |
534 | PresenceInfo friendSession = friendSessions[0]; | 483 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
535 | if (friendSession != null) | 484 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); |
536 | { | ||
537 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
538 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); | ||
539 | } | ||
540 | } | 485 | } |
541 | // If the prospective friend is not online, he'll get the message upon login. | 486 | // If the prospective friend is not online, he'll get the message upon login. |
542 | } | 487 | } |
@@ -547,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
547 | 492 | ||
548 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); | 493 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); |
549 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); | 494 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); |
550 | // update the local cache | ||
551 | m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); | ||
552 | 495 | ||
496 | // Update the local cache | ||
497 | UpdateFriendsCache(agentID); | ||
553 | 498 | ||
554 | // | 499 | // |
555 | // Notify the friend | 500 | // Notify the friend |
@@ -563,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
563 | } | 508 | } |
564 | 509 | ||
565 | // The friend is not here | 510 | // The friend is not here |
566 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 511 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
567 | if (friendSessions != null && friendSessions.Length > 0) | 512 | if (friendSession != null) |
568 | { | 513 | { |
569 | PresenceInfo friendSession = friendSessions[0]; | 514 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
570 | if (friendSession != null) | 515 | m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); |
571 | { | 516 | client.SendAgentOnline(new UUID[] { friendID }); |
572 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
573 | m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); | ||
574 | client.SendAgentOnline(new UUID[] { friendID }); | ||
575 | } | ||
576 | } | 517 | } |
577 | } | 518 | } |
578 | 519 | ||
@@ -591,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
591 | if (LocalFriendshipDenied(agentID, client.Name, friendID)) | 532 | if (LocalFriendshipDenied(agentID, client.Name, friendID)) |
592 | return; | 533 | return; |
593 | 534 | ||
594 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 535 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
595 | if (friendSessions != null && friendSessions.Length > 0) | 536 | if (friendSession != null) |
596 | { | 537 | { |
597 | PresenceInfo friendSession = friendSessions[0]; | 538 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
598 | if (friendSession != null) | 539 | if (region != null) |
599 | { | 540 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); |
600 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 541 | else |
601 | if (region != null) | 542 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); |
602 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); | ||
603 | else | ||
604 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); | ||
605 | } | ||
606 | } | 543 | } |
607 | } | 544 | } |
608 | 545 | ||
@@ -612,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
612 | FriendsService.Delete(exfriendID, agentID.ToString()); | 549 | FriendsService.Delete(exfriendID, agentID.ToString()); |
613 | 550 | ||
614 | // Update local cache | 551 | // Update local cache |
615 | m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); | 552 | UpdateFriendsCache(agentID); |
616 | 553 | ||
617 | client.SendTerminateFriend(exfriendID); | 554 | client.SendTerminateFriend(exfriendID); |
618 | 555 | ||
@@ -624,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
624 | if (LocalFriendshipTerminated(exfriendID)) | 561 | if (LocalFriendshipTerminated(exfriendID)) |
625 | return; | 562 | return; |
626 | 563 | ||
627 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); | 564 | PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); |
628 | if (friendSessions != null && friendSessions.Length > 0) | 565 | if (friendSession != null) |
629 | { | 566 | { |
630 | PresenceInfo friendSession = friendSessions[0]; | 567 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
631 | if (friendSession != null) | 568 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); |
632 | { | ||
633 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
634 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); | ||
635 | } | ||
636 | } | 569 | } |
637 | } | 570 | } |
638 | 571 | ||
639 | private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) | 572 | private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) |
640 | { | 573 | { |
641 | if (!m_Friends.ContainsKey(remoteClient.AgentId)) | 574 | FriendInfo[] friends = GetFriends(remoteClient.AgentId); |
575 | if (friends.Length == 0) | ||
642 | return; | 576 | return; |
643 | 577 | ||
644 | m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); | 578 | m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); |
645 | // Let's find the friend in this user's friend list | 579 | // Let's find the friend in this user's friend list |
646 | UserFriendData fd = m_Friends[remoteClient.AgentId]; | ||
647 | FriendInfo friend = null; | 580 | FriendInfo friend = null; |
648 | foreach (FriendInfo fi in fd.Friends) | 581 | foreach (FriendInfo fi in friends) |
582 | { | ||
649 | if (fi.Friend == target.ToString()) | 583 | if (fi.Friend == target.ToString()) |
650 | friend = fi; | 584 | friend = fi; |
585 | } | ||
651 | 586 | ||
652 | if (friend != null) // Found it | 587 | if (friend != null) // Found it |
653 | { | 588 | { |
@@ -669,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
669 | if (LocalGrantRights(requester, target, myFlags, rights)) | 604 | if (LocalGrantRights(requester, target, myFlags, rights)) |
670 | return; | 605 | return; |
671 | 606 | ||
672 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); | 607 | PresenceInfo friendSession = PresenceService.GetAgent(target); |
673 | if (friendSessions != null && friendSessions.Length > 0) | 608 | if (friendSession != null) |
674 | { | 609 | { |
675 | PresenceInfo friendSession = friendSessions[0]; | 610 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
676 | if (friendSession != null) | 611 | // TODO: You might want to send the delta to save the lookup |
677 | { | 612 | // on the other end!! |
678 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 613 | m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); |
679 | // TODO: You might want to send the delta to save the lookup | ||
680 | // on the other end!! | ||
681 | m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); | ||
682 | } | ||
683 | } | 614 | } |
684 | } | 615 | } |
685 | } | 616 | } |
@@ -708,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
708 | GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, | 639 | GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, |
709 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 640 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
710 | friendClient.SendInstantMessage(im); | 641 | friendClient.SendInstantMessage(im); |
711 | // update the local cache | 642 | |
712 | m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); | 643 | // Update the local cache |
644 | UpdateFriendsCache(friendID); | ||
645 | |||
713 | // we're done | 646 | // we're done |
714 | return true; | 647 | return true; |
715 | } | 648 | } |
@@ -723,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
723 | if (friendClient != null) | 656 | if (friendClient != null) |
724 | { | 657 | { |
725 | // the prospective friend in this sim as root agent | 658 | // the prospective friend in this sim as root agent |
726 | |||
727 | GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, | 659 | GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, |
728 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); | 660 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); |
729 | friendClient.SendInstantMessage(im); | 661 | friendClient.SendInstantMessage(im); |
@@ -742,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
742 | // the friend in this sim as root agent | 674 | // the friend in this sim as root agent |
743 | friendClient.SendTerminateFriend(exfriendID); | 675 | friendClient.SendTerminateFriend(exfriendID); |
744 | // update local cache | 676 | // update local cache |
745 | m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); | 677 | UpdateFriendsCache(exfriendID); |
746 | // we're done | 678 | // we're done |
747 | return true; | 679 | return true; |
748 | } | 680 | } |
@@ -771,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
771 | 703 | ||
772 | } | 704 | } |
773 | 705 | ||
774 | // update local cache | 706 | // Update local cache |
775 | //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); | 707 | lock (m_Friends) |
776 | foreach (FriendInfo finfo in m_Friends[friendID].Friends) | 708 | { |
777 | if (finfo.Friend == userID.ToString()) | 709 | FriendInfo[] friends = GetFriends(friendID); |
778 | finfo.TheirFlags = rights; | 710 | foreach (FriendInfo finfo in friends) |
711 | { | ||
712 | if (finfo.Friend == userID.ToString()) | ||
713 | finfo.TheirFlags = rights; | ||
714 | } | ||
715 | } | ||
779 | 716 | ||
780 | return true; | 717 | return true; |
781 | } | 718 | } |
@@ -801,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
801 | 738 | ||
802 | return false; | 739 | return false; |
803 | } | 740 | } |
741 | |||
804 | #endregion | 742 | #endregion |
805 | 743 | ||
744 | private FriendInfo[] GetFriends(UUID agentID) | ||
745 | { | ||
746 | UserFriendData friendsData; | ||
747 | |||
748 | lock (m_Friends) | ||
749 | { | ||
750 | if (m_Friends.TryGetValue(agentID, out friendsData)) | ||
751 | return friendsData.Friends; | ||
752 | } | ||
753 | |||
754 | return EMPTY_FRIENDS; | ||
755 | } | ||
756 | |||
757 | private void UpdateFriendsCache(UUID agentID) | ||
758 | { | ||
759 | lock (m_Friends) | ||
760 | { | ||
761 | UserFriendData friendsData; | ||
762 | if (m_Friends.TryGetValue(agentID, out friendsData)) | ||
763 | friendsData.Friends = FriendsService.GetFriends(agentID); | ||
764 | } | ||
765 | } | ||
806 | } | 766 | } |
807 | } | 767 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 730cc77..13bae2e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -498,9 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
498 | if (lookupAgent) | 498 | if (lookupAgent) |
499 | { | 499 | { |
500 | // Non-cached user agent lookup. | 500 | // Non-cached user agent lookup. |
501 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); | 501 | upd = PresenceService.GetAgent(toAgentID); |
502 | if (presences != null && presences.Length > 0) | ||
503 | upd = presences[0]; | ||
504 | 502 | ||
505 | if (upd != null) | 503 | if (upd != null) |
506 | { | 504 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 235914a..2f96bcb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
115 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 115 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
116 | 116 | ||
117 | new UserAgentServerConnector(m_Config, MainServer.Instance); | 117 | new UserAgentServerConnector(m_Config, MainServer.Instance); |
118 | new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); | ||
118 | } | 119 | } |
119 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); | 120 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); |
120 | } | 121 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 5b4fecb..39410b5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | using OpenSim.Services.Connectors; | 39 | using OpenSim.Services.Connectors; |
40 | using OpenSim.Services.Connectors.SimianGrid; | ||
40 | using OpenMetaverse; | 41 | using OpenMetaverse; |
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
@@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
538 | } | 539 | } |
539 | else | 540 | else |
540 | { | 541 | { |
541 | // We're instantiating this class explicitly, but this won't | 542 | // Still not as flexible as I would like this to be, |
542 | // work in general, because the remote grid may be running | 543 | // but good enough for now |
543 | // an inventory server that has a different protocol. | 544 | string connectorType = new HeloServicesConnector(url).Helo(); |
544 | // Eventually we will want a piece of protocol asking | 545 | m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType); |
545 | // the remote server about its kind. Definitely cool thing to do! | 546 | if (connectorType == "opensim-simian") |
546 | connector = new RemoteXInventoryServicesConnector(url); | 547 | connector = new SimianInventoryServiceConnector(url); |
548 | else | ||
549 | connector = new RemoteXInventoryServicesConnector(url); | ||
547 | m_connectors.Add(url, connector); | 550 | m_connectors.Add(url, connector); |
548 | } | 551 | } |
549 | } | 552 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e1bc243..7c12b8c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
36 | { | 36 | { |
37 | public class UserAccountCache | 37 | public class UserAccountCache |
38 | { | 38 | { |
39 | private const double CACHE_EXPIRATION_SECONDS = 120.0; | ||
40 | |||
39 | private static readonly ILog m_log = | 41 | private static readonly ILog m_log = |
40 | LogManager.GetLogger( | 42 | LogManager.GetLogger( |
41 | MethodBase.GetCurrentMethod().DeclaringType); | 43 | MethodBase.GetCurrentMethod().DeclaringType); |
@@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
51 | public void Cache(UUID userID, UserAccount account) | 53 | public void Cache(UUID userID, UserAccount account) |
52 | { | 54 | { |
53 | // Cache even null accounts | 55 | // Cache even null accounts |
54 | m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | 56 | m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); |
55 | if (account != null) | 57 | if (account != null) |
56 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | 58 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); |
57 | 59 | ||
58 | m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); | 60 | m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); |
59 | } | 61 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index b25636f..283b33b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
102 | { | 102 | { |
103 | Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>(); | 103 | Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>(); |
104 | 104 | ||
105 | List<EntityBase> entities = m_scene.GetEntities(); | 105 | EntityBase[] entities = m_scene.GetEntities(); |
106 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 106 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
107 | 107 | ||
108 | /* | 108 | /* |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 58698ee..3342164 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup; | |||
48 | using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; | 48 | using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; |
49 | using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; | 49 | using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; |
50 | using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; | 50 | using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; |
51 | using RegionSettings = OpenSim.Framework.RegionSettings; | ||
51 | 52 | ||
52 | namespace OpenSim.Region.CoreModules.World.Archiver.Tests | 53 | namespace OpenSim.Region.CoreModules.World.Archiver.Tests |
53 | { | 54 | { |
@@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
135 | 136 | ||
136 | SceneObjectPart part2 = CreateSceneObjectPart2(); | 137 | SceneObjectPart part2 = CreateSceneObjectPart2(); |
137 | 138 | ||
138 | AssetNotecard nc = new AssetNotecard("Hello World!"); | 139 | AssetNotecard nc = new AssetNotecard(); |
140 | nc.BodyText = "Hello World!"; | ||
141 | nc.Encode(); | ||
139 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 142 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); |
140 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | 143 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); |
141 | AssetBase ncAsset | 144 | AssetBase ncAsset |
@@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
215 | public void TestLoadOarV0_2() | 218 | public void TestLoadOarV0_2() |
216 | { | 219 | { |
217 | TestHelper.InMethod(); | 220 | TestHelper.InMethod(); |
218 | //log4net.Config.XmlConfigurator.Configure(); | 221 | // log4net.Config.XmlConfigurator.Configure(); |
219 | 222 | ||
220 | MemoryStream archiveWriteStream = new MemoryStream(); | 223 | MemoryStream archiveWriteStream = new MemoryStream(); |
221 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | 224 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 3e79ec0..ea71fd9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -163,7 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
163 | client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; | 163 | client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; |
164 | client.OnParcelReclaim += ClientOnParcelReclaim; | 164 | client.OnParcelReclaim += ClientOnParcelReclaim; |
165 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 165 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
166 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | ||
167 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 166 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
168 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; | 167 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; |
169 | 168 | ||
@@ -795,7 +794,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
795 | public void EventManagerOnParcelPrimCountUpdate() | 794 | public void EventManagerOnParcelPrimCountUpdate() |
796 | { | 795 | { |
797 | ResetAllLandPrimCounts(); | 796 | ResetAllLandPrimCounts(); |
798 | foreach (EntityBase obj in m_scene.Entities) | 797 | EntityBase[] entities = m_scene.Entities.GetEntities(); |
798 | foreach (EntityBase obj in entities) | ||
799 | { | 799 | { |
800 | if (obj != null) | 800 | if (obj != null) |
801 | { | 801 | { |
@@ -1104,7 +1104,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1104 | m_landList.TryGetValue(localID, out land); | 1104 | m_landList.TryGetValue(localID, out land); |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | if (land != null) land.UpdateLandProperties(args, remote_client); | 1107 | if (land != null) |
1108 | { | ||
1109 | land.UpdateLandProperties(args, remote_client); | ||
1110 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); | ||
1111 | } | ||
1108 | } | 1112 | } |
1109 | 1113 | ||
1110 | public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) | 1114 | public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) |
@@ -1409,9 +1413,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1409 | m_landList.TryGetValue(parcelID, out land); | 1413 | m_landList.TryGetValue(parcelID, out land); |
1410 | } | 1414 | } |
1411 | 1415 | ||
1412 | if (land != null) { | 1416 | if (land != null) |
1417 | { | ||
1413 | land.UpdateLandProperties(land_update, client); | 1418 | land.UpdateLandProperties(land_update, client); |
1414 | } else { | 1419 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); |
1420 | } | ||
1421 | else | ||
1422 | { | ||
1415 | m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); | 1423 | m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); |
1416 | } | 1424 | } |
1417 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 1425 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
@@ -1487,18 +1495,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1487 | 1495 | ||
1488 | #endregion | 1496 | #endregion |
1489 | 1497 | ||
1490 | private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient) | ||
1491 | { | ||
1492 | ILandObject selectedParcel = null; | ||
1493 | lock (m_landList) | ||
1494 | { | ||
1495 | if (!m_landList.TryGetValue(localID, out selectedParcel)) | ||
1496 | return; | ||
1497 | } | ||
1498 | |||
1499 | remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell); | ||
1500 | } | ||
1501 | |||
1502 | private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) | 1498 | private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) |
1503 | { | 1499 | { |
1504 | if (parcelID == UUID.Zero) | 1500 | if (parcelID == UUID.Zero) |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index bef7fe4..5067ebd 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
80 | { | 80 | { |
81 | string xmlstream = "<scene>"; | 81 | string xmlstream = "<scene>"; |
82 | 82 | ||
83 | List<EntityBase> EntityList = scene.GetEntities(); | 83 | EntityBase[] EntityList = scene.GetEntities(); |
84 | List<string> EntityXml = new List<string>(); | 84 | List<string> EntityXml = new List<string>(); |
85 | 85 | ||
86 | foreach (EntityBase ent in EntityList) | 86 | foreach (EntityBase ent in EntityList) |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 58e4261..98fe493 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs | |||
@@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
165 | return SceneXmlLoader.SaveGroupToXml2(grp); | 165 | return SceneXmlLoader.SaveGroupToXml2(grp); |
166 | } | 166 | } |
167 | 167 | ||
168 | public void SavePrimListToXml2(List<EntityBase> entityList, string fileName) | 168 | public void SavePrimListToXml2(EntityBase[] entityList, string fileName) |
169 | { | 169 | { |
170 | SceneXmlLoader.SavePrimListToXml2(entityList, fileName); | 170 | SceneXmlLoader.SavePrimListToXml2(entityList, fileName); |
171 | } | 171 | } |
172 | 172 | ||
173 | public void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) | 173 | public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) |
174 | { | 174 | { |
175 | SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); | 175 | SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); |
176 | } | 176 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 57eff8a..1d9c2bd 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | |||
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
212 | double[,] hm = whichScene.Heightmap.GetDoubles(); | 212 | double[,] hm = whichScene.Heightmap.GetDoubles(); |
213 | tc = Environment.TickCount; | 213 | tc = Environment.TickCount; |
214 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); | 214 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); |
215 | List<EntityBase> objs = whichScene.GetEntities(); | 215 | EntityBase[] objs = whichScene.GetEntities(); |
216 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); | 216 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); |
217 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); | 217 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); |
218 | List<float> z_sortheights = new List<float>(); | 218 | List<float> z_sortheights = new List<float>(); |
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index 64d29f2..b8c90cd 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs | |||
@@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
123 | ILandChannel landChannel = m_scene.LandChannel; | 123 | ILandChannel landChannel = m_scene.LandChannel; |
124 | List<ILandObject> parcels = landChannel.AllParcels(); | 124 | List<ILandObject> parcels = landChannel.AllParcels(); |
125 | 125 | ||
126 | IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | ||
127 | |||
126 | XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); | 128 | XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); |
127 | if (parcels != null) | 129 | if (parcels != null) |
128 | { | 130 | { |
@@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
208 | xmlparcel.AppendChild(infouuid); | 210 | xmlparcel.AppendChild(infouuid); |
209 | 211 | ||
210 | XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); | 212 | XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); |
211 | dwell.InnerText = parcel.Dwell.ToString(); | 213 | if (dwellModule != null) |
214 | dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString(); | ||
215 | else | ||
216 | dwell.InnerText = "0"; | ||
212 | xmlparcel.AppendChild(dwell); | 217 | xmlparcel.AppendChild(dwell); |
213 | 218 | ||
214 | //TODO: figure how to figure out teleport system landData.landingType | 219 | //TODO: figure how to figure out teleport system landData.landingType |
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index 3c39f9e..5e75cae 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | |||
@@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
101 | XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); | 101 | XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); |
102 | XmlNode node; | 102 | XmlNode node; |
103 | 103 | ||
104 | foreach (EntityBase entity in m_scene.Entities) | 104 | EntityBase[] entities = m_scene.Entities.GetEntities(); |
105 | foreach (EntityBase entity in entities) | ||
105 | { | 106 | { |
106 | // only objects, not avatars | 107 | // only objects, not avatars |
107 | if (entity is SceneObjectGroup) | 108 | if (entity is SceneObjectGroup) |
diff --git a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs new file mode 100644 index 0000000..db50439 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs | |||
@@ -0,0 +1,37 @@ | |||
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 OpenSimulator 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 OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | public interface IDwellModule | ||
34 | { | ||
35 | int GetDwell(UUID parcelID); | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs index e7562a5..18758c8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
90 | /// </summary> | 90 | /// </summary> |
91 | /// <param name="entityList"></param> | 91 | /// <param name="entityList"></param> |
92 | /// <param name="fileName"></param> | 92 | /// <param name="fileName"></param> |
93 | void SavePrimListToXml2(List<EntityBase> entityList, string fileName); | 93 | void SavePrimListToXml2(EntityBase[] entityList, string fileName); |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which | 96 | /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which |
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
101 | /// <param name="stream"></param> | 101 | /// <param name="stream"></param> |
102 | /// <param name="min"></param> | 102 | /// <param name="min"></param> |
103 | /// <param name="max"></param> | 103 | /// <param name="max"></param> |
104 | void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max); | 104 | void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max); |
105 | 105 | ||
106 | void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); | 106 | void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); |
107 | 107 | ||
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 241cac0..916148b 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -111,11 +111,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | 111 | ||
112 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) | 112 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) |
113 | { | 113 | { |
114 | m_log.Debug("[SCENE]: Starting send to inventory loop"); | 114 | m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop"); |
115 | 115 | ||
116 | while (InventoryDeQueueAndDelete()) | 116 | while (InventoryDeQueueAndDelete()) |
117 | { | 117 | { |
118 | //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); | 118 | //m_log.Debug("[ASYNC DELETER]: Sent item successfully to inventory, continuing..."); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | x = m_inventoryDeletes.Dequeue(); | 137 | x = m_inventoryDeletes.Dequeue(); |
138 | 138 | ||
139 | m_log.DebugFormat( | 139 | m_log.DebugFormat( |
140 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); | 140 | "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left); |
141 | 141 | ||
142 | try | 142 | try |
143 | { | 143 | { |
@@ -152,7 +152,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
152 | } | 152 | } |
153 | catch (Exception e) | 153 | catch (Exception e) |
154 | { | 154 | { |
155 | m_log.DebugFormat("Exception background sending object: " + e); | 155 | m_log.ErrorFormat( |
156 | "[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace); | ||
156 | } | 157 | } |
157 | 158 | ||
158 | return true; | 159 | return true; |
@@ -164,12 +165,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
164 | // We can't put the object group details in here since the root part may have disappeared (which is where these sit). | 165 | // We can't put the object group details in here since the root part may have disappeared (which is where these sit). |
165 | // FIXME: This needs to be fixed. | 166 | // FIXME: This needs to be fixed. |
166 | m_log.ErrorFormat( | 167 | m_log.ErrorFormat( |
167 | "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}", | 168 | "[ASYNC DELETER]: Queued sending of scene object to agent {0} {1} failed: {2} {3}", |
168 | (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); | 169 | (x != null ? x.remoteClient.Name : "unavailable"), |
170 | (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), | ||
171 | e.Message, | ||
172 | e.StackTrace); | ||
169 | } | 173 | } |
170 | 174 | ||
171 | m_log.Debug("[SCENE]: No objects left in inventory send queue."); | 175 | m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue."); |
176 | |||
172 | return false; | 177 | return false; |
173 | } | 178 | } |
174 | } | 179 | } |
175 | } | 180 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs index e183f9d..6fd38e5 100644 --- a/OpenSim/Region/Framework/Scenes/EntityBase.cs +++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs | |||
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
69 | public bool IsDeleted | 69 | public bool IsDeleted |
70 | { | 70 | { |
71 | get { return m_isDeleted; } | 71 | get { return m_isDeleted; } |
72 | set { m_isDeleted = value; } | ||
72 | } | 73 | } |
73 | protected bool m_isDeleted; | 74 | protected bool m_isDeleted; |
74 | 75 | ||
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index 099fcce..0defa93 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs | |||
@@ -34,187 +34,89 @@ using OpenMetaverse; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Framework.Scenes | 35 | namespace OpenSim.Region.Framework.Scenes |
36 | { | 36 | { |
37 | public class EntityManager : IEnumerable<EntityBase> | 37 | public class EntityManager |
38 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); | 40 | private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>(); |
41 | private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>(); | ||
42 | //private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>(); | ||
43 | private readonly Object m_lock = new Object(); | ||
44 | 41 | ||
45 | [Obsolete("Use Add() instead.")] | 42 | public int Count |
46 | public void Add(UUID id, EntityBase eb) | ||
47 | { | 43 | { |
48 | Add(eb); | 44 | get { return m_entities.Count; } |
49 | } | 45 | } |
50 | 46 | ||
51 | public void Add(EntityBase entity) | 47 | public void Add(EntityBase entity) |
52 | { | 48 | { |
53 | lock (m_lock) | 49 | m_entities.Add(entity.UUID, entity.LocalId, entity); |
54 | { | ||
55 | try | ||
56 | { | ||
57 | m_eb_uuid.Add(entity.UUID, entity); | ||
58 | m_eb_localID.Add(entity.LocalId, entity); | ||
59 | } | ||
60 | catch(Exception e) | ||
61 | { | ||
62 | m_log.ErrorFormat("Add Entity failed: {0}", e.Message); | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | |||
67 | public void InsertOrReplace(EntityBase entity) | ||
68 | { | ||
69 | lock (m_lock) | ||
70 | { | ||
71 | try | ||
72 | { | ||
73 | m_eb_uuid[entity.UUID] = entity; | ||
74 | m_eb_localID[entity.LocalId] = entity; | ||
75 | } | ||
76 | catch(Exception e) | ||
77 | { | ||
78 | m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message); | ||
79 | } | ||
80 | } | ||
81 | } | 50 | } |
82 | 51 | ||
83 | public void Clear() | 52 | public void Clear() |
84 | { | 53 | { |
85 | lock (m_lock) | 54 | m_entities.Clear(); |
86 | { | ||
87 | m_eb_uuid.Clear(); | ||
88 | m_eb_localID.Clear(); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public int Count | ||
93 | { | ||
94 | get | ||
95 | { | ||
96 | return m_eb_uuid.Count; | ||
97 | } | ||
98 | } | 55 | } |
99 | 56 | ||
100 | public bool ContainsKey(UUID id) | 57 | public bool ContainsKey(UUID id) |
101 | { | 58 | { |
102 | try | 59 | return m_entities.ContainsKey(id); |
103 | { | ||
104 | return m_eb_uuid.ContainsKey(id); | ||
105 | } | ||
106 | catch | ||
107 | { | ||
108 | return false; | ||
109 | } | ||
110 | } | 60 | } |
111 | 61 | ||
112 | public bool ContainsKey(uint localID) | 62 | public bool ContainsKey(uint localID) |
113 | { | 63 | { |
114 | try | 64 | return m_entities.ContainsKey(localID); |
115 | { | ||
116 | return m_eb_localID.ContainsKey(localID); | ||
117 | } | ||
118 | catch | ||
119 | { | ||
120 | return false; | ||
121 | } | ||
122 | } | 65 | } |
123 | 66 | ||
124 | public bool Remove(uint localID) | 67 | public bool Remove(uint localID) |
125 | { | 68 | { |
126 | lock (m_lock) | 69 | return m_entities.Remove(localID); |
127 | { | ||
128 | try | ||
129 | { | ||
130 | bool a = false; | ||
131 | EntityBase entity; | ||
132 | if (m_eb_localID.TryGetValue(localID, out entity)) | ||
133 | a = m_eb_uuid.Remove(entity.UUID); | ||
134 | |||
135 | bool b = m_eb_localID.Remove(localID); | ||
136 | return a && b; | ||
137 | } | ||
138 | catch (Exception e) | ||
139 | { | ||
140 | m_log.ErrorFormat("Remove Entity failed for {0}", localID, e); | ||
141 | return false; | ||
142 | } | ||
143 | } | ||
144 | } | 70 | } |
145 | 71 | ||
146 | public bool Remove(UUID id) | 72 | public bool Remove(UUID id) |
147 | { | 73 | { |
148 | lock (m_lock) | 74 | return m_entities.Remove(id); |
149 | { | ||
150 | try | ||
151 | { | ||
152 | bool a = false; | ||
153 | EntityBase entity; | ||
154 | if (m_eb_uuid.TryGetValue(id, out entity)) | ||
155 | a = m_eb_localID.Remove(entity.LocalId); | ||
156 | |||
157 | bool b = m_eb_uuid.Remove(id); | ||
158 | return a && b; | ||
159 | } | ||
160 | catch (Exception e) | ||
161 | { | ||
162 | m_log.ErrorFormat("Remove Entity failed for {0}", id, e); | ||
163 | return false; | ||
164 | } | ||
165 | } | ||
166 | } | 75 | } |
167 | 76 | ||
168 | public List<EntityBase> GetAllByType<T>() | 77 | public EntityBase[] GetAllByType<T>() |
169 | { | 78 | { |
170 | List<EntityBase> tmp = new List<EntityBase>(); | 79 | List<EntityBase> tmp = new List<EntityBase>(); |
171 | 80 | ||
172 | lock (m_lock) | 81 | m_entities.ForEach( |
173 | { | 82 | delegate(EntityBase entity) |
174 | try | ||
175 | { | ||
176 | foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) | ||
177 | { | ||
178 | if (pair.Value is T) | ||
179 | { | ||
180 | tmp.Add(pair.Value); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | catch (Exception e) | ||
185 | { | 83 | { |
186 | m_log.ErrorFormat("GetAllByType failed for {0}", e); | 84 | if (entity is T) |
187 | tmp = null; | 85 | tmp.Add(entity); |
188 | } | 86 | } |
189 | } | 87 | ); |
190 | 88 | ||
191 | return tmp; | 89 | return tmp.ToArray(); |
192 | } | 90 | } |
193 | 91 | ||
194 | public List<EntityBase> GetEntities() | 92 | public EntityBase[] GetEntities() |
195 | { | 93 | { |
196 | lock (m_lock) | 94 | List<EntityBase> tmp = new List<EntityBase>(m_entities.Count); |
197 | { | 95 | m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); }); |
198 | return new List<EntityBase>(m_eb_uuid.Values); | 96 | return tmp.ToArray(); |
199 | } | 97 | } |
98 | |||
99 | public void ForEach(Action<EntityBase> action) | ||
100 | { | ||
101 | m_entities.ForEach(action); | ||
102 | } | ||
103 | |||
104 | public EntityBase Find(Predicate<EntityBase> predicate) | ||
105 | { | ||
106 | return m_entities.FindValue(predicate); | ||
200 | } | 107 | } |
201 | 108 | ||
202 | public EntityBase this[UUID id] | 109 | public EntityBase this[UUID id] |
203 | { | 110 | { |
204 | get | 111 | get |
205 | { | 112 | { |
206 | lock (m_lock) | 113 | EntityBase entity; |
207 | { | 114 | m_entities.TryGetValue(id, out entity); |
208 | EntityBase entity; | 115 | return entity; |
209 | if (m_eb_uuid.TryGetValue(id, out entity)) | ||
210 | return entity; | ||
211 | else | ||
212 | return null; | ||
213 | } | ||
214 | } | 116 | } |
215 | set | 117 | set |
216 | { | 118 | { |
217 | InsertOrReplace(value); | 119 | Add(value); |
218 | } | 120 | } |
219 | } | 121 | } |
220 | 122 | ||
@@ -222,50 +124,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
222 | { | 124 | { |
223 | get | 125 | get |
224 | { | 126 | { |
225 | lock (m_lock) | 127 | EntityBase entity; |
226 | { | 128 | m_entities.TryGetValue(localID, out entity); |
227 | EntityBase entity; | 129 | return entity; |
228 | if (m_eb_localID.TryGetValue(localID, out entity)) | ||
229 | return entity; | ||
230 | else | ||
231 | return null; | ||
232 | } | ||
233 | } | 130 | } |
234 | set | 131 | set |
235 | { | 132 | { |
236 | InsertOrReplace(value); | 133 | Add(value); |
237 | } | 134 | } |
238 | } | 135 | } |
239 | 136 | ||
240 | public bool TryGetValue(UUID key, out EntityBase obj) | 137 | public bool TryGetValue(UUID key, out EntityBase obj) |
241 | { | 138 | { |
242 | lock (m_lock) | 139 | return m_entities.TryGetValue(key, out obj); |
243 | { | ||
244 | return m_eb_uuid.TryGetValue(key, out obj); | ||
245 | } | ||
246 | } | 140 | } |
247 | 141 | ||
248 | public bool TryGetValue(uint key, out EntityBase obj) | 142 | public bool TryGetValue(uint key, out EntityBase obj) |
249 | { | 143 | { |
250 | lock (m_lock) | 144 | return m_entities.TryGetValue(key, out obj); |
251 | { | ||
252 | return m_eb_localID.TryGetValue(key, out obj); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | /// <summary> | ||
257 | /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. | ||
258 | /// </summary> | ||
259 | /// <returns></returns> | ||
260 | public IEnumerator<EntityBase> GetEnumerator() | ||
261 | { | ||
262 | return GetEntities().GetEnumerator(); | ||
263 | } | 145 | } |
264 | |||
265 | IEnumerator IEnumerable.GetEnumerator() | ||
266 | { | ||
267 | return GetEnumerator(); | ||
268 | } | ||
269 | |||
270 | } | 146 | } |
271 | } | 147 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 0ae3146..c434e4f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -109,6 +109,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | 109 | ||
110 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; | 110 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; |
111 | 111 | ||
112 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
113 | |||
112 | /// <summary> | 114 | /// <summary> |
113 | /// Fired when an object is touched/grabbed. | 115 | /// Fired when an object is touched/grabbed. |
114 | /// </summary> | 116 | /// </summary> |
@@ -682,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
682 | } | 684 | } |
683 | } | 685 | } |
684 | 686 | ||
685 | public void TriggerOnBackup(IRegionDataStore dstore) | 687 | public void TriggerOnBackup(IRegionDataStore dstore, bool forced) |
686 | { | 688 | { |
687 | OnBackupDelegate handlerOnAttach = OnBackup; | 689 | OnBackupDelegate handlerOnAttach = OnBackup; |
688 | if (handlerOnAttach != null) | 690 | if (handlerOnAttach != null) |
@@ -691,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
691 | { | 693 | { |
692 | try | 694 | try |
693 | { | 695 | { |
694 | d(dstore, false); | 696 | d(dstore, forced); |
695 | } | 697 | } |
696 | catch (Exception e) | 698 | catch (Exception e) |
697 | { | 699 | { |
@@ -2104,5 +2106,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2104 | } | 2106 | } |
2105 | } | 2107 | } |
2106 | } | 2108 | } |
2109 | |||
2110 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, | ||
2111 | int local_id, IClientAPI remote_client) | ||
2112 | { | ||
2113 | ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest; | ||
2114 | if (handler != null) | ||
2115 | { | ||
2116 | foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList()) | ||
2117 | { | ||
2118 | try | ||
2119 | { | ||
2120 | d(args, local_id, remote_client); | ||
2121 | } | ||
2122 | catch (Exception e) | ||
2123 | { | ||
2124 | m_log.ErrorFormat( | ||
2125 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", | ||
2126 | e.Message, e.StackTrace); | ||
2127 | } | ||
2128 | } | ||
2129 | } | ||
2130 | } | ||
2107 | } | 2131 | } |
2108 | } \ No newline at end of file | 2132 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4e871d9..a439eb9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
58 | { | 58 | { |
59 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); | 59 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); |
60 | 60 | ||
61 | foreach (EntityBase group in Entities) | 61 | EntityBase[] entities = Entities.GetEntities(); |
62 | foreach (EntityBase group in entities) | ||
62 | { | 63 | { |
63 | if (group is SceneObjectGroup) | 64 | if (group is SceneObjectGroup) |
64 | { | 65 | { |
@@ -1720,7 +1721,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1720 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, | 1721 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, |
1721 | UUID groupID, DeRezAction action, UUID destinationID) | 1722 | UUID groupID, DeRezAction action, UUID destinationID) |
1722 | { | 1723 | { |
1723 | DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID); | 1724 | DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID); |
1724 | } | 1725 | } |
1725 | 1726 | ||
1726 | public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, | 1727 | public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, |
@@ -1757,11 +1758,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1757 | deleteIDs.Add(localID); | 1758 | deleteIDs.Add(localID); |
1758 | deleteGroups.Add(grp); | 1759 | deleteGroups.Add(grp); |
1759 | 1760 | ||
1760 | // Force a database backup/update on this SceneObjectGroup | ||
1761 | // So that we know the database is upto date, | ||
1762 | // for when deleting the object from it | ||
1763 | ForceSceneObjectBackup(grp); | ||
1764 | |||
1765 | if (remoteClient == null) | 1761 | if (remoteClient == null) |
1766 | { | 1762 | { |
1767 | // Autoreturn has a null client. Nothing else does. So | 1763 | // Autoreturn has a null client. Nothing else does. So |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c511774..2f69476 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | /// <param name="remoteClient"></param> | 116 | /// <param name="remoteClient"></param> |
117 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) | 117 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) |
118 | { | 118 | { |
119 | List<EntityBase> EntityList = GetEntities(); | 119 | EntityBase[] entityList = GetEntities(); |
120 | 120 | foreach (EntityBase ent in entityList) | |
121 | foreach (EntityBase ent in EntityList) | ||
122 | { | 121 | { |
123 | if (ent is SceneObjectGroup) | 122 | if (ent is SceneObjectGroup) |
124 | { | 123 | { |
@@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
138 | /// <param name="remoteClient"></param> | 137 | /// <param name="remoteClient"></param> |
139 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 138 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) |
140 | { | 139 | { |
141 | List<EntityBase> EntityList = GetEntities(); | 140 | EntityBase[] entityList = GetEntities(); |
142 | 141 | foreach (EntityBase ent in entityList) | |
143 | foreach (EntityBase ent in EntityList) | ||
144 | { | 142 | { |
145 | if (ent is SceneObjectGroup) | 143 | if (ent is SceneObjectGroup) |
146 | { | 144 | { |
@@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | 257 | ||
260 | public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 258 | public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
261 | { | 259 | { |
262 | List<EntityBase> EntityList = GetEntities(); | 260 | EntityBase[] EntityList = GetEntities(); |
263 | 261 | ||
264 | SurfaceTouchEventArgs surfaceArg = null; | 262 | SurfaceTouchEventArgs surfaceArg = null; |
265 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 263 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
@@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
303 | 301 | ||
304 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 302 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
305 | { | 303 | { |
306 | List<EntityBase> EntityList = GetEntities(); | 304 | EntityBase[] EntityList = GetEntities(); |
307 | 305 | ||
308 | SurfaceTouchEventArgs surfaceArg = null; | 306 | SurfaceTouchEventArgs surfaceArg = null; |
309 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 307 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
343 | 341 | ||
344 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 342 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
345 | { | 343 | { |
346 | List<EntityBase> EntityList = GetEntities(); | 344 | EntityBase[] EntityList = GetEntities(); |
347 | 345 | ||
348 | SurfaceTouchEventArgs surfaceArg = null; | 346 | SurfaceTouchEventArgs surfaceArg = null; |
349 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 347 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 56ac2c2..7ce95a7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1029,29 +1029,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1029 | if (ScriptEngine) | 1029 | if (ScriptEngine) |
1030 | { | 1030 | { |
1031 | m_log.Info("Stopping all Scripts in Scene"); | 1031 | m_log.Info("Stopping all Scripts in Scene"); |
1032 | foreach (EntityBase ent in Entities) | 1032 | |
1033 | EntityBase[] entities = Entities.GetEntities(); | ||
1034 | foreach (EntityBase ent in entities) | ||
1033 | { | 1035 | { |
1034 | if (ent is SceneObjectGroup) | 1036 | if (ent is SceneObjectGroup) |
1035 | { | 1037 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); |
1036 | ((SceneObjectGroup) ent).RemoveScriptInstances(false); | ||
1037 | } | ||
1038 | } | 1038 | } |
1039 | } | 1039 | } |
1040 | else | 1040 | else |
1041 | { | 1041 | { |
1042 | m_log.Info("Starting all Scripts in Scene"); | 1042 | m_log.Info("Starting all Scripts in Scene"); |
1043 | lock (Entities) | 1043 | |
1044 | EntityBase[] entities = Entities.GetEntities(); | ||
1045 | foreach (EntityBase ent in entities) | ||
1044 | { | 1046 | { |
1045 | foreach (EntityBase ent in Entities) | 1047 | if (ent is SceneObjectGroup) |
1046 | { | 1048 | { |
1047 | if (ent is SceneObjectGroup) | 1049 | SceneObjectGroup sog = (SceneObjectGroup)ent; |
1048 | { | 1050 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
1049 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1051 | sog.ResumeScripts(); |
1050 | ((SceneObjectGroup)ent).ResumeScripts(); | ||
1051 | } | ||
1052 | } | 1052 | } |
1053 | } | 1053 | } |
1054 | } | 1054 | } |
1055 | |||
1055 | m_scripts_enabled = !ScriptEngine; | 1056 | m_scripts_enabled = !ScriptEngine; |
1056 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); | 1057 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); |
1057 | } | 1058 | } |
@@ -1098,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1098 | shuttingdown = true; | 1099 | shuttingdown = true; |
1099 | 1100 | ||
1100 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1101 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1101 | List<EntityBase> entities = GetEntities(); | 1102 | EntityBase[] entities = GetEntities(); |
1102 | foreach (EntityBase entity in entities) | 1103 | foreach (EntityBase entity in entities) |
1103 | { | 1104 | { |
1104 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) | 1105 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) |
@@ -1528,18 +1529,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1528 | /// </summary> | 1529 | /// </summary> |
1529 | private void BackupWaitCallback(object o) | 1530 | private void BackupWaitCallback(object o) |
1530 | { | 1531 | { |
1531 | Backup(); | 1532 | Backup(false); |
1532 | } | 1533 | } |
1533 | 1534 | ||
1534 | /// <summary> | 1535 | /// <summary> |
1535 | /// Backup the scene. This acts as the main method of the backup thread. | 1536 | /// Backup the scene. This acts as the main method of the backup thread. |
1536 | /// </summary> | 1537 | /// </summary> |
1538 | /// <param name="forced"> | ||
1539 | /// If true, then any changes that have not yet been persisted are persisted. If false, | ||
1540 | /// then the persistence decision is left to the backup code (in some situations, such as object persistence, | ||
1541 | /// it's much more efficient to backup multiple changes at once rather than every single one). | ||
1537 | /// <returns></returns> | 1542 | /// <returns></returns> |
1538 | public void Backup() | 1543 | public void Backup(bool forced) |
1539 | { | 1544 | { |
1540 | lock (m_returns) | 1545 | lock (m_returns) |
1541 | { | 1546 | { |
1542 | EventManager.TriggerOnBackup(m_storageManager.DataStore); | 1547 | EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); |
1543 | m_backingup = false; | 1548 | m_backingup = false; |
1544 | 1549 | ||
1545 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) | 1550 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) |
@@ -2033,8 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2033 | { | 2038 | { |
2034 | lock (Entities) | 2039 | lock (Entities) |
2035 | { | 2040 | { |
2036 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2041 | EntityBase[] entities = Entities.GetEntities(); |
2037 | |||
2038 | foreach (EntityBase e in entities) | 2042 | foreach (EntityBase e in entities) |
2039 | { | 2043 | { |
2040 | if (e is SceneObjectGroup) | 2044 | if (e is SceneObjectGroup) |
@@ -2088,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2088 | // rootPart.PhysActor = null; | 2092 | // rootPart.PhysActor = null; |
2089 | // } | 2093 | // } |
2090 | 2094 | ||
2091 | if (UnlinkSceneObject(group.UUID, false)) | 2095 | if (UnlinkSceneObject(group, false)) |
2092 | { | 2096 | { |
2093 | EventManager.TriggerObjectBeingRemovedFromScene(group); | 2097 | EventManager.TriggerObjectBeingRemovedFromScene(group); |
2094 | EventManager.TriggerParcelPrimCountTainted(); | 2098 | EventManager.TriggerParcelPrimCountTainted(); |
@@ -2103,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2103 | /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the | 2107 | /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the |
2104 | /// object itself is not destroyed. | 2108 | /// object itself is not destroyed. |
2105 | /// </summary> | 2109 | /// </summary> |
2106 | /// <param name="uuid">Id of object.</param> | 2110 | /// <param name="so">The scene object.</param> |
2111 | /// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param> | ||
2107 | /// <returns>true if the object was in the scene, false if it was not</returns> | 2112 | /// <returns>true if the object was in the scene, false if it was not</returns> |
2108 | /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> | 2113 | public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete) |
2109 | public bool UnlinkSceneObject(UUID uuid, bool softDelete) | ||
2110 | { | 2114 | { |
2111 | if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) | 2115 | if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete)) |
2112 | { | 2116 | { |
2113 | if (!softDelete) | 2117 | if (!softDelete) |
2114 | { | 2118 | { |
2115 | m_storageManager.DataStore.RemoveObject(uuid, | 2119 | // Force a database update so that the scene object group ID is accurate. It's possible that the |
2116 | m_regInfo.RegionID); | 2120 | // group has recently been delinked from another group but that this change has not been persisted |
2121 | // to the DB. | ||
2122 | ForceSceneObjectBackup(so); | ||
2123 | so.DetachFromBackup(); | ||
2124 | m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); | ||
2117 | } | 2125 | } |
2126 | |||
2127 | // We need to keep track of this state in case this group is still queued for further backup. | ||
2128 | so.IsDeleted = true; | ||
2118 | 2129 | ||
2119 | return true; | 2130 | return true; |
2120 | } | 2131 | } |
@@ -2145,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2145 | } | 2156 | } |
2146 | catch (Exception) | 2157 | catch (Exception) |
2147 | { | 2158 | { |
2148 | m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); | 2159 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); |
2149 | } | 2160 | } |
2150 | return; | 2161 | return; |
2151 | } | 2162 | } |
@@ -2162,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2162 | } | 2173 | } |
2163 | catch (Exception) | 2174 | catch (Exception) |
2164 | { | 2175 | { |
2165 | m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); | 2176 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); |
2166 | } | 2177 | } |
2167 | return; | 2178 | return; |
2168 | } | 2179 | } |
@@ -2643,6 +2654,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2643 | try | 2654 | try |
2644 | { | 2655 | { |
2645 | ScenePresence sp = GetScenePresence(agentID); | 2656 | ScenePresence sp = GetScenePresence(agentID); |
2657 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | ||
2658 | |||
2646 | if (sp != null) | 2659 | if (sp != null) |
2647 | sp.ControllingClient.Close(); | 2660 | sp.ControllingClient.Close(); |
2648 | 2661 | ||
@@ -3964,9 +3977,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3964 | /// </summary> | 3977 | /// </summary> |
3965 | public void ForceClientUpdate() | 3978 | public void ForceClientUpdate() |
3966 | { | 3979 | { |
3967 | List<EntityBase> EntityList = GetEntities(); | 3980 | EntityBase[] entityList = GetEntities(); |
3968 | 3981 | foreach (EntityBase ent in entityList) | |
3969 | foreach (EntityBase ent in EntityList) | ||
3970 | { | 3982 | { |
3971 | if (ent is SceneObjectGroup) | 3983 | if (ent is SceneObjectGroup) |
3972 | { | 3984 | { |
@@ -3984,9 +3996,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3984 | { | 3996 | { |
3985 | m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); | 3997 | m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); |
3986 | 3998 | ||
3987 | List<EntityBase> EntityList = GetEntities(); | 3999 | EntityBase[] entityList = GetEntities(); |
3988 | 4000 | foreach (EntityBase ent in entityList) | |
3989 | foreach (EntityBase ent in EntityList) | ||
3990 | { | 4001 | { |
3991 | if (ent is SceneObjectGroup) | 4002 | if (ent is SceneObjectGroup) |
3992 | { | 4003 | { |
@@ -4355,7 +4366,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4355 | /// will not affect the original list of objects in the scene. | 4366 | /// will not affect the original list of objects in the scene. |
4356 | /// </summary> | 4367 | /// </summary> |
4357 | /// <returns></returns> | 4368 | /// <returns></returns> |
4358 | public List<EntityBase> GetEntities() | 4369 | public EntityBase[] GetEntities() |
4359 | { | 4370 | { |
4360 | return m_sceneGraph.GetEntities(); | 4371 | return m_sceneGraph.GetEntities(); |
4361 | } | 4372 | } |
@@ -4389,9 +4400,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4389 | 4400 | ||
4390 | public void CleanTempObjects() | 4401 | public void CleanTempObjects() |
4391 | { | 4402 | { |
4392 | List<EntityBase> objs = GetEntities(); | 4403 | EntityBase[] entities = GetEntities(); |
4393 | 4404 | foreach (EntityBase obj in entities) | |
4394 | foreach (EntityBase obj in objs) | ||
4395 | { | 4405 | { |
4396 | if (obj is SceneObjectGroup) | 4406 | if (obj is SceneObjectGroup) |
4397 | { | 4407 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e7175c5..f779a6d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -72,10 +72,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
72 | protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); | 72 | protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); |
73 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); | 73 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); |
74 | 74 | ||
75 | // SceneObjects is not currently populated or used. | ||
76 | //public Dictionary<UUID, SceneObjectGroup> SceneObjects; | ||
77 | protected internal EntityManager Entities = new EntityManager(); | 75 | protected internal EntityManager Entities = new EntityManager(); |
78 | // protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>(); | ||
79 | protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); | 76 | protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); |
80 | 77 | ||
81 | protected RegionInfo m_regInfo; | 78 | protected RegionInfo m_regInfo; |
@@ -348,68 +345,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
348 | if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) | 345 | if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) |
349 | return false; | 346 | return false; |
350 | 347 | ||
351 | lock (sceneObject) | 348 | if (Entities.ContainsKey(sceneObject.UUID)) |
352 | { | 349 | return false; |
353 | if (Entities.ContainsKey(sceneObject.UUID)) | 350 | |
354 | { | 351 | List<SceneObjectPart> children; |
355 | // m_log.WarnFormat( | 352 | lock (sceneObject.Children) |
356 | // "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", | 353 | children = new List<SceneObjectPart>(sceneObject.Children.Values); |
357 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); | 354 | |
358 | return false; | 355 | // Clamp child prim sizes and add child prims to the m_numPrim count |
359 | } | 356 | if (m_parentScene.m_clampPrimSize) |
360 | 357 | { | |
361 | // m_log.DebugFormat( | 358 | foreach (SceneObjectPart part in children) |
362 | // "[SCENE GRAPH]: Adding object {0} {1} to region {2}", | ||
363 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); | ||
364 | |||
365 | lock (sceneObject.Children) | ||
366 | { | 359 | { |
367 | if (m_parentScene.m_clampPrimSize) | 360 | Vector3 scale = part.Shape.Scale; |
368 | { | 361 | |
369 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 362 | if (scale.X > m_parentScene.m_maxNonphys) |
370 | { | 363 | scale.X = m_parentScene.m_maxNonphys; |
371 | Vector3 scale = part.Shape.Scale; | 364 | if (scale.Y > m_parentScene.m_maxNonphys) |
372 | 365 | scale.Y = m_parentScene.m_maxNonphys; | |
373 | if (scale.X > m_parentScene.m_maxNonphys) | 366 | if (scale.Z > m_parentScene.m_maxNonphys) |
374 | scale.X = m_parentScene.m_maxNonphys; | 367 | scale.Z = m_parentScene.m_maxNonphys; |
375 | if (scale.Y > m_parentScene.m_maxNonphys) | 368 | |
376 | scale.Y = m_parentScene.m_maxNonphys; | 369 | part.Shape.Scale = scale; |
377 | if (scale.Z > m_parentScene.m_maxNonphys) | ||
378 | scale.Z = m_parentScene.m_maxNonphys; | ||
379 | |||
380 | part.Shape.Scale = scale; | ||
381 | } | ||
382 | } | ||
383 | |||
384 | m_numPrim += sceneObject.Children.Count; | ||
385 | } | 370 | } |
386 | 371 | } | |
387 | sceneObject.AttachToScene(m_parentScene); | 372 | m_numPrim += children.Count; |
388 | 373 | ||
389 | if (sendClientUpdates) | 374 | sceneObject.AttachToScene(m_parentScene); |
390 | sceneObject.ScheduleGroupForFullUpdate(); | ||
391 | |||
392 | Entities.Add(sceneObject); | ||
393 | 375 | ||
394 | if (attachToBackup) | 376 | if (sendClientUpdates) |
395 | sceneObject.AttachToBackup(); | 377 | sceneObject.ScheduleGroupForFullUpdate(); |
396 | 378 | ||
397 | if (OnObjectCreate != null) | 379 | Entities.Add(sceneObject); |
398 | OnObjectCreate(sceneObject); | 380 | |
399 | 381 | if (attachToBackup) | |
400 | lock (SceneObjectGroupsByFullID) | 382 | sceneObject.AttachToBackup(); |
401 | { | 383 | |
402 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 384 | if (OnObjectCreate != null) |
403 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 385 | OnObjectCreate(sceneObject); |
404 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | 386 | |
405 | } | 387 | lock (SceneObjectGroupsByFullID) |
406 | 388 | { | |
407 | lock (SceneObjectGroupsByLocalID) | 389 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
408 | { | 390 | foreach (SceneObjectPart part in children) |
409 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | 391 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; |
410 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 392 | } |
411 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | 393 | |
412 | } | 394 | lock (SceneObjectGroupsByLocalID) |
395 | { | ||
396 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
397 | foreach (SceneObjectPart part in children) | ||
398 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | ||
413 | } | 399 | } |
414 | 400 | ||
415 | return true; | 401 | return true; |
@@ -421,42 +407,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> | 407 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> |
422 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) | 408 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) |
423 | { | 409 | { |
424 | if (Entities.ContainsKey(uuid)) | 410 | EntityBase entity; |
425 | { | 411 | if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) |
426 | SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; | 412 | return false; |
427 | 413 | ||
428 | if (!resultOfObjectLinked) | 414 | SceneObjectGroup grp = (SceneObjectGroup)entity; |
429 | { | ||
430 | m_numPrim -= grp.PrimCount; | ||
431 | 415 | ||
432 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 416 | if (!resultOfObjectLinked) |
433 | RemovePhysicalPrim(grp.PrimCount); | 417 | { |
434 | } | 418 | m_numPrim -= grp.PrimCount; |
435 | 419 | ||
436 | if (OnObjectRemove != null) | 420 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
437 | OnObjectRemove(Entities[uuid]); | 421 | RemovePhysicalPrim(grp.PrimCount); |
422 | } | ||
438 | 423 | ||
439 | lock (SceneObjectGroupsByFullID) | 424 | if (OnObjectRemove != null) |
440 | { | 425 | OnObjectRemove(Entities[uuid]); |
441 | foreach (SceneObjectPart part in grp.Children.Values) | ||
442 | SceneObjectGroupsByFullID.Remove(part.UUID); | ||
443 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | ||
444 | } | ||
445 | lock (SceneObjectGroupsByLocalID) | ||
446 | { | ||
447 | foreach (SceneObjectPart part in grp.Children.Values) | ||
448 | SceneObjectGroupsByLocalID.Remove(part.LocalId); | ||
449 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | ||
450 | } | ||
451 | 426 | ||
452 | Entities.Remove(uuid); | 427 | lock (SceneObjectGroupsByFullID) |
453 | //SceneObjectGroup part; | 428 | { |
454 | //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 429 | foreach (SceneObjectPart part in grp.Children.Values) |
430 | SceneObjectGroupsByFullID.Remove(part.UUID); | ||
431 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | ||
432 | } | ||
455 | 433 | ||
456 | return true; | 434 | lock (SceneObjectGroupsByLocalID) |
435 | { | ||
436 | foreach (SceneObjectPart part in grp.Children.Values) | ||
437 | SceneObjectGroupsByLocalID.Remove(part.LocalId); | ||
438 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | ||
457 | } | 439 | } |
458 | 440 | ||
459 | return false; | 441 | return Entities.Remove(uuid); |
460 | } | 442 | } |
461 | 443 | ||
462 | /// <summary> | 444 | /// <summary> |
@@ -468,9 +450,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
468 | protected internal void AddToUpdateList(SceneObjectGroup obj) | 450 | protected internal void AddToUpdateList(SceneObjectGroup obj) |
469 | { | 451 | { |
470 | lock (m_updateList) | 452 | lock (m_updateList) |
471 | { | ||
472 | m_updateList[obj.UUID] = obj; | 453 | m_updateList[obj.UUID] = obj; |
473 | } | ||
474 | } | 454 | } |
475 | 455 | ||
476 | /// <summary> | 456 | /// <summary> |
@@ -480,34 +460,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
480 | { | 460 | { |
481 | if (!Monitor.TryEnter(m_updateLock)) | 461 | if (!Monitor.TryEnter(m_updateLock)) |
482 | return; | 462 | return; |
483 | 463 | try | |
484 | List<SceneObjectGroup> updates; | ||
485 | |||
486 | // Some updates add more updates to the updateList. | ||
487 | // Get the current list of updates and clear the list before iterating | ||
488 | lock (m_updateList) | ||
489 | { | ||
490 | updates = new List<SceneObjectGroup>(m_updateList.Values); | ||
491 | m_updateList.Clear(); | ||
492 | } | ||
493 | |||
494 | // Go through all updates | ||
495 | for (int i = 0; i < updates.Count; i++) | ||
496 | { | 464 | { |
497 | SceneObjectGroup sog = updates[i]; | 465 | List<SceneObjectGroup> updates; |
498 | 466 | ||
499 | // Don't abort the whole update if one entity happens to give us an exception. | 467 | // Some updates add more updates to the updateList. |
500 | try | 468 | // Get the current list of updates and clear the list before iterating |
469 | lock (m_updateList) | ||
501 | { | 470 | { |
502 | sog.Update(); | 471 | updates = new List<SceneObjectGroup>(m_updateList.Values); |
472 | m_updateList.Clear(); | ||
503 | } | 473 | } |
504 | catch (Exception e) | 474 | |
475 | // Go through all updates | ||
476 | for (int i = 0; i < updates.Count; i++) | ||
505 | { | 477 | { |
506 | m_log.ErrorFormat( | 478 | SceneObjectGroup sog = updates[i]; |
507 | "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); | 479 | |
480 | // Don't abort the whole update if one entity happens to give us an exception. | ||
481 | try | ||
482 | { | ||
483 | sog.Update(); | ||
484 | } | ||
485 | catch (Exception e) | ||
486 | { | ||
487 | m_log.ErrorFormat( | ||
488 | "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); | ||
489 | } | ||
508 | } | 490 | } |
509 | } | 491 | } |
510 | Monitor.Exit(m_updateLock); | 492 | finally |
493 | { | ||
494 | Monitor.Exit(m_updateLock); | ||
495 | } | ||
511 | } | 496 | } |
512 | 497 | ||
513 | protected internal void AddPhysicalPrim(int number) | 498 | protected internal void AddPhysicalPrim(int number) |
@@ -864,38 +849,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
864 | /// <returns>null if no scene object group containing that prim is found</returns> | 849 | /// <returns>null if no scene object group containing that prim is found</returns> |
865 | public SceneObjectGroup GetGroupByPrim(uint localID) | 850 | public SceneObjectGroup GetGroupByPrim(uint localID) |
866 | { | 851 | { |
867 | if (Entities.ContainsKey(localID)) | 852 | EntityBase entity; |
868 | return Entities[localID] as SceneObjectGroup; | 853 | if (Entities.TryGetValue(localID, out entity)) |
854 | return entity as SceneObjectGroup; | ||
869 | 855 | ||
870 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); | 856 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); |
871 | SceneObjectGroup sog; | 857 | SceneObjectGroup sog; |
872 | lock (SceneObjectGroupsByLocalID) | 858 | lock (SceneObjectGroupsByLocalID) |
859 | SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); | ||
860 | |||
861 | if (sog != null) | ||
873 | { | 862 | { |
874 | if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) | 863 | if (sog.HasChildPrim(localID)) |
875 | { | 864 | return sog; |
876 | if (sog.HasChildPrim(localID)) | 865 | SceneObjectGroupsByLocalID.Remove(localID); |
877 | return sog; | ||
878 | SceneObjectGroupsByLocalID.Remove(localID); | ||
879 | } | ||
880 | } | 866 | } |
881 | 867 | ||
882 | List<EntityBase> EntityList = GetEntities(); | 868 | EntityBase[] entityList = GetEntities(); |
883 | foreach (EntityBase ent in EntityList) | 869 | foreach (EntityBase ent in entityList) |
884 | { | 870 | { |
885 | //m_log.DebugFormat("Looking at entity {0}", ent.UUID); | 871 | //m_log.DebugFormat("Looking at entity {0}", ent.UUID); |
886 | if (ent is SceneObjectGroup) | 872 | if (ent is SceneObjectGroup) |
887 | { | 873 | { |
888 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) | 874 | sog = (SceneObjectGroup)ent; |
875 | if (sog.HasChildPrim(localID)) | ||
889 | { | 876 | { |
890 | sog = (SceneObjectGroup)ent; | ||
891 | lock (SceneObjectGroupsByLocalID) | 877 | lock (SceneObjectGroupsByLocalID) |
892 | { | ||
893 | SceneObjectGroupsByLocalID[localID] = sog; | 878 | SceneObjectGroupsByLocalID[localID] = sog; |
894 | } | ||
895 | return sog; | 879 | return sog; |
896 | } | 880 | } |
897 | } | 881 | } |
898 | } | 882 | } |
883 | |||
899 | return null; | 884 | return null; |
900 | } | 885 | } |
901 | 886 | ||
@@ -908,36 +893,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
908 | { | 893 | { |
909 | SceneObjectGroup sog; | 894 | SceneObjectGroup sog; |
910 | lock (SceneObjectGroupsByFullID) | 895 | lock (SceneObjectGroupsByFullID) |
896 | SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); | ||
897 | |||
898 | if (sog != null) | ||
911 | { | 899 | { |
912 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) | 900 | lock (sog.Children) |
913 | { | 901 | { |
914 | lock (sog.Children) | 902 | if (sog.Children.ContainsKey(fullID)) |
915 | { | 903 | return sog; |
916 | if (sog.Children.ContainsKey(fullID)) | ||
917 | return sog; | ||
918 | } | ||
919 | |||
920 | SceneObjectGroupsByFullID.Remove(fullID); | ||
921 | } | 904 | } |
922 | } | ||
923 | 905 | ||
924 | List<EntityBase> EntityList = GetEntities(); | 906 | lock (SceneObjectGroupsByFullID) |
907 | SceneObjectGroupsByFullID.Remove(fullID); | ||
908 | } | ||
925 | 909 | ||
926 | foreach (EntityBase ent in EntityList) | 910 | EntityBase[] entityList = GetEntities(); |
911 | foreach (EntityBase ent in entityList) | ||
927 | { | 912 | { |
928 | if (ent is SceneObjectGroup) | 913 | if (ent is SceneObjectGroup) |
929 | { | 914 | { |
930 | if (((SceneObjectGroup)ent).HasChildPrim(fullID)) | 915 | sog = (SceneObjectGroup)ent; |
916 | if (sog.HasChildPrim(fullID)) | ||
931 | { | 917 | { |
932 | sog = (SceneObjectGroup)ent; | ||
933 | lock (SceneObjectGroupsByFullID) | 918 | lock (SceneObjectGroupsByFullID) |
934 | { | ||
935 | SceneObjectGroupsByFullID[fullID] = sog; | 919 | SceneObjectGroupsByFullID[fullID] = sog; |
936 | } | ||
937 | return sog; | 920 | return sog; |
938 | } | 921 | } |
939 | } | 922 | } |
940 | } | 923 | } |
924 | |||
941 | return null; | 925 | return null; |
942 | } | 926 | } |
943 | 927 | ||
@@ -946,7 +930,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
946 | // Primitive Ray Tracing | 930 | // Primitive Ray Tracing |
947 | float closestDistance = 280f; | 931 | float closestDistance = 280f; |
948 | EntityIntersection result = new EntityIntersection(); | 932 | EntityIntersection result = new EntityIntersection(); |
949 | List<EntityBase> EntityList = GetEntities(); | 933 | EntityBase[] EntityList = GetEntities(); |
950 | foreach (EntityBase ent in EntityList) | 934 | foreach (EntityBase ent in EntityList) |
951 | { | 935 | { |
952 | if (ent is SceneObjectGroup) | 936 | if (ent is SceneObjectGroup) |
@@ -984,23 +968,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
984 | /// <returns>null if the part was not found</returns> | 968 | /// <returns>null if the part was not found</returns> |
985 | protected internal SceneObjectPart GetSceneObjectPart(string name) | 969 | protected internal SceneObjectPart GetSceneObjectPart(string name) |
986 | { | 970 | { |
987 | List<EntityBase> EntityList = GetEntities(); | 971 | SceneObjectPart sop = null; |
988 | 972 | ||
989 | // FIXME: use a dictionary here | 973 | Entities.Find( |
990 | foreach (EntityBase ent in EntityList) | 974 | delegate(EntityBase entity) |
991 | { | ||
992 | if (ent is SceneObjectGroup) | ||
993 | { | 975 | { |
994 | foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) | 976 | if (entity is SceneObjectGroup) |
995 | { | 977 | { |
996 | if (p.Name == name) | 978 | foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts()) |
997 | { | 979 | { |
998 | return p; | 980 | if (p.Name == name) |
981 | { | ||
982 | sop = p; | ||
983 | return true; | ||
984 | } | ||
999 | } | 985 | } |
1000 | } | 986 | } |
987 | |||
988 | return false; | ||
1001 | } | 989 | } |
1002 | } | 990 | ); |
1003 | return null; | 991 | |
992 | return sop; | ||
1004 | } | 993 | } |
1005 | 994 | ||
1006 | /// <summary> | 995 | /// <summary> |
@@ -1021,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1021 | /// it | 1010 | /// it |
1022 | /// </summary> | 1011 | /// </summary> |
1023 | /// <returns></returns> | 1012 | /// <returns></returns> |
1024 | protected internal List<EntityBase> GetEntities() | 1013 | protected internal EntityBase[] GetEntities() |
1025 | { | 1014 | { |
1026 | return Entities.GetEntities(); | 1015 | return Entities.GetEntities(); |
1027 | } | 1016 | } |
@@ -1030,7 +1019,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1030 | { | 1019 | { |
1031 | Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); | 1020 | Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); |
1032 | 1021 | ||
1033 | List<EntityBase> EntityList = GetEntities(); | 1022 | EntityBase[] EntityList = GetEntities(); |
1034 | int limit = 0; | 1023 | int limit = 0; |
1035 | foreach (EntityBase ent in EntityList) | 1024 | foreach (EntityBase ent in EntityList) |
1036 | { | 1025 | { |
@@ -1632,6 +1621,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1632 | // Unlink all child parts from their groups | 1621 | // Unlink all child parts from their groups |
1633 | // | 1622 | // |
1634 | child.ParentGroup.DelinkFromGroup(child, true); | 1623 | child.ParentGroup.DelinkFromGroup(child, true); |
1624 | |||
1625 | // These are not in affected groups and will not be | ||
1626 | // handled further. Do the honors here. | ||
1627 | child.ParentGroup.HasGroupChanged = true; | ||
1628 | child.ParentGroup.ScheduleGroupForFullUpdate(); | ||
1635 | } | 1629 | } |
1636 | 1630 | ||
1637 | foreach (SceneObjectPart root in rootParts) | 1631 | foreach (SceneObjectPart root in rootParts) |
@@ -1721,8 +1715,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1721 | UUID objid = UUID.Zero; | 1715 | UUID objid = UUID.Zero; |
1722 | SceneObjectPart obj = null; | 1716 | SceneObjectPart obj = null; |
1723 | 1717 | ||
1724 | List<EntityBase> EntityList = GetEntities(); | 1718 | EntityBase[] entityList = GetEntities(); |
1725 | foreach (EntityBase ent in EntityList) | 1719 | foreach (EntityBase ent in entityList) |
1726 | { | 1720 | { |
1727 | if (ent is SceneObjectGroup) | 1721 | if (ent is SceneObjectGroup) |
1728 | { | 1722 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 3b84734..86ba2aa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
300 | 300 | ||
301 | public void BackupCurrentScene() | 301 | public void BackupCurrentScene() |
302 | { | 302 | { |
303 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); | 303 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); }); |
304 | } | 304 | } |
305 | 305 | ||
306 | public bool TrySetCurrentScene(string regionName) | 306 | public bool TrySetCurrentScene(string regionName) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 64a6dd5..ba5e33c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1226,16 +1226,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | /// <summary> | 1228 | /// <summary> |
1229 | /// Delete this group from its scene and tell all the scene presences about that deletion. | 1229 | /// Delete this group from its scene. |
1230 | /// </summary> | 1230 | /// </summary> |
1231 | /// <param name="silent">Broadcast deletions to all clients.</param> | 1231 | /// |
1232 | /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood | ||
1233 | /// up and all avatars receive notification of its removal. Removal of the scene object from database backup | ||
1234 | /// must be handled by the caller. | ||
1235 | /// | ||
1236 | /// <param name="silent">If true then deletion is not broadcast to clients</param> | ||
1232 | public void DeleteGroup(bool silent) | 1237 | public void DeleteGroup(bool silent) |
1233 | { | 1238 | { |
1234 | // We need to keep track of this state in case this group is still queued for backup. | ||
1235 | m_isDeleted = true; | ||
1236 | |||
1237 | DetachFromBackup(); | ||
1238 | |||
1239 | lock (m_parts) | 1239 | lock (m_parts) |
1240 | { | 1240 | { |
1241 | foreach (SceneObjectPart part in m_parts.Values) | 1241 | foreach (SceneObjectPart part in m_parts.Values) |
@@ -1381,14 +1381,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1381 | public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) | 1381 | public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) |
1382 | { | 1382 | { |
1383 | if (!m_isBackedUp) | 1383 | if (!m_isBackedUp) |
1384 | { | ||
1385 | // m_log.DebugFormat( | ||
1386 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); | ||
1384 | return; | 1387 | return; |
1385 | 1388 | } | |
1386 | // Since this is the top of the section of call stack for backing up a particular scene object, don't let | ||
1387 | // any exception propogate upwards. | ||
1388 | 1389 | ||
1389 | if (IsDeleted || UUID == UUID.Zero) | 1390 | if (IsDeleted || UUID == UUID.Zero) |
1391 | { | ||
1392 | // m_log.DebugFormat( | ||
1393 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID); | ||
1390 | return; | 1394 | return; |
1395 | } | ||
1391 | 1396 | ||
1397 | // Since this is the top of the section of call stack for backing up a particular scene object, don't let | ||
1398 | // any exception propogate upwards. | ||
1392 | try | 1399 | try |
1393 | { | 1400 | { |
1394 | if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart | 1401 | if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart |
@@ -1421,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1421 | if (HasGroupChanged) | 1428 | if (HasGroupChanged) |
1422 | { | 1429 | { |
1423 | // don't backup while it's selected or you're asking for changes mid stream. | 1430 | // don't backup while it's selected or you're asking for changes mid stream. |
1424 | if ((isTimeToPersist()) || (forcedBackup)) | 1431 | if (isTimeToPersist() || forcedBackup) |
1425 | { | 1432 | { |
1426 | m_log.DebugFormat( | 1433 | m_log.DebugFormat( |
1427 | "[SCENE]: Storing {0}, {1} in {2}", | 1434 | "[SCENE]: Storing {0}, {1} in {2}", |
@@ -1444,19 +1451,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1444 | 1451 | ||
1445 | backup_group = null; | 1452 | backup_group = null; |
1446 | } | 1453 | } |
1447 | // else | 1454 | // else |
1448 | // { | 1455 | // { |
1449 | // m_log.DebugFormat( | 1456 | // m_log.DebugFormat( |
1450 | // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", | 1457 | // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", |
1451 | // Name, UUID, IsSelected); | 1458 | // Name, UUID, IsSelected); |
1452 | // } | 1459 | // } |
1453 | } | 1460 | } |
1454 | } | 1461 | } |
1455 | catch (Exception e) | 1462 | catch (Exception e) |
1456 | { | 1463 | { |
1457 | m_log.ErrorFormat( | 1464 | m_log.ErrorFormat( |
1458 | "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}\n\t{4}", | 1465 | "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}{4}", |
1459 | Name, UUID, m_scene.RegionInfo.RegionName, e, e.StackTrace); | 1466 | Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace); |
1460 | } | 1467 | } |
1461 | } | 1468 | } |
1462 | 1469 | ||
@@ -2084,16 +2091,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2084 | /// <returns>null if a child part with the primID was not found</returns> | 2091 | /// <returns>null if a child part with the primID was not found</returns> |
2085 | public SceneObjectPart GetChildPart(UUID primID) | 2092 | public SceneObjectPart GetChildPart(UUID primID) |
2086 | { | 2093 | { |
2087 | SceneObjectPart childPart = null; | 2094 | SceneObjectPart childPart; |
2088 | |||
2089 | lock (m_parts) | 2095 | lock (m_parts) |
2090 | { | 2096 | m_parts.TryGetValue(primID, out childPart); |
2091 | if (m_parts.ContainsKey(primID)) | ||
2092 | { | ||
2093 | childPart = m_parts[primID]; | ||
2094 | } | ||
2095 | } | ||
2096 | |||
2097 | return childPart; | 2097 | return childPart; |
2098 | } | 2098 | } |
2099 | 2099 | ||
@@ -2246,7 +2246,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2246 | } | 2246 | } |
2247 | } | 2247 | } |
2248 | 2248 | ||
2249 | m_scene.UnlinkSceneObject(objectGroup.UUID, true); | 2249 | m_scene.UnlinkSceneObject(objectGroup, true); |
2250 | objectGroup.m_isDeleted = true; | 2250 | objectGroup.m_isDeleted = true; |
2251 | 2251 | ||
2252 | lock (objectGroup.m_parts) | 2252 | lock (objectGroup.m_parts) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3ed74e1..3753dcb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
494 | public UUID UUID | 494 | public UUID UUID |
495 | { | 495 | { |
496 | get { return m_uuid; } | 496 | get { return m_uuid; } |
497 | set { m_uuid = value; } | 497 | set |
498 | { | ||
499 | m_uuid = value; | ||
500 | |||
501 | // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part | ||
502 | if (Inventory != null) | ||
503 | Inventory.ResetInventoryIDs(); | ||
504 | } | ||
498 | } | 505 | } |
499 | 506 | ||
500 | public uint LocalId | 507 | public uint LocalId |
@@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2756 | UUID = UUID.Random(); | 2763 | UUID = UUID.Random(); |
2757 | LinkNum = linkNum; | 2764 | LinkNum = linkNum; |
2758 | LocalId = 0; | 2765 | LocalId = 0; |
2759 | Inventory.ResetInventoryIDs(); | ||
2760 | } | 2766 | } |
2761 | 2767 | ||
2762 | /// <summary> | 2768 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index ca089a1..87c4860 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | /// <param name="linkNum">Link number for the part</param> | 119 | /// <param name="linkNum">Link number for the part</param> |
120 | public void ResetInventoryIDs() | 120 | public void ResetInventoryIDs() |
121 | { | 121 | { |
122 | if (null == m_part || null == m_part.ParentGroup) | ||
123 | return; | ||
124 | |||
122 | lock (m_items) | 125 | lock (m_items) |
123 | { | 126 | { |
124 | if (0 == m_items.Count) | 127 | if (0 == m_items.Count) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index f478a4a..7aa5a93 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -75,7 +75,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | 75 | ||
76 | lock(m_pendingObjects) | 76 | lock(m_pendingObjects) |
77 | { | 77 | { |
78 | foreach (EntityBase e in m_presence.Scene.Entities) | 78 | EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); |
79 | foreach (EntityBase e in entities) | ||
79 | { | 80 | { |
80 | if (e != null && e is SceneObjectGroup) | 81 | if (e != null && e is SceneObjectGroup) |
81 | m_pendingObjects.Enqueue((SceneObjectGroup)e); | 82 | m_pendingObjects.Enqueue((SceneObjectGroup)e); |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index b6677f0..5494549 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
84 | int primCount = 0; | 84 | int primCount = 0; |
85 | stream.WriteLine("<scene>\n"); | 85 | stream.WriteLine("<scene>\n"); |
86 | 86 | ||
87 | List<EntityBase> EntityList = scene.GetEntities(); | 87 | EntityBase[] entityList = scene.GetEntities(); |
88 | 88 | foreach (EntityBase ent in entityList) | |
89 | foreach (EntityBase ent in EntityList) | ||
90 | { | 89 | { |
91 | if (ent is SceneObjectGroup) | 90 | if (ent is SceneObjectGroup) |
92 | { | 91 | { |
@@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
204 | 203 | ||
205 | public static void SavePrimsToXml2(Scene scene, string fileName) | 204 | public static void SavePrimsToXml2(Scene scene, string fileName) |
206 | { | 205 | { |
207 | List<EntityBase> EntityList = scene.GetEntities(); | 206 | EntityBase[] entityList = scene.GetEntities(); |
208 | 207 | SavePrimListToXml2(entityList, fileName); | |
209 | SavePrimListToXml2(EntityList, fileName); | ||
210 | } | 208 | } |
211 | 209 | ||
212 | public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) | 210 | public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) |
213 | { | 211 | { |
214 | List<EntityBase> EntityList = scene.GetEntities(); | 212 | EntityBase[] entityList = scene.GetEntities(); |
215 | 213 | SavePrimListToXml2(entityList, stream, min, max); | |
216 | SavePrimListToXml2(EntityList, stream, min, max); | ||
217 | } | 214 | } |
218 | 215 | ||
219 | public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) | 216 | public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) |
@@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
222 | "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", | 219 | "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", |
223 | primName, scene.RegionInfo.RegionName, fileName); | 220 | primName, scene.RegionInfo.RegionName, fileName); |
224 | 221 | ||
225 | List<EntityBase> entityList = scene.GetEntities(); | 222 | EntityBase[] entityList = scene.GetEntities(); |
226 | List<EntityBase> primList = new List<EntityBase>(); | 223 | List<EntityBase> primList = new List<EntityBase>(); |
227 | 224 | ||
228 | foreach (EntityBase ent in entityList) | 225 | foreach (EntityBase ent in entityList) |
@@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
236 | } | 233 | } |
237 | } | 234 | } |
238 | 235 | ||
239 | SavePrimListToXml2(primList, fileName); | 236 | SavePrimListToXml2(primList.ToArray(), fileName); |
240 | } | 237 | } |
241 | 238 | ||
242 | public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) | 239 | public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) |
243 | { | 240 | { |
244 | FileStream file = new FileStream(fileName, FileMode.Create); | 241 | FileStream file = new FileStream(fileName, FileMode.Create); |
245 | try | 242 | try |
@@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
260 | } | 257 | } |
261 | } | 258 | } |
262 | 259 | ||
263 | public static void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) | 260 | public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) |
264 | { | 261 | { |
265 | int primCount = 0; | 262 | int primCount = 0; |
266 | stream.WriteLine("<scene>\n"); | 263 | stream.WriteLine("<scene>\n"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index e140cd5..3a0dd00 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -28,20 +28,21 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | 34 | using OpenSim.Tests.Common; | |
34 | using NUnit.Framework; | ||
35 | 35 | ||
36 | namespace OpenSim.Region.Framework.Scenes.Tests | 36 | namespace OpenSim.Region.Framework.Scenes.Tests |
37 | { | 37 | { |
38 | [TestFixture] | 38 | [TestFixture] |
39 | public class BorderTests | 39 | public class BorderTests |
40 | { | 40 | { |
41 | |||
42 | [Test] | 41 | [Test] |
43 | public void TestCross() | 42 | public void TestCross() |
44 | { | 43 | { |
44 | TestHelper.InMethod(); | ||
45 | |||
45 | List<Border> testborders = new List<Border>(); | 46 | List<Border> testborders = new List<Border>(); |
46 | 47 | ||
47 | Border NorthBorder = new Border(); | 48 | Border NorthBorder = new Border(); |
@@ -75,8 +76,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
75 | position = new Vector3(200,280,21); | 76 | position = new Vector3(200,280,21); |
76 | Assert.That(NorthBorder.TestCross(position)); | 77 | Assert.That(NorthBorder.TestCross(position)); |
77 | 78 | ||
78 | |||
79 | |||
80 | // Test automatic border crossing | 79 | // Test automatic border crossing |
81 | // by setting the border crossing aabb to be the whole region | 80 | // by setting the border crossing aabb to be the whole region |
82 | position = new Vector3(25,25,21); // safely within one 256m region | 81 | position = new Vector3(25,25,21); // safely within one 256m region |
@@ -95,12 +94,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
95 | 94 | ||
96 | WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region | 95 | WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region |
97 | Assert.That(WestBorder.TestCross(position)); | 96 | Assert.That(WestBorder.TestCross(position)); |
98 | |||
99 | } | 97 | } |
100 | 98 | ||
101 | [Test] | 99 | [Test] |
102 | public void TestCrossSquare512() | 100 | public void TestCrossSquare512() |
103 | { | 101 | { |
102 | TestHelper.InMethod(); | ||
103 | |||
104 | List<Border> testborders = new List<Border>(); | 104 | List<Border> testborders = new List<Border>(); |
105 | 105 | ||
106 | Border NorthBorder = new Border(); | 106 | Border NorthBorder = new Border(); |
@@ -174,12 +174,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
174 | Assert.That(!b.TestCross(position)); | 174 | Assert.That(!b.TestCross(position)); |
175 | 175 | ||
176 | } | 176 | } |
177 | |||
178 | } | 177 | } |
179 | 178 | ||
180 | [Test] | 179 | [Test] |
181 | public void TestCrossRectangle512x256() | 180 | public void TestCrossRectangle512x256() |
182 | { | 181 | { |
182 | TestHelper.InMethod(); | ||
183 | |||
183 | List<Border> testborders = new List<Border>(); | 184 | List<Border> testborders = new List<Border>(); |
184 | 185 | ||
185 | Border NorthBorder = new Border(); | 186 | Border NorthBorder = new Border(); |
@@ -258,6 +259,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
258 | [Test] | 259 | [Test] |
259 | public void TestCrossOdd512x512w256hole() | 260 | public void TestCrossOdd512x512w256hole() |
260 | { | 261 | { |
262 | TestHelper.InMethod(); | ||
263 | |||
261 | List<Border> testborders = new List<Border>(); | 264 | List<Border> testborders = new List<Border>(); |
262 | // 512____ | 265 | // 512____ |
263 | // | | | 266 | // | | |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 3e2a2af..b3c3e22 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -53,7 +53,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
53 | public void T010_AddObjects() | 53 | public void T010_AddObjects() |
54 | { | 54 | { |
55 | TestHelper.InMethod(); | 55 | TestHelper.InMethod(); |
56 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | ||
57 | 56 | ||
58 | random = new Random(); | 57 | random = new Random(); |
59 | SceneObjectGroup found; | 58 | SceneObjectGroup found; |
@@ -89,7 +88,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
89 | public void T011_ThreadAddRemoveTest() | 88 | public void T011_ThreadAddRemoveTest() |
90 | { | 89 | { |
91 | TestHelper.InMethod(); | 90 | TestHelper.InMethod(); |
92 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | ||
93 | 91 | ||
94 | // This test adds and removes with mutiple threads, attempting to break the | 92 | // This test adds and removes with mutiple threads, attempting to break the |
95 | // uuid and localid dictionary coherence. | 93 | // uuid and localid dictionary coherence. |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 0b7608d..e3ef263 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -26,13 +26,13 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | 32 | using NUnit.Framework.SyntaxHelpers; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
35 | |||
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
@@ -260,5 +260,86 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
260 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), | 260 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), |
261 | "Badness 3"); | 261 | "Badness 3"); |
262 | } | 262 | } |
263 | |||
264 | /// <summary> | ||
265 | /// Test that a new scene object which is already linked is correctly persisted to the persistence layer. | ||
266 | /// </summary> | ||
267 | [Test] | ||
268 | public void TestNewSceneObjectLinkPersistence() | ||
269 | { | ||
270 | TestHelper.InMethod(); | ||
271 | //log4net.Config.XmlConfigurator.Configure(); | ||
272 | |||
273 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
274 | |||
275 | string rootPartName = "rootpart"; | ||
276 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | ||
277 | string linkPartName = "linkpart"; | ||
278 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); | ||
279 | |||
280 | SceneObjectPart rootPart | ||
281 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
282 | { Name = rootPartName, UUID = rootPartUuid }; | ||
283 | SceneObjectPart linkPart | ||
284 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
285 | { Name = linkPartName, UUID = linkPartUuid }; | ||
286 | |||
287 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | ||
288 | sog.AddPart(linkPart); | ||
289 | scene.AddNewSceneObject(sog, true); | ||
290 | |||
291 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | ||
292 | // scene backup thread. | ||
293 | scene.Backup(true); | ||
294 | |||
295 | List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); | ||
296 | |||
297 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | ||
298 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); | ||
299 | Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid)); | ||
300 | Assert.That(storedObjects[0].Children.ContainsKey(linkPartUuid)); | ||
301 | } | ||
302 | |||
303 | /// <summary> | ||
304 | /// Test that a delink of a previously linked object is correctly persisted to the database | ||
305 | /// </summary> | ||
306 | [Test] | ||
307 | public void TestDelinkPersistence() | ||
308 | { | ||
309 | TestHelper.InMethod(); | ||
310 | //log4net.Config.XmlConfigurator.Configure(); | ||
311 | |||
312 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
313 | |||
314 | string rootPartName = "rootpart"; | ||
315 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | ||
316 | string linkPartName = "linkpart"; | ||
317 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); | ||
318 | |||
319 | SceneObjectPart rootPart | ||
320 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
321 | { Name = rootPartName, UUID = rootPartUuid }; | ||
322 | SceneObjectPart linkPart | ||
323 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
324 | { Name = linkPartName, UUID = linkPartUuid }; | ||
325 | |||
326 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | ||
327 | sog.AddPart(linkPart); | ||
328 | scene.AddNewSceneObject(sog, true); | ||
329 | |||
330 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | ||
331 | // scene backup thread. | ||
332 | scene.Backup(true); | ||
333 | |||
334 | // These changes should occur immediately without waiting for a backup pass | ||
335 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); | ||
336 | scene.DeleteSceneObject(groupToDelete, false); | ||
337 | |||
338 | List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); | ||
339 | |||
340 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | ||
341 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); | ||
342 | Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid)); | ||
343 | } | ||
263 | } | 344 | } |
264 | } | 345 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index e39a362..ab5968c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -173,6 +173,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
173 | 173 | ||
174 | Assert.That(neighbours.Count, Is.EqualTo(2)); | 174 | Assert.That(neighbours.Count, Is.EqualTo(2)); |
175 | } | 175 | } |
176 | |||
176 | public void fixNullPresence() | 177 | public void fixNullPresence() |
177 | { | 178 | { |
178 | string firstName = "testfirstname"; | 179 | string firstName = "testfirstname"; |
@@ -389,8 +390,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
389 | 390 | ||
390 | public static string GetRandomCapsObjectPath() | 391 | public static string GetRandomCapsObjectPath() |
391 | { | 392 | { |
392 | TestHelper.InMethod(); | ||
393 | |||
394 | UUID caps = UUID.Random(); | 393 | UUID caps = UUID.Random(); |
395 | string capsPath = caps.ToString(); | 394 | string capsPath = caps.ToString(); |
396 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); | 395 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); |
@@ -429,4 +428,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
429 | return name.ToString(); | 428 | return name.ToString(); |
430 | } | 429 | } |
431 | } | 430 | } |
432 | } | 431 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index da8199d..5e491c2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests | |||
75 | 75 | ||
76 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) | 76 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) |
77 | { | 77 | { |
78 | AssetNotecard nc = new AssetNotecard("Hello World!"); | 78 | AssetNotecard nc = new AssetNotecard(); |
79 | nc.BodyText = "Hello World!"; | ||
80 | nc.Encode(); | ||
79 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 81 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); |
80 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | 82 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); |
81 | AssetBase ncAsset | 83 | AssetBase ncAsset |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 6793ef6..159af79 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
375 | 375 | ||
376 | private void IRC_SendNamesReply() | 376 | private void IRC_SendNamesReply() |
377 | { | 377 | { |
378 | List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); | 378 | EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>(); |
379 | |||
380 | foreach (EntityBase user in users) | 379 | foreach (EntityBase user in users) |
381 | { | 380 | { |
382 | SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); | 381 | SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); |
@@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
386 | 385 | ||
387 | private void IRC_SendWhoReply() | 386 | private void IRC_SendWhoReply() |
388 | { | 387 | { |
389 | List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); | 388 | EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>(); |
390 | |||
391 | foreach (EntityBase user in users) | 389 | foreach (EntityBase user in users) |
392 | { | 390 | { |
393 | /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, | 391 | /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, |
@@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
415 | 413 | ||
416 | private void IRC_SendReplyUsers() | 414 | private void IRC_SendReplyUsers() |
417 | { | 415 | { |
418 | List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); | 416 | EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>(); |
419 | 417 | ||
420 | SendServerCommand("392 :UserID Terminal Host"); | 418 | SendServerCommand("392 :UserID Terminal Host"); |
421 | 419 | ||
422 | if (users.Count == 0) | 420 | if (users.Length == 0) |
423 | { | 421 | { |
424 | SendServerCommand("395 :Nobody logged in"); | 422 | SendServerCommand("395 :Nobody logged in"); |
425 | return; | 423 | return; |
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs index de1e01c..d21b652 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs | |||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
111 | } | 111 | } |
112 | 112 | ||
113 | // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash | 113 | // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash |
114 | public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList) | 114 | public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList) |
115 | { | 115 | { |
116 | System.Collections.ArrayList missingList = new System.Collections.ArrayList(); | 116 | System.Collections.ArrayList missingList = new System.Collections.ArrayList(); |
117 | SceneObjectGroup temp = null; | 117 | SceneObjectGroup temp = null; |
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs index e5fcb54..fd59138 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs | |||
@@ -300,7 +300,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
300 | } | 300 | } |
301 | } | 301 | } |
302 | m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup."); | 302 | m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup."); |
303 | scene.Backup(); | 303 | scene.Backup(true); |
304 | } | 304 | } |
305 | 305 | ||
306 | /// <summary> | 306 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs index 2730eee..49d20e1 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs | |||
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
127 | /// </summary> | 127 | /// </summary> |
128 | public void FindDifferences() | 128 | public void FindDifferences() |
129 | { | 129 | { |
130 | System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities(); | 130 | List<EntityBase> sceneEntityList = new List<EntityBase>(m_Entity.Scene.GetEntities()); |
131 | DiffersFromSceneGroup = false; | 131 | DiffersFromSceneGroup = false; |
132 | // if group is not contained in scene's list | 132 | // if group is not contained in scene's list |
133 | if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) | 133 | if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs index 6ba5ccf..140264b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs | |||
@@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
41 | private readonly Scene m_scene; | 41 | private readonly Scene m_scene; |
42 | private readonly IEnumerator<EntityBase> m_sogEnum; | 42 | private readonly IEnumerator<EntityBase> m_sogEnum; |
43 | private readonly ISecurityCredential m_security; | 43 | private readonly ISecurityCredential m_security; |
44 | private readonly List<EntityBase> m_entities; | ||
44 | 45 | ||
45 | public IObjEnum(Scene scene, ISecurityCredential security) | 46 | public IObjEnum(Scene scene, ISecurityCredential security) |
46 | { | 47 | { |
47 | m_scene = scene; | 48 | m_scene = scene; |
48 | m_security = security; | 49 | m_security = security; |
49 | m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); | 50 | m_entities = new List<EntityBase>(m_scene.Entities.GetEntities()); |
51 | m_sogEnum = m_entities.GetEnumerator(); | ||
50 | } | 52 | } |
51 | 53 | ||
52 | public void Dispose() | 54 | public void Dispose() |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 45bb005..f2324d2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | |||
@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
205 | { | 205 | { |
206 | get | 206 | get |
207 | { | 207 | { |
208 | List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); | 208 | EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); |
209 | IAvatar[] rets = new IAvatar[ents.Count]; | 209 | IAvatar[] rets = new IAvatar[ents.Length]; |
210 | 210 | ||
211 | for (int i = 0; i < ents.Count; i++) | 211 | for (int i = 0; i < ents.Length; i++) |
212 | { | 212 | { |
213 | EntityBase ent = ents[i]; | 213 | EntityBase ent = ents[i]; |
214 | rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); | 214 | rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 672109b..122ad40 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
133 | m_firstEmptyCompileQueue = false; | 133 | m_firstEmptyCompileQueue = false; |
134 | m_oarFileLoading = false; | 134 | m_oarFileLoading = false; |
135 | 135 | ||
136 | m_scene.Backup(); | 136 | m_scene.Backup(false); |
137 | 137 | ||
138 | c.From = "RegionReady"; | 138 | c.From = "RegionReady"; |
139 | if (m_lastOarLoadedOk) | 139 | if (m_lastOarLoadedOk) |
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 3ed338b..421da36 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | |||
@@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
568 | { | 568 | { |
569 | m_copse = new List<Copse>(); | 569 | m_copse = new List<Copse>(); |
570 | 570 | ||
571 | List<EntityBase> objs = m_scene.GetEntities(); | 571 | EntityBase[] objs = m_scene.GetEntities(); |
572 | |||
573 | foreach (EntityBase obj in objs) | 572 | foreach (EntityBase obj in objs) |
574 | { | 573 | { |
575 | if (obj is SceneObjectGroup) | 574 | if (obj is SceneObjectGroup) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b51b410..a9c5d10 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3971,9 +3971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3971 | } | 3971 | } |
3972 | 3972 | ||
3973 | 3973 | ||
3974 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); | 3974 | pinfo = World.PresenceService.GetAgent(uuid); |
3975 | if (pinfos != null && pinfos.Length > 0) | ||
3976 | pinfo = pinfos[0]; | ||
3977 | 3975 | ||
3978 | ce = new UserInfoCacheEntry(); | 3976 | ce = new UserInfoCacheEntry(); |
3979 | ce.time = Util.EnvironmentTickCount(); | 3977 | ce.time = Util.EnvironmentTickCount(); |
@@ -3991,11 +3989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3991 | 3989 | ||
3992 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) | 3990 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) |
3993 | { | 3991 | { |
3994 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); | 3992 | pinfo = World.PresenceService.GetAgent(uuid); |
3995 | if (pinfos != null && pinfos.Length > 0) | ||
3996 | pinfo = pinfos[0]; | ||
3997 | else | ||
3998 | pinfo = null; | ||
3999 | 3993 | ||
4000 | ce.time = Util.EnvironmentTickCount(); | 3994 | ce.time = Util.EnvironmentTickCount(); |
4001 | ce.pinfo = pinfo; | 3995 | ce.pinfo = pinfo; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 5c2abd5..2b67e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
286 | } | 286 | } |
287 | else | 287 | else |
288 | { | 288 | { |
289 | Entities = m_CmdManager.m_ScriptEngine.World.GetEntities(); | 289 | Entities = new List<EntityBase>(m_CmdManager.m_ScriptEngine.World.GetEntities()); |
290 | } | 290 | } |
291 | SceneObjectPart SensePoint = ts.host; | 291 | SceneObjectPart SensePoint = ts.host; |
292 | 292 | ||