aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs113
2 files changed, 12 insertions, 110 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4f5a65e..9963225 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -834,7 +834,7 @@ namespace OpenSim.Region.Framework.Scenes
834 ScenePresence presence; 834 ScenePresence presence;
835 if (TryGetScenePresence(remoteClient.AgentId, out presence)) 835 if (TryGetScenePresence(remoteClient.AgentId, out presence))
836 { 836 {
837 byte[] data = null; 837// byte[] data = null;
838 838
839 AssetBase asset = new AssetBase(); 839 AssetBase asset = new AssetBase();
840 asset.FullID = olditemID; 840 asset.FullID = olditemID;
@@ -842,8 +842,10 @@ namespace OpenSim.Region.Framework.Scenes
842 asset.Name = name; 842 asset.Name = name;
843 asset.Description = description; 843 asset.Description = description;
844 844
845 CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); 845 CreateNewInventoryItem(
846 846 remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType,
847 (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
848 (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
847 } 849 }
848 else 850 else
849 { 851 {
@@ -876,7 +878,6 @@ namespace OpenSim.Region.Framework.Scenes
876 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs); 878 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
877 } 879 }
878 880
879
880 /// <summary> 881 /// <summary>
881 /// Send the details of a prim's inventory to the client. 882 /// Send the details of a prim's inventory to the client.
882 /// </summary> 883 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5f6748e..f62851a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -481,73 +481,6 @@ namespace OpenSim.Region.Framework.Scenes
481 481
482 #endregion 482 #endregion
483 483
484 #region BinaryStats
485
486 public class StatLogger
487 {
488 public DateTime StartTime;
489 public string Path;
490 public System.IO.BinaryWriter Log;
491 }
492 static StatLogger m_statLog = null;
493 static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300);
494 static string m_statsDir = String.Empty;
495 static Object m_statLockObject = new Object();
496 private void LogSimStats(SimStats stats)
497 {
498 SimStatsPacket pack = new SimStatsPacket();
499 pack.Region = new SimStatsPacket.RegionBlock();
500 pack.Region.RegionX = stats.RegionX;
501 pack.Region.RegionY = stats.RegionY;
502 pack.Region.RegionFlags = stats.RegionFlags;
503 pack.Region.ObjectCapacity = stats.ObjectCapacity;
504 //pack.Region = //stats.RegionBlock;
505 pack.Stat = stats.StatsBlock;
506 pack.Header.Reliable = false;
507
508 // note that we are inside the reporter lock when called
509 DateTime now = DateTime.Now;
510
511 // hide some time information into the packet
512 pack.Header.Sequence = (uint)now.Ticks;
513
514 lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here
515 {
516 try
517 {
518 if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod)
519 {
520 // First log file or time has expired, start writing to a new log file
521 if (m_statLog != null && m_statLog.Log != null)
522 {
523 m_statLog.Log.Close();
524 }
525 m_statLog = new StatLogger();
526 m_statLog.StartTime = now;
527 m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "")
528 + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss"));
529 m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write));
530 }
531
532 // Write the serialized data to disk
533 if (m_statLog != null && m_statLog.Log != null)
534 m_statLog.Log.Write(pack.ToBytes());
535 }
536 catch (Exception ex)
537 {
538 m_log.Error("statistics gathering failed: " + ex.Message, ex);
539 if (m_statLog != null && m_statLog.Log != null)
540 {
541 m_statLog.Log.Close();
542 }
543 m_statLog = null;
544 }
545 }
546 return;
547 }
548
549 #endregion
550
551 #region Constructors 484 #region Constructors
552 485
553 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 486 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
@@ -752,38 +685,6 @@ namespace OpenSim.Region.Framework.Scenes
752 } 685 }
753 686
754 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 687 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
755
756 #region BinaryStats
757
758 try
759 {
760 IConfig statConfig = m_config.Configs["Statistics.Binary"];
761 if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
762 {
763 if (statConfig.Contains("collect_region_stats"))
764 {
765 if (statConfig.GetBoolean("collect_region_stats"))
766 {
767 // if enabled, add us to the event. If not enabled, I won't get called
768 StatsReporter.OnSendStatsResult += LogSimStats;
769 }
770 }
771 if (statConfig.Contains("region_stats_period_seconds"))
772 {
773 m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
774 }
775 if (statConfig.Contains("stats_dir"))
776 {
777 m_statsDir = statConfig.GetString("stats_dir");
778 }
779 }
780 }
781 catch
782 {
783 // if it doesn't work, we don't collect anything
784 }
785
786 #endregion BinaryStats
787 } 688 }
788 catch 689 catch
789 { 690 {
@@ -2652,7 +2553,7 @@ namespace OpenSim.Region.Framework.Scenes
2652 if (!VerifyClient(aCircuit, ep, out vialogin)) 2553 if (!VerifyClient(aCircuit, ep, out vialogin))
2653 { 2554 {
2654 // uh-oh, this is fishy 2555 // uh-oh, this is fishy
2655 m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", 2556 m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
2656 client.AgentId, client.SessionId, ep.ToString()); 2557 client.AgentId, client.SessionId, ep.ToString());
2657 try 2558 try
2658 { 2559 {
@@ -2660,13 +2561,13 @@ namespace OpenSim.Region.Framework.Scenes
2660 } 2561 }
2661 catch (Exception e) 2562 catch (Exception e)
2662 { 2563 {
2663 m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); 2564 m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
2664 } 2565 }
2665 return; 2566 return;
2666 } 2567 }
2667 } 2568 }
2668 2569
2669 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2570 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2670 2571
2671 ScenePresence sp = CreateAndAddScenePresence(client); 2572 ScenePresence sp = CreateAndAddScenePresence(client);
2672 if (aCircuit != null) 2573 if (aCircuit != null)
@@ -2695,7 +2596,7 @@ namespace OpenSim.Region.Framework.Scenes
2695 // Do the verification here 2596 // Do the verification here
2696 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) 2597 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
2697 { 2598 {
2698 m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2599 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2699 vialogin = true; 2600 vialogin = true;
2700 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); 2601 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2701 if (userVerification != null && ep != null) 2602 if (userVerification != null && ep != null)
@@ -2705,11 +2606,11 @@ namespace OpenSim.Region.Framework.Scenes
2705 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString())) 2606 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString()))
2706 { 2607 {
2707 // uh-oh, this is fishy 2608 // uh-oh, this is fishy
2708 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2609 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2709 return false; 2610 return false;
2710 } 2611 }
2711 else 2612 else
2712 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2613 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2713 } 2614 }
2714 } 2615 }
2715 2616
@@ -2740,7 +2641,7 @@ namespace OpenSim.Region.Framework.Scenes
2740 } 2641 }
2741 catch (Exception e) 2642 catch (Exception e)
2742 { 2643 {
2743 m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); 2644 m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
2744 } 2645 }
2745 } 2646 }
2746 else 2647 else