aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMaster ScienceSim2010-10-28 09:09:42 -0700
committerMaster ScienceSim2010-10-28 09:09:42 -0700
commitf2c1d0e34feba801ff85c35ee049ed6d3067bb0d (patch)
treeff692ecc0db2b9cdf4cacd5a42234a5bb58ddd34 /OpenSim/Region/Framework
parentAdded background thread to handle delayed send and save of appearance (diff)
parentFormatting cleanup. (diff)
downloadopensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.zip
opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.tar.gz
opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.tar.bz2
opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.tar.xz
Merge branch 'opensim-master' into dev-appearance
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs10
5 files changed, 88 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 437b91a..c321a15 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -293,6 +293,17 @@ namespace OpenSim.Region.Framework.Scenes
293 public event ChatFromClientEvent OnChatFromClient; 293 public event ChatFromClientEvent OnChatFromClient;
294 294
295 /// <summary> 295 /// <summary>
296 /// ChatToClientsEvent is triggered via ChatModule (or
297 /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
298 /// received chat message if they satisfy various conditions (within audible range, etc.)
299 /// </summary>
300 public delegate void ChatToClientsEvent(
301 UUID senderID, HashSet<UUID> receiverIDs,
302 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
303 ChatSourceType src, ChatAudibleLevel level);
304 public event ChatToClientsEvent OnChatToClients;
305
306 /// <summary>
296 /// ChatBroadcastEvent is called via Scene when a broadcast chat message 307 /// ChatBroadcastEvent is called via Scene when a broadcast chat message
297 /// from world comes in 308 /// from world comes in
298 /// </summary> 309 /// </summary>
@@ -1603,6 +1614,30 @@ namespace OpenSim.Region.Framework.Scenes
1603 } 1614 }
1604 } 1615 }
1605 } 1616 }
1617
1618 public void TriggerOnChatToClients(
1619 UUID senderID, HashSet<UUID> receiverIDs,
1620 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
1621 ChatSourceType src, ChatAudibleLevel level)
1622 {
1623 ChatToClientsEvent handler = OnChatToClients;
1624 if (handler != null)
1625 {
1626 foreach (ChatToClientsEvent d in handler.GetInvocationList())
1627 {
1628 try
1629 {
1630 d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
1631 }
1632 catch (Exception e)
1633 {
1634 m_log.ErrorFormat(
1635 "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
1636 e.Message, e.StackTrace);
1637 }
1638 }
1639 }
1640 }
1606 1641
1607 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) 1642 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
1608 { 1643 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c69c9b1..6367fcf 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -593,8 +593,6 @@ namespace OpenSim.Region.Framework.Scenes
593 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 593 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
594 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 594 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
595 595
596 StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity);
597
598 // Old 596 // Old
599 /* 597 /*
600 m_simulatorVersion = simulatorVersion 598 m_simulatorVersion = simulatorVersion
@@ -2390,7 +2388,7 @@ namespace OpenSim.Region.Framework.Scenes
2390 } 2388 }
2391 catch (Exception e) 2389 catch (Exception e)
2392 { 2390 {
2393 m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message); 2391 m_log.WarnFormat("[SCENE]: Problem casting object: " + e.ToString());
2394 return false; 2392 return false;
2395 } 2393 }
2396 2394
@@ -3273,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
3273 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); 3271 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
3274 } 3272 }
3275 3273
3276
3277 /// <summary> 3274 /// <summary>
3278 /// Do the work necessary to initiate a new user connection for a particular scene. 3275 /// Do the work necessary to initiate a new user connection for a particular scene.
3279 /// At the moment, this consists of setting up the caps infrastructure 3276 /// At the moment, this consists of setting up the caps infrastructure
@@ -3286,6 +3283,23 @@ namespace OpenSim.Region.Framework.Scenes
3286 /// also return a reason.</returns> 3283 /// also return a reason.</returns>
3287 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) 3284 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
3288 { 3285 {
3286 return NewUserConnection(agent, teleportFlags, out reason, true);
3287 }
3288
3289 /// <summary>
3290 /// Do the work necessary to initiate a new user connection for a particular scene.
3291 /// At the moment, this consists of setting up the caps infrastructure
3292 /// The return bool should allow for connections to be refused, but as not all calling paths
3293 /// take proper notice of it let, we allowed banned users in still.
3294 /// </summary>
3295 /// <param name="agent">CircuitData of the agent who is connecting</param>
3296 /// <param name="reason">Outputs the reason for the false response on this string</param>
3297 /// <param name="requirePresenceLookup">True for normal presence. False for NPC
3298 /// or other applications where a full grid/Hypergrid presence may not be required.</param>
3299 /// <returns>True if the region accepts this agent. False if it does not. False will
3300 /// also return a reason.</returns>
3301 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
3302 {
3289 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || 3303 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3290 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); 3304 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3291 reason = String.Empty; 3305 reason = String.Empty;
@@ -3334,16 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes
3334 3348
3335 if (sp == null) // We don't have an [child] agent here already 3349 if (sp == null) // We don't have an [child] agent here already
3336 { 3350 {
3337 3351 if (requirePresenceLookup)
3338 try
3339 { 3352 {
3340 if (!VerifyUserPresence(agent, out reason)) 3353 try
3354 {
3355 if (!VerifyUserPresence(agent, out reason))
3356 return false;
3357 }
3358 catch (Exception e)
3359 {
3360 m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
3341 return false; 3361 return false;
3342 } 3362 }
3343 catch (Exception e)
3344 {
3345 m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message);
3346 return false;
3347 } 3363 }
3348 3364
3349 try 3365 try
@@ -3353,7 +3369,7 @@ namespace OpenSim.Region.Framework.Scenes
3353 } 3369 }
3354 catch (Exception e) 3370 catch (Exception e)
3355 { 3371 {
3356 m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); 3372 m_log.ErrorFormat("[CONNECTION BEGIN]: Exception authorizing user " + e.ToString());
3357 return false; 3373 return false;
3358 } 3374 }
3359 3375
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f81c551..24d7334 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes
406 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) 406 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
407 { 407 {
408 EntityBase entity; 408 EntityBase entity;
409 if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) 409 if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
410 return false; 410 return false;
411 411
412 SceneObjectGroup grp = (SceneObjectGroup)entity; 412 SceneObjectGroup grp = (SceneObjectGroup)entity;
413 413
414 if (entity == null)
415 return false;
416
414 if (!resultOfObjectLinked) 417 if (!resultOfObjectLinked)
415 { 418 {
416 m_numPrim -= grp.PrimCount; 419 m_numPrim -= grp.PrimCount;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 044b599..e661ca9 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
804 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) 804 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader)
805 { 805 {
806 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); 806 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
807 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); 807 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
808 } 808 }
809 809
810 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) 810 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1426,7 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1426 1426
1427 reader.ReadStartElement(name); 1427 reader.ReadStartElement(name);
1428 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x 1428 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
1429 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y 1429 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
1430 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z 1430 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
1431 reader.ReadEndElement(); 1431 reader.ReadEndElement();
1432 1432
@@ -1501,15 +1501,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1501 1501
1502 reader.ReadStartElement(name, String.Empty); // Shape 1502 reader.ReadStartElement(name, String.Empty); // Shape
1503 1503
1504 string nodeName = string.Empty;
1504 while (reader.NodeType != XmlNodeType.EndElement) 1505 while (reader.NodeType != XmlNodeType.EndElement)
1505 { 1506 {
1507 nodeName = reader.Name;
1506 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); 1508 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
1507 ShapeXmlProcessor p = null; 1509 ShapeXmlProcessor p = null;
1508 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) 1510 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
1509 p(shape, reader); 1511 {
1512 try
1513 {
1514 p(shape, reader);
1515 }
1516 catch (Exception e)
1517 {
1518 m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e);
1519 if (reader.NodeType == XmlNodeType.EndElement)
1520 reader.Read();
1521 }
1522 }
1510 else 1523 else
1511 { 1524 {
1512// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); 1525 // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
1513 reader.ReadOuterXml(); 1526 reader.ReadOuterXml();
1514 } 1527 }
1515 } 1528 }
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index fd23294..87dcdee 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -108,7 +108,7 @@ namespace OpenSim.Region.Framework.Scenes
108 private int m_activeScripts = 0; 108 private int m_activeScripts = 0;
109 private int m_scriptLinesPerSecond = 0; 109 private int m_scriptLinesPerSecond = 0;
110 110
111 private int objectCapacity = 45000; 111 private int m_objectCapacity = 45000;
112 112
113 private Scene m_scene; 113 private Scene m_scene;
114 114
@@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes
124 m_scene = scene; 124 m_scene = scene;
125 ReportingRegion = scene.RegionInfo; 125 ReportingRegion = scene.RegionInfo;
126 126
127 m_objectCapacity = scene.RegionInfo.ObjectCapacity;
127 m_report.AutoReset = true; 128 m_report.AutoReset = true;
128 m_report.Interval = statsUpdatesEveryMS; 129 m_report.Interval = statsUpdatesEveryMS;
129 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); 130 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
@@ -271,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
271 272
272 SimStats simStats 273 SimStats simStats
273 = new SimStats( 274 = new SimStats(
274 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); 275 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID);
275 276
276 handlerSendStatResult = OnSendStatsResult; 277 handlerSendStatResult = OnSendStatsResult;
277 if (handlerSendStatResult != null) 278 if (handlerSendStatResult != null)
@@ -435,11 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
435 m_activeScripts = count; 436 m_activeScripts = count;
436 } 437 }
437 438
438 public void SetObjectCapacity(int objects)
439 {
440 objectCapacity = objects;
441 }
442
443 /// <summary> 439 /// <summary>
444 /// This is for llGetRegionFPS 440 /// This is for llGetRegionFPS
445 /// </summary> 441 /// </summary>