aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorteravus2012-11-15 10:05:16 -0500
committerteravus2012-11-15 10:05:16 -0500
commite9153e1d1aae50024d8cd05fe14a9bce34343a0e (patch)
treebc111d34f95a26b99c7e34d9e495dc14d1802cc3 /OpenSim/Framework
parentMerge master into teravuswork (diff)
downloadopensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.zip
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.gz
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.bz2
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.xz
Revert "Merge master into teravuswork", it should have been avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AssetPermissions.cs84
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs3
-rw-r--r--OpenSim/Framework/Cache.cs83
-rw-r--r--OpenSim/Framework/Client/IClientChat.cs7
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs228
-rw-r--r--OpenSim/Framework/Constants.cs1
-rw-r--r--OpenSim/Framework/EstateSettings.cs10
-rw-r--r--OpenSim/Framework/GridInstantMessage.cs9
-rw-r--r--OpenSim/Framework/IClientAPI.cs46
-rw-r--r--OpenSim/Framework/InventoryFolderBase.cs18
-rw-r--r--OpenSim/Framework/LandData.cs385
-rw-r--r--OpenSim/Framework/Monitoring/BaseStatsCollector.cs23
-rw-r--r--OpenSim/Framework/Monitoring/MemoryWatchdog.cs10
-rw-r--r--OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs19
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs360
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs35
-rw-r--r--OpenSim/Framework/PacketPool.cs (renamed from OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs)97
-rw-r--r--OpenSim/Framework/Pool.cs91
-rw-r--r--OpenSim/Framework/RegionFlags.cs53
-rw-r--r--OpenSim/Framework/RegionInfo.cs72
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs5
-rw-r--r--OpenSim/Framework/Serialization/External/OspResolver.cs14
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs43
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs274
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs22
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs148
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs4
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs19
-rw-r--r--OpenSim/Framework/Util.cs51
-rw-r--r--OpenSim/Framework/WebUtil.cs81
31 files changed, 406 insertions, 1891 deletions
diff --git a/OpenSim/Framework/AssetPermissions.cs b/OpenSim/Framework/AssetPermissions.cs
deleted file mode 100644
index 4a905c2..0000000
--- a/OpenSim/Framework/AssetPermissions.cs
+++ /dev/null
@@ -1,84 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4
5using Nini.Config;
6using log4net;
7
8using OpenMetaverse;
9
10namespace OpenSim.Framework
11{
12 public class AssetPermissions
13 {
14 private static readonly ILog m_log =
15 LogManager.GetLogger(
16 MethodBase.GetCurrentMethod().DeclaringType);
17
18 private bool[] m_DisallowExport, m_DisallowImport;
19 private string[] m_AssetTypeNames;
20
21 public AssetPermissions(IConfig config)
22 {
23 Type enumType = typeof(AssetType);
24 m_AssetTypeNames = Enum.GetNames(enumType);
25 for (int i = 0; i < m_AssetTypeNames.Length; i++)
26 m_AssetTypeNames[i] = m_AssetTypeNames[i].ToLower();
27 int n = Enum.GetValues(enumType).Length;
28 m_DisallowExport = new bool[n];
29 m_DisallowImport = new bool[n];
30
31 LoadPermsFromConfig(config, "DisallowExport", m_DisallowExport);
32 LoadPermsFromConfig(config, "DisallowImport", m_DisallowImport);
33
34 }
35
36 private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray)
37 {
38 if (assetConfig == null)
39 return;
40
41 string perms = assetConfig.GetString(variable, String.Empty);
42 string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
43 foreach (string s in parts)
44 {
45 int index = Array.IndexOf(m_AssetTypeNames, s.Trim().ToLower());
46 if (index >= 0)
47 bitArray[index] = true;
48 else
49 m_log.WarnFormat("[Asset Permissions]: Invalid AssetType {0}", s);
50 }
51
52 }
53
54 public bool AllowedExport(sbyte type)
55 {
56 string assetTypeName = ((AssetType)type).ToString();
57
58 int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower());
59 if (index >= 0 && m_DisallowExport[index])
60 {
61 m_log.DebugFormat("[Asset Permissions]: Export denied: configuration does not allow export of AssetType {0}", assetTypeName);
62 return false;
63 }
64
65 return true;
66 }
67
68 public bool AllowedImport(sbyte type)
69 {
70 string assetTypeName = ((AssetType)type).ToString();
71
72 int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower());
73 if (index >= 0 && m_DisallowImport[index])
74 {
75 m_log.DebugFormat("[Asset Permissions]: Import denied: configuration does not allow import of AssetType {0}", assetTypeName);
76 return false;
77 }
78
79 return true;
80 }
81
82
83 }
84}
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 1638541..c5d9641 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -358,9 +358,6 @@ namespace OpenSim.Framework
358 SetVisualParams(visualParams); 358 SetVisualParams(visualParams);
359 } 359 }
360 360
361 /// <summary>
362 /// Set avatar height by a calculation based on their visual parameters.
363 /// </summary>
364 public virtual void SetHeight() 361 public virtual void SetHeight()
365 { 362 {
366 // Start with shortest possible female avatar height 363 // Start with shortest possible female avatar height
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs
index 31cab4a..79e20fc 100644
--- a/OpenSim/Framework/Cache.cs
+++ b/OpenSim/Framework/Cache.cs
@@ -199,14 +199,7 @@ namespace OpenSim.Framework
199 // 199 //
200 public class Cache 200 public class Cache
201 { 201 {
202 /// <summary>
203 /// Must only be accessed under lock.
204 /// </summary>
205 private List<CacheItemBase> m_Index = new List<CacheItemBase>(); 202 private List<CacheItemBase> m_Index = new List<CacheItemBase>();
206
207 /// <summary>
208 /// Must only be accessed under m_Index lock.
209 /// </summary>
210 private Dictionary<string, CacheItemBase> m_Lookup = 203 private Dictionary<string, CacheItemBase> m_Lookup =
211 new Dictionary<string, CacheItemBase>(); 204 new Dictionary<string, CacheItemBase>();
212 205
@@ -327,19 +320,19 @@ namespace OpenSim.Framework
327 { 320 {
328 if (m_Lookup.ContainsKey(index)) 321 if (m_Lookup.ContainsKey(index))
329 item = m_Lookup[index]; 322 item = m_Lookup[index];
323 }
330 324
331 if (item == null) 325 if (item == null)
332 { 326 {
333 Expire(true);
334 return null;
335 }
336
337 item.hits++;
338 item.lastUsed = DateTime.Now;
339
340 Expire(true); 327 Expire(true);
328 return null;
341 } 329 }
342 330
331 item.hits++;
332 item.lastUsed = DateTime.Now;
333
334 Expire(true);
335
343 return item; 336 return item;
344 } 337 }
345 338
@@ -392,10 +385,7 @@ namespace OpenSim.Framework
392 // 385 //
393 public Object Find(Predicate<CacheItemBase> d) 386 public Object Find(Predicate<CacheItemBase> d)
394 { 387 {
395 CacheItemBase item; 388 CacheItemBase item = m_Index.Find(d);
396
397 lock (m_Index)
398 item = m_Index.Find(d);
399 389
400 if (item == null) 390 if (item == null)
401 return null; 391 return null;
@@ -429,12 +419,12 @@ namespace OpenSim.Framework
429 public virtual void Store(string index, Object data, Type container, 419 public virtual void Store(string index, Object data, Type container,
430 Object[] parameters) 420 Object[] parameters)
431 { 421 {
422 Expire(false);
423
432 CacheItemBase item; 424 CacheItemBase item;
433 425
434 lock (m_Index) 426 lock (m_Index)
435 { 427 {
436 Expire(false);
437
438 if (m_Index.Contains(new CacheItemBase(index))) 428 if (m_Index.Contains(new CacheItemBase(index)))
439 { 429 {
440 if ((m_Flags & CacheFlags.AllowUpdate) != 0) 430 if ((m_Flags & CacheFlags.AllowUpdate) != 0)
@@ -460,17 +450,9 @@ namespace OpenSim.Framework
460 m_Index.Add(item); 450 m_Index.Add(item);
461 m_Lookup[index] = item; 451 m_Lookup[index] = item;
462 } 452 }
463
464 item.Store(data); 453 item.Store(data);
465 } 454 }
466 455
467 /// <summary>
468 /// Expire items as appropriate.
469 /// </summary>
470 /// <remarks>
471 /// Callers must lock m_Index.
472 /// </remarks>
473 /// <param name='getting'></param>
474 protected virtual void Expire(bool getting) 456 protected virtual void Expire(bool getting)
475 { 457 {
476 if (getting && (m_Strategy == CacheStrategy.Aggressive)) 458 if (getting && (m_Strategy == CacheStrategy.Aggressive))
@@ -493,10 +475,12 @@ namespace OpenSim.Framework
493 475
494 switch (m_Strategy) 476 switch (m_Strategy)
495 { 477 {
496 case CacheStrategy.Aggressive: 478 case CacheStrategy.Aggressive:
497 if (Count < Size) 479 if (Count < Size)
498 return; 480 return;
499 481
482 lock (m_Index)
483 {
500 m_Index.Sort(new SortLRU()); 484 m_Index.Sort(new SortLRU());
501 m_Index.Reverse(); 485 m_Index.Reverse();
502 486
@@ -506,7 +490,7 @@ namespace OpenSim.Framework
506 490
507 ExpireDelegate doExpire = OnExpire; 491 ExpireDelegate doExpire = OnExpire;
508 492
509 if (doExpire != null) 493 if (doExpire != null)
510 { 494 {
511 List<CacheItemBase> candidates = 495 List<CacheItemBase> candidates =
512 m_Index.GetRange(target, Count - target); 496 m_Index.GetRange(target, Count - target);
@@ -529,34 +513,27 @@ namespace OpenSim.Framework
529 foreach (CacheItemBase item in m_Index) 513 foreach (CacheItemBase item in m_Index)
530 m_Lookup[item.uuid] = item; 514 m_Lookup[item.uuid] = item;
531 } 515 }
532 516 }
533 break; 517 break;
534 518 default:
535 default: 519 break;
536 break;
537 } 520 }
538 } 521 }
539 522
540 public void Invalidate(string uuid) 523 public void Invalidate(string uuid)
541 { 524 {
542 lock (m_Index) 525 if (!m_Lookup.ContainsKey(uuid))
543 { 526 return;
544 if (!m_Lookup.ContainsKey(uuid))
545 return;
546 527
547 CacheItemBase item = m_Lookup[uuid]; 528 CacheItemBase item = m_Lookup[uuid];
548 m_Lookup.Remove(uuid); 529 m_Lookup.Remove(uuid);
549 m_Index.Remove(item); 530 m_Index.Remove(item);
550 }
551 } 531 }
552 532
553 public void Clear() 533 public void Clear()
554 { 534 {
555 lock (m_Index) 535 m_Index.Clear();
556 { 536 m_Lookup.Clear();
557 m_Index.Clear();
558 m_Lookup.Clear();
559 }
560 } 537 }
561 } 538 }
562} \ No newline at end of file 539}
diff --git a/OpenSim/Framework/Client/IClientChat.cs b/OpenSim/Framework/Client/IClientChat.cs
index 86b1faa..078ea9b 100644
--- a/OpenSim/Framework/Client/IClientChat.cs
+++ b/OpenSim/Framework/Client/IClientChat.cs
@@ -33,8 +33,7 @@ namespace OpenSim.Framework.Client
33 { 33 {
34 event ChatMessage OnChatFromClient; 34 event ChatMessage OnChatFromClient;
35 35
36 void SendChatMessage( 36 void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
37 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, 37 byte audible);
38 byte audible);
39 } 38 }
40} \ No newline at end of file 39}
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
deleted file mode 100644
index 16a63e0..0000000
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ /dev/null
@@ -1,228 +0,0 @@
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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Linq;
32using System.Reflection;
33using log4net;
34using OpenMetaverse;
35
36namespace OpenSim.Framework.Console
37{
38 public class ConsoleUtil
39 {
40 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 public const int LocalIdNotFound = 0;
43
44 /// <summary>
45 /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section
46 /// rather than in each help summary.
47 /// </summary>
48 public const string CoordHelp
49 = @"Each component of the coord is comma separated. There must be no spaces between the commas.
50 If you don't care about the z component you can simply omit it.
51 If you don't care about the x or y components then you can leave them blank (though a comma is still required)
52 If you want to specify the maxmimum value of a component then you can use ~ instead of a number
53 If you want to specify the minimum value of a component then you can use -~ instead of a number
54 e.g.
55 delete object pos 20,20,20 to 40,40,40
56 delete object pos 20,20 to 40,40
57 delete object pos ,20,20 to ,40,40
58 delete object pos ,,30 to ,,~
59 delete object pos ,,-~ to ,,30";
60
61 public const string MinRawConsoleVectorValue = "-~";
62 public const string MaxRawConsoleVectorValue = "~";
63
64 public const string VectorSeparator = ",";
65 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
66
67 /// <summary>
68 /// Check if the given file path exists.
69 /// </summary>
70 /// <remarks>If not, warning is printed to the given console.</remarks>
71 /// <returns>true if the file does not exist, false otherwise.</returns>
72 /// <param name='console'></param>
73 /// <param name='path'></param>
74 public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
75 {
76 if (File.Exists(path))
77 {
78 console.OutputFormat("File {0} already exists. Please move or remove it.", path);
79 return false;
80 }
81
82 return true;
83 }
84
85 /// <summary>
86 /// Try to parse a console UUID from the console.
87 /// </summary>
88 /// <remarks>
89 /// Will complain to the console if parsing fails.
90 /// </remarks>
91 /// <returns></returns>
92 /// <param name='console'>If null then no complaint is printed.</param>
93 /// <param name='rawUuid'></param>
94 /// <param name='uuid'></param>
95 public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
96 {
97 if (!UUID.TryParse(rawUuid, out uuid))
98 {
99 if (console != null)
100 console.OutputFormat("{0} is not a valid uuid", rawUuid);
101
102 return false;
103 }
104
105 return true;
106 }
107
108 public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId)
109 {
110 if (!uint.TryParse(rawLocalId, out localId))
111 {
112 if (console != null)
113 console.OutputFormat("{0} is not a valid local id", localId);
114
115 return false;
116 }
117
118 if (localId == 0)
119 {
120 if (console != null)
121 console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId);
122
123 return false;
124 }
125
126 return true;
127 }
128
129 /// <summary>
130 /// Tries to parse the input as either a UUID or a local ID.
131 /// </summary>
132 /// <returns>true if parsing succeeded, false otherwise.</returns>
133 /// <param name='console'></param>
134 /// <param name='rawId'></param>
135 /// <param name='uuid'></param>
136 /// <param name='localId'>
137 /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded.
138 /// </param>
139 public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId)
140 {
141 if (TryParseConsoleUuid(null, rawId, out uuid))
142 {
143 localId = LocalIdNotFound;
144 return true;
145 }
146
147 if (TryParseConsoleLocalId(null, rawId, out localId))
148 {
149 return true;
150 }
151
152 if (console != null)
153 console.OutputFormat("{0} is not a valid UUID or local id", rawId);
154
155 return false;
156 }
157
158 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
160 /// </summary>
161 /// <param name='rawConsoleVector'>/param>
162 /// <param name='vector'></param>
163 /// <returns></returns>
164 public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
165 {
166 return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector);
167 }
168
169 /// <summary>
170 /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3
171 /// </summary>
172 /// <param name='rawConsoleVector'>/param>
173 /// <param name='vector'></param>
174 /// <returns></returns>
175 public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector)
176 {
177 return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector);
178 }
179
180 /// <summary>
181 /// Convert a vector input from the console to an OpenMetaverse.Vector3
182 /// </summary>
183 /// <param name='rawConsoleVector'>
184 /// A string in the form <x>,<y>,<z> where there is no space between values.
185 /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value
186 /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40)
187 /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
188 /// Other than that, component values must be numeric.
189 /// </param>
190 /// <param name='blankComponentFunc'></param>
191 /// <param name='vector'></param>
192 /// <returns></returns>
193 public static bool TryParseConsoleVector(
194 string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
195 {
196 List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
197
198 if (components.Count < 1 || components.Count > 3)
199 {
200 vector = Vector3.Zero;
201 return false;
202 }
203
204 for (int i = components.Count; i < 3; i++)
205 components.Add("");
206
207 List<string> semiDigestedComponents
208 = components.ConvertAll<string>(
209 c =>
210 {
211 if (c == "")
212 return blankComponentFunc.Invoke(c);
213 else if (c == MaxRawConsoleVectorValue)
214 return float.MaxValue.ToString();
215 else if (c == MinRawConsoleVectorValue)
216 return float.MinValue.ToString();
217 else
218 return c;
219 });
220
221 string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray());
222
223 // m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector);
224
225 return Vector3.TryParse(semiDigestedConsoleVector, out vector);
226 }
227 }
228} \ No newline at end of file
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index a2eb5ee..1b1aaf2 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -31,7 +31,6 @@ namespace OpenSim.Framework
31 public class Constants 31 public class Constants
32 { 32 {
33 public const uint RegionSize = 256; 33 public const uint RegionSize = 256;
34 public const uint RegionHeight = 4096;
35 public const byte TerrainPatchSize = 16; 34 public const byte TerrainPatchSize = 16;
36 public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; 35 public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
37 36
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index e03750b..9020761 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -419,11 +419,11 @@ namespace OpenSim.Framework
419 419
420 public void SetFromFlags(ulong regionFlags) 420 public void SetFromFlags(ulong regionFlags)
421 { 421 {
422 ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport); 422 ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport);
423 BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell); 423 BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell);
424 AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark); 424 AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark);
425 AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges); 425 AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges);
426 AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome); 426 AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome);
427 } 427 }
428 428
429 public bool GroupAccess(UUID groupID) 429 public bool GroupAccess(UUID groupID)
diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs
index 6ae0488..a6bf6e3 100644
--- a/OpenSim/Framework/GridInstantMessage.cs
+++ b/OpenSim/Framework/GridInstantMessage.cs
@@ -44,6 +44,7 @@ namespace OpenSim.Framework
44 public Vector3 Position; 44 public Vector3 Position;
45 public byte[] binaryBucket; 45 public byte[] binaryBucket;
46 46
47
47 public uint ParentEstateID; 48 public uint ParentEstateID;
48 public Guid RegionID; 49 public Guid RegionID;
49 public uint timestamp; 50 public uint timestamp;
@@ -57,7 +58,7 @@ namespace OpenSim.Framework
57 string _fromAgentName, UUID _toAgentID, 58 string _fromAgentName, UUID _toAgentID,
58 byte _dialog, bool _fromGroup, string _message, 59 byte _dialog, bool _fromGroup, string _message,
59 UUID _imSessionID, bool _offline, Vector3 _position, 60 UUID _imSessionID, bool _offline, Vector3 _position,
60 byte[] _binaryBucket, bool addTimestamp) 61 byte[] _binaryBucket)
61 { 62 {
62 fromAgentID = _fromAgentID.Guid; 63 fromAgentID = _fromAgentID.Guid;
63 fromAgentName = _fromAgentName; 64 fromAgentName = _fromAgentName;
@@ -78,9 +79,7 @@ namespace OpenSim.Framework
78 ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID; 79 ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID;
79 RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid; 80 RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid;
80 } 81 }
81 82 timestamp = (uint)Util.UnixTimeSinceEpoch();
82 if (addTimestamp)
83 timestamp = (uint)Util.UnixTimeSinceEpoch();
84 } 83 }
85 84
86 public GridInstantMessage(IScene scene, UUID _fromAgentID, 85 public GridInstantMessage(IScene scene, UUID _fromAgentID,
@@ -88,7 +87,7 @@ namespace OpenSim.Framework
88 string _message, bool _offline, 87 string _message, bool _offline,
89 Vector3 _position) : this(scene, _fromAgentID, _fromAgentName, 88 Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
90 _toAgentID, _dialog, false, _message, 89 _toAgentID, _dialog, false, _message,
91 _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true) 90 _fromAgentID ^ _toAgentID, _offline, _position, new byte[0])
92 { 91 {
93 } 92 }
94 } 93 }
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 1c6685a..e31c7f6 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -815,23 +815,8 @@ namespace OpenSim.Framework
815 event Action<IClientAPI> OnRegionHandShakeReply; 815 event Action<IClientAPI> OnRegionHandShakeReply;
816 event GenericCall1 OnRequestWearables; 816 event GenericCall1 OnRequestWearables;
817 event Action<IClientAPI, bool> OnCompleteMovementToRegion; 817 event Action<IClientAPI, bool> OnCompleteMovementToRegion;
818
819 /// <summary>
820 /// Called when an AgentUpdate message is received and before OnAgentUpdate.
821 /// </summary>
822 /// <remarks>
823 /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates.
824 /// </remarks>
825 event UpdateAgent OnPreAgentUpdate; 818 event UpdateAgent OnPreAgentUpdate;
826
827 /// <summary>
828 /// Called when an AgentUpdate message is received and after OnPreAgentUpdate.
829 /// </summary>
830 /// <remarks>
831 /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates.
832 /// </remarks>
833 event UpdateAgent OnAgentUpdate; 819 event UpdateAgent OnAgentUpdate;
834
835 event AgentRequestSit OnAgentRequestSit; 820 event AgentRequestSit OnAgentRequestSit;
836 event AgentSit OnAgentSit; 821 event AgentSit OnAgentSit;
837 event AvatarPickerRequest OnAvatarPickerRequest; 822 event AvatarPickerRequest OnAvatarPickerRequest;
@@ -1061,21 +1046,8 @@ namespace OpenSim.Framework
1061 1046
1062 void InPacket(object NewPack); 1047 void InPacket(object NewPack);
1063 void ProcessInPacket(Packet NewPack); 1048 void ProcessInPacket(Packet NewPack);
1064
1065 /// <summary>
1066 /// Close this client
1067 /// </summary>
1068 void Close(); 1049 void Close();
1069 1050 void Close(bool sendStop);
1070 /// <summary>
1071 /// Close this client
1072 /// </summary>
1073 /// <param name='force'>
1074 /// If true, attempts the close without checking active status. You do not want to try this except as a last
1075 /// ditch attempt where Active == false but the ScenePresence still exists.
1076 /// </param>
1077 void Close(bool sendStop, bool force);
1078
1079 void Kick(string message); 1051 void Kick(string message);
1080 1052
1081 /// <summary> 1053 /// <summary>
@@ -1112,20 +1084,8 @@ namespace OpenSim.Framework
1112 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); 1084 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
1113 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); 1085 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
1114 1086
1115 /// <summary> 1087 void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
1116 /// Send chat to the viewer. 1088 byte audible);
1117 /// </summary>
1118 /// <param name='message'></param>
1119 /// <param name='type'></param>
1120 /// <param name='fromPos'></param>
1121 /// <param name='fromName'></param>
1122 /// <param name='fromAgentID'></param>
1123 /// <param name='ownerID'></param>
1124 /// <param name='source'></param>
1125 /// <param name='audible'></param>
1126 void SendChatMessage(
1127 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
1128 byte audible);
1129 1089
1130 void SendInstantMessage(GridInstantMessage im); 1090 void SendInstantMessage(GridInstantMessage im);
1131 1091
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index b3457a6..a12183c 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -73,27 +73,33 @@ namespace OpenSim.Framework
73 { 73 {
74 } 74 }
75 75
76 public InventoryFolderBase(UUID id) : this() 76 public InventoryFolderBase(UUID id)
77 { 77 {
78 ID = id; 78 ID = id;
79 } 79 }
80 80
81 public InventoryFolderBase(UUID id, UUID owner) : this(id) 81 public InventoryFolderBase(UUID id, UUID owner)
82 { 82 {
83 ID = id;
83 Owner = owner; 84 Owner = owner;
84 } 85 }
85 86
86 public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner) 87 public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
87 { 88 {
89 ID = id;
88 Name = name; 90 Name = name;
91 Owner = owner;
89 ParentID = parent; 92 ParentID = parent;
90 } 93 }
91 94
92 public InventoryFolderBase( 95 public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
93 UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent)
94 { 96 {
97 ID = id;
98 Name = name;
99 Owner = owner;
95 Type = type; 100 Type = type;
101 ParentID = parent;
96 Version = version; 102 Version = version;
97 } 103 }
98 } 104 }
99} \ No newline at end of file 105}
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 4dffd3f..dcaa46d 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Framework
49 // use only one serializer to give the runtime a chance to 49 // use only one serializer to give the runtime a chance to
50 // optimize it (it won't do that if you use a new instance 50 // optimize it (it won't do that if you use a new instance
51 // every time) 51 // every time)
52 private static XmlSerializer serializer = new XmlSerializer(typeof(LandData)); 52 private static XmlSerializer serializer = new XmlSerializer(typeof (LandData));
53 53
54 private Vector3 _AABBMax = new Vector3(); 54 private Vector3 _AABBMax = new Vector3();
55 private Vector3 _AABBMin = new Vector3(); 55 private Vector3 _AABBMin = new Vector3();
56 private int _area = 0; 56 private int _area = 0;
@@ -65,11 +65,11 @@ namespace OpenSim.Framework
65 private byte[] _bitmap = new byte[512]; 65 private byte[] _bitmap = new byte[512];
66 private string _description = String.Empty; 66 private string _description = String.Empty;
67 67
68 private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark | 68 private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
69 (uint)ParcelFlags.AllowAPrimitiveEntry | 69 (uint) ParcelFlags.AllowAPrimitiveEntry |
70 (uint)ParcelFlags.AllowDeedToGroup | 70 (uint) ParcelFlags.AllowDeedToGroup |
71 (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts | 71 (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
72 (uint)ParcelFlags.AllowVoiceChat; 72 (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
73 73
74 private byte _landingType = 0; 74 private byte _landingType = 0;
75 private string _name = "Your Parcel"; 75 private string _name = "Your Parcel";
@@ -97,36 +97,16 @@ namespace OpenSim.Framework
97 private bool _mediaLoop = false; 97 private bool _mediaLoop = false;
98 private bool _obscureMusic = false; 98 private bool _obscureMusic = false;
99 private bool _obscureMedia = false; 99 private bool _obscureMedia = false;
100 private float _dwell = 0;
101
102 /// <summary>
103 /// Traffic count of parcel
104 /// </summary>
105 [XmlIgnore]
106 public float Dwell
107 {
108 get
109 {
110 return _dwell;
111 }
112 set
113 {
114 _dwell = value;
115 }
116 }
117 100
118 /// <summary> 101 /// <summary>
119 /// Whether to obscure parcel media URL 102 /// Whether to obscure parcel media URL
120 /// </summary> 103 /// </summary>
121 [XmlIgnore] 104 [XmlIgnore]
122 public bool ObscureMedia 105 public bool ObscureMedia {
123 { 106 get {
124 get
125 {
126 return _obscureMedia; 107 return _obscureMedia;
127 } 108 }
128 set 109 set {
129 {
130 _obscureMedia = value; 110 _obscureMedia = value;
131 } 111 }
132 } 112 }
@@ -135,14 +115,11 @@ namespace OpenSim.Framework
135 /// Whether to obscure parcel music URL 115 /// Whether to obscure parcel music URL
136 /// </summary> 116 /// </summary>
137 [XmlIgnore] 117 [XmlIgnore]
138 public bool ObscureMusic 118 public bool ObscureMusic {
139 { 119 get {
140 get
141 {
142 return _obscureMusic; 120 return _obscureMusic;
143 } 121 }
144 set 122 set {
145 {
146 _obscureMusic = value; 123 _obscureMusic = value;
147 } 124 }
148 } 125 }
@@ -151,14 +128,11 @@ namespace OpenSim.Framework
151 /// Whether to loop parcel media 128 /// Whether to loop parcel media
152 /// </summary> 129 /// </summary>
153 [XmlIgnore] 130 [XmlIgnore]
154 public bool MediaLoop 131 public bool MediaLoop {
155 { 132 get {
156 get
157 {
158 return _mediaLoop; 133 return _mediaLoop;
159 } 134 }
160 set 135 set {
161 {
162 _mediaLoop = value; 136 _mediaLoop = value;
163 } 137 }
164 } 138 }
@@ -167,14 +141,11 @@ namespace OpenSim.Framework
167 /// Height of parcel media render 141 /// Height of parcel media render
168 /// </summary> 142 /// </summary>
169 [XmlIgnore] 143 [XmlIgnore]
170 public int MediaHeight 144 public int MediaHeight {
171 { 145 get {
172 get
173 {
174 return _mediaHeight; 146 return _mediaHeight;
175 } 147 }
176 set 148 set {
177 {
178 _mediaHeight = value; 149 _mediaHeight = value;
179 } 150 }
180 } 151 }
@@ -183,14 +154,11 @@ namespace OpenSim.Framework
183 /// Width of parcel media render 154 /// Width of parcel media render
184 /// </summary> 155 /// </summary>
185 [XmlIgnore] 156 [XmlIgnore]
186 public int MediaWidth 157 public int MediaWidth {
187 { 158 get {
188 get
189 {
190 return _mediaWidth; 159 return _mediaWidth;
191 } 160 }
192 set 161 set {
193 {
194 _mediaWidth = value; 162 _mediaWidth = value;
195 } 163 }
196 } 164 }
@@ -199,14 +167,11 @@ namespace OpenSim.Framework
199 /// Upper corner of the AABB for the parcel 167 /// Upper corner of the AABB for the parcel
200 /// </summary> 168 /// </summary>
201 [XmlIgnore] 169 [XmlIgnore]
202 public Vector3 AABBMax 170 public Vector3 AABBMax {
203 { 171 get {
204 get
205 {
206 return _AABBMax; 172 return _AABBMax;
207 } 173 }
208 set 174 set {
209 {
210 _AABBMax = value; 175 _AABBMax = value;
211 } 176 }
212 } 177 }
@@ -214,14 +179,11 @@ namespace OpenSim.Framework
214 /// Lower corner of the AABB for the parcel 179 /// Lower corner of the AABB for the parcel
215 /// </summary> 180 /// </summary>
216 [XmlIgnore] 181 [XmlIgnore]
217 public Vector3 AABBMin 182 public Vector3 AABBMin {
218 { 183 get {
219 get
220 {
221 return _AABBMin; 184 return _AABBMin;
222 } 185 }
223 set 186 set {
224 {
225 _AABBMin = value; 187 _AABBMin = value;
226 } 188 }
227 } 189 }
@@ -229,14 +191,11 @@ namespace OpenSim.Framework
229 /// <summary> 191 /// <summary>
230 /// Area in meters^2 the parcel contains 192 /// Area in meters^2 the parcel contains
231 /// </summary> 193 /// </summary>
232 public int Area 194 public int Area {
233 { 195 get {
234 get
235 {
236 return _area; 196 return _area;
237 } 197 }
238 set 198 set {
239 {
240 _area = value; 199 _area = value;
241 } 200 }
242 } 201 }
@@ -244,14 +203,11 @@ namespace OpenSim.Framework
244 /// <summary> 203 /// <summary>
245 /// ID of auction (3rd Party Integration) when parcel is being auctioned 204 /// ID of auction (3rd Party Integration) when parcel is being auctioned
246 /// </summary> 205 /// </summary>
247 public uint AuctionID 206 public uint AuctionID {
248 { 207 get {
249 get
250 {
251 return _auctionID; 208 return _auctionID;
252 } 209 }
253 set 210 set {
254 {
255 _auctionID = value; 211 _auctionID = value;
256 } 212 }
257 } 213 }
@@ -259,14 +215,11 @@ namespace OpenSim.Framework
259 /// <summary> 215 /// <summary>
260 /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it. 216 /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
261 /// </summary> 217 /// </summary>
262 public UUID AuthBuyerID 218 public UUID AuthBuyerID {
263 { 219 get {
264 get
265 {
266 return _authBuyerID; 220 return _authBuyerID;
267 } 221 }
268 set 222 set {
269 {
270 _authBuyerID = value; 223 _authBuyerID = value;
271 } 224 }
272 } 225 }
@@ -274,14 +227,11 @@ namespace OpenSim.Framework
274 /// <summary> 227 /// <summary>
275 /// Category of parcel. Used for classifying the parcel in classified listings 228 /// Category of parcel. Used for classifying the parcel in classified listings
276 /// </summary> 229 /// </summary>
277 public ParcelCategory Category 230 public ParcelCategory Category {
278 { 231 get {
279 get
280 {
281 return _category; 232 return _category;
282 } 233 }
283 set 234 set {
284 {
285 _category = value; 235 _category = value;
286 } 236 }
287 } 237 }
@@ -289,14 +239,11 @@ namespace OpenSim.Framework
289 /// <summary> 239 /// <summary>
290 /// Date that the current owner purchased or claimed the parcel 240 /// Date that the current owner purchased or claimed the parcel
291 /// </summary> 241 /// </summary>
292 public int ClaimDate 242 public int ClaimDate {
293 { 243 get {
294 get
295 {
296 return _claimDate; 244 return _claimDate;
297 } 245 }
298 set 246 set {
299 {
300 _claimDate = value; 247 _claimDate = value;
301 } 248 }
302 } 249 }
@@ -304,14 +251,11 @@ namespace OpenSim.Framework
304 /// <summary> 251 /// <summary>
305 /// The last price that the parcel was sold at 252 /// The last price that the parcel was sold at
306 /// </summary> 253 /// </summary>
307 public int ClaimPrice 254 public int ClaimPrice {
308 { 255 get {
309 get
310 {
311 return _claimPrice; 256 return _claimPrice;
312 } 257 }
313 set 258 set {
314 {
315 _claimPrice = value; 259 _claimPrice = value;
316 } 260 }
317 } 261 }
@@ -319,14 +263,11 @@ namespace OpenSim.Framework
319 /// <summary> 263 /// <summary>
320 /// Global ID for the parcel. (3rd Party Integration) 264 /// Global ID for the parcel. (3rd Party Integration)
321 /// </summary> 265 /// </summary>
322 public UUID GlobalID 266 public UUID GlobalID {
323 { 267 get {
324 get
325 {
326 return _globalID; 268 return _globalID;
327 } 269 }
328 set 270 set {
329 {
330 _globalID = value; 271 _globalID = value;
331 } 272 }
332 } 273 }
@@ -334,14 +275,11 @@ namespace OpenSim.Framework
334 /// <summary> 275 /// <summary>
335 /// Unique ID of the Group that owns 276 /// Unique ID of the Group that owns
336 /// </summary> 277 /// </summary>
337 public UUID GroupID 278 public UUID GroupID {
338 { 279 get {
339 get
340 {
341 return _groupID; 280 return _groupID;
342 } 281 }
343 set 282 set {
344 {
345 _groupID = value; 283 _groupID = value;
346 } 284 }
347 } 285 }
@@ -349,14 +287,11 @@ namespace OpenSim.Framework
349 /// <summary> 287 /// <summary>
350 /// Returns true if the Land Parcel is owned by a group 288 /// Returns true if the Land Parcel is owned by a group
351 /// </summary> 289 /// </summary>
352 public bool IsGroupOwned 290 public bool IsGroupOwned {
353 { 291 get {
354 get
355 {
356 return _isGroupOwned; 292 return _isGroupOwned;
357 } 293 }
358 set 294 set {
359 {
360 _isGroupOwned = value; 295 _isGroupOwned = value;
361 } 296 }
362 } 297 }
@@ -364,14 +299,11 @@ namespace OpenSim.Framework
364 /// <summary> 299 /// <summary>
365 /// jp2 data for the image representative of the parcel in the parcel dialog 300 /// jp2 data for the image representative of the parcel in the parcel dialog
366 /// </summary> 301 /// </summary>
367 public byte[] Bitmap 302 public byte[] Bitmap {
368 { 303 get {
369 get
370 {
371 return _bitmap; 304 return _bitmap;
372 } 305 }
373 set 306 set {
374 {
375 _bitmap = value; 307 _bitmap = value;
376 } 308 }
377 } 309 }
@@ -379,14 +311,11 @@ namespace OpenSim.Framework
379 /// <summary> 311 /// <summary>
380 /// Parcel Description 312 /// Parcel Description
381 /// </summary> 313 /// </summary>
382 public string Description 314 public string Description {
383 { 315 get {
384 get
385 {
386 return _description; 316 return _description;
387 } 317 }
388 set 318 set {
389 {
390 _description = value; 319 _description = value;
391 } 320 }
392 } 321 }
@@ -394,14 +323,11 @@ namespace OpenSim.Framework
394 /// <summary> 323 /// <summary>
395 /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags 324 /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags
396 /// </summary> 325 /// </summary>
397 public uint Flags 326 public uint Flags {
398 { 327 get {
399 get
400 {
401 return _flags; 328 return _flags;
402 } 329 }
403 set 330 set {
404 {
405 _flags = value; 331 _flags = value;
406 } 332 }
407 } 333 }
@@ -410,14 +336,11 @@ namespace OpenSim.Framework
410 /// Determines if people are able to teleport where they please on the parcel or if they 336 /// Determines if people are able to teleport where they please on the parcel or if they
411 /// get constrainted to a specific point on teleport within the parcel 337 /// get constrainted to a specific point on teleport within the parcel
412 /// </summary> 338 /// </summary>
413 public byte LandingType 339 public byte LandingType {
414 { 340 get {
415 get
416 {
417 return _landingType; 341 return _landingType;
418 } 342 }
419 set 343 set {
420 {
421 _landingType = value; 344 _landingType = value;
422 } 345 }
423 } 346 }
@@ -425,14 +348,11 @@ namespace OpenSim.Framework
425 /// <summary> 348 /// <summary>
426 /// Parcel Name 349 /// Parcel Name
427 /// </summary> 350 /// </summary>
428 public string Name 351 public string Name {
429 { 352 get {
430 get
431 {
432 return _name; 353 return _name;
433 } 354 }
434 set 355 set {
435 {
436 _name = value; 356 _name = value;
437 } 357 }
438 } 358 }
@@ -440,14 +360,11 @@ namespace OpenSim.Framework
440 /// <summary> 360 /// <summary>
441 /// Status of Parcel, Leased, Abandoned, For Sale 361 /// Status of Parcel, Leased, Abandoned, For Sale
442 /// </summary> 362 /// </summary>
443 public ParcelStatus Status 363 public ParcelStatus Status {
444 { 364 get {
445 get
446 {
447 return _status; 365 return _status;
448 } 366 }
449 set 367 set {
450 {
451 _status = value; 368 _status = value;
452 } 369 }
453 } 370 }
@@ -455,14 +372,11 @@ namespace OpenSim.Framework
455 /// <summary> 372 /// <summary>
456 /// Internal ID of the parcel. Sometimes the client will try to use this value 373 /// Internal ID of the parcel. Sometimes the client will try to use this value
457 /// </summary> 374 /// </summary>
458 public int LocalID 375 public int LocalID {
459 { 376 get {
460 get
461 {
462 return _localID; 377 return _localID;
463 } 378 }
464 set 379 set {
465 {
466 _localID = value; 380 _localID = value;
467 } 381 }
468 } 382 }
@@ -470,14 +384,11 @@ namespace OpenSim.Framework
470 /// <summary> 384 /// <summary>
471 /// Determines if we scale the media based on the surface it's on 385 /// Determines if we scale the media based on the surface it's on
472 /// </summary> 386 /// </summary>
473 public byte MediaAutoScale 387 public byte MediaAutoScale {
474 { 388 get {
475 get
476 {
477 return _mediaAutoScale; 389 return _mediaAutoScale;
478 } 390 }
479 set 391 set {
480 {
481 _mediaAutoScale = value; 392 _mediaAutoScale = value;
482 } 393 }
483 } 394 }
@@ -485,14 +396,11 @@ namespace OpenSim.Framework
485 /// <summary> 396 /// <summary>
486 /// Texture Guid to replace with the output of the media stream 397 /// Texture Guid to replace with the output of the media stream
487 /// </summary> 398 /// </summary>
488 public UUID MediaID 399 public UUID MediaID {
489 { 400 get {
490 get
491 {
492 return _mediaID; 401 return _mediaID;
493 } 402 }
494 set 403 set {
495 {
496 _mediaID = value; 404 _mediaID = value;
497 } 405 }
498 } 406 }
@@ -500,14 +408,11 @@ namespace OpenSim.Framework
500 /// <summary> 408 /// <summary>
501 /// URL to the media file to display 409 /// URL to the media file to display
502 /// </summary> 410 /// </summary>
503 public string MediaURL 411 public string MediaURL {
504 { 412 get {
505 get
506 {
507 return _mediaURL; 413 return _mediaURL;
508 } 414 }
509 set 415 set {
510 {
511 _mediaURL = value; 416 _mediaURL = value;
512 } 417 }
513 } 418 }
@@ -527,14 +432,11 @@ namespace OpenSim.Framework
527 /// <summary> 432 /// <summary>
528 /// URL to the shoutcast music stream to play on the parcel 433 /// URL to the shoutcast music stream to play on the parcel
529 /// </summary> 434 /// </summary>
530 public string MusicURL 435 public string MusicURL {
531 { 436 get {
532 get
533 {
534 return _musicURL; 437 return _musicURL;
535 } 438 }
536 set 439 set {
537 {
538 _musicURL = value; 440 _musicURL = value;
539 } 441 }
540 } 442 }
@@ -543,14 +445,11 @@ namespace OpenSim.Framework
543 /// Owner Avatar or Group of the parcel. Naturally, all land masses must be 445 /// Owner Avatar or Group of the parcel. Naturally, all land masses must be
544 /// owned by someone 446 /// owned by someone
545 /// </summary> 447 /// </summary>
546 public UUID OwnerID 448 public UUID OwnerID {
547 { 449 get {
548 get
549 {
550 return _ownerID; 450 return _ownerID;
551 } 451 }
552 set 452 set {
553 {
554 _ownerID = value; 453 _ownerID = value;
555 } 454 }
556 } 455 }
@@ -558,14 +457,11 @@ namespace OpenSim.Framework
558 /// <summary> 457 /// <summary>
559 /// List of access data for the parcel. User data, some bitflags, and a time 458 /// List of access data for the parcel. User data, some bitflags, and a time
560 /// </summary> 459 /// </summary>
561 public List<LandAccessEntry> ParcelAccessList 460 public List<LandAccessEntry> ParcelAccessList {
562 { 461 get {
563 get
564 {
565 return _parcelAccessList; 462 return _parcelAccessList;
566 } 463 }
567 set 464 set {
568 {
569 _parcelAccessList = value; 465 _parcelAccessList = value;
570 } 466 }
571 } 467 }
@@ -573,14 +469,11 @@ namespace OpenSim.Framework
573 /// <summary> 469 /// <summary>
574 /// How long in hours a Pass to the parcel is given 470 /// How long in hours a Pass to the parcel is given
575 /// </summary> 471 /// </summary>
576 public float PassHours 472 public float PassHours {
577 { 473 get {
578 get
579 {
580 return _passHours; 474 return _passHours;
581 } 475 }
582 set 476 set {
583 {
584 _passHours = value; 477 _passHours = value;
585 } 478 }
586 } 479 }
@@ -588,14 +481,11 @@ namespace OpenSim.Framework
588 /// <summary> 481 /// <summary>
589 /// Price to purchase a Pass to a restricted parcel 482 /// Price to purchase a Pass to a restricted parcel
590 /// </summary> 483 /// </summary>
591 public int PassPrice 484 public int PassPrice {
592 { 485 get {
593 get
594 {
595 return _passPrice; 486 return _passPrice;
596 } 487 }
597 set 488 set {
598 {
599 _passPrice = value; 489 _passPrice = value;
600 } 490 }
601 } 491 }
@@ -603,14 +493,11 @@ namespace OpenSim.Framework
603 /// <summary> 493 /// <summary>
604 /// When the parcel is being sold, this is the price to purchase the parcel 494 /// When the parcel is being sold, this is the price to purchase the parcel
605 /// </summary> 495 /// </summary>
606 public int SalePrice 496 public int SalePrice {
607 { 497 get {
608 get
609 {
610 return _salePrice; 498 return _salePrice;
611 } 499 }
612 set 500 set {
613 {
614 _salePrice = value; 501 _salePrice = value;
615 } 502 }
616 } 503 }
@@ -619,14 +506,11 @@ namespace OpenSim.Framework
619 /// Number of meters^2 in the Simulator 506 /// Number of meters^2 in the Simulator
620 /// </summary> 507 /// </summary>
621 [XmlIgnore] 508 [XmlIgnore]
622 public int SimwideArea 509 public int SimwideArea {
623 { 510 get {
624 get
625 {
626 return _simwideArea; 511 return _simwideArea;
627 } 512 }
628 set 513 set {
629 {
630 _simwideArea = value; 514 _simwideArea = value;
631 } 515 }
632 } 516 }
@@ -635,14 +519,11 @@ namespace OpenSim.Framework
635 /// Number of SceneObjectPart in the Simulator 519 /// Number of SceneObjectPart in the Simulator
636 /// </summary> 520 /// </summary>
637 [XmlIgnore] 521 [XmlIgnore]
638 public int SimwidePrims 522 public int SimwidePrims {
639 { 523 get {
640 get
641 {
642 return _simwidePrims; 524 return _simwidePrims;
643 } 525 }
644 set 526 set {
645 {
646 _simwidePrims = value; 527 _simwidePrims = value;
647 } 528 }
648 } 529 }
@@ -650,14 +531,11 @@ namespace OpenSim.Framework
650 /// <summary> 531 /// <summary>
651 /// ID of the snapshot used in the client parcel dialog of the parcel 532 /// ID of the snapshot used in the client parcel dialog of the parcel
652 /// </summary> 533 /// </summary>
653 public UUID SnapshotID 534 public UUID SnapshotID {
654 { 535 get {
655 get
656 {
657 return _snapshotID; 536 return _snapshotID;
658 } 537 }
659 set 538 set {
660 {
661 _snapshotID = value; 539 _snapshotID = value;
662 } 540 }
663 } 541 }
@@ -666,14 +544,11 @@ namespace OpenSim.Framework
666 /// When teleporting is restricted to a certain point, this is the location 544 /// When teleporting is restricted to a certain point, this is the location
667 /// that the user will be redirected to 545 /// that the user will be redirected to
668 /// </summary> 546 /// </summary>
669 public Vector3 UserLocation 547 public Vector3 UserLocation {
670 { 548 get {
671 get
672 {
673 return _userLocation; 549 return _userLocation;
674 } 550 }
675 set 551 set {
676 {
677 _userLocation = value; 552 _userLocation = value;
678 } 553 }
679 } 554 }
@@ -682,14 +557,11 @@ namespace OpenSim.Framework
682 /// When teleporting is restricted to a certain point, this is the rotation 557 /// When teleporting is restricted to a certain point, this is the rotation
683 /// that the user will be positioned 558 /// that the user will be positioned
684 /// </summary> 559 /// </summary>
685 public Vector3 UserLookAt 560 public Vector3 UserLookAt {
686 { 561 get {
687 get
688 {
689 return _userLookAt; 562 return _userLookAt;
690 } 563 }
691 set 564 set {
692 {
693 _userLookAt = value; 565 _userLookAt = value;
694 } 566 }
695 } 567 }
@@ -698,14 +570,11 @@ namespace OpenSim.Framework
698 /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own 570 /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
699 /// the parcel and isn't set to the same 'group' as the parcel. 571 /// the parcel and isn't set to the same 'group' as the parcel.
700 /// </summary> 572 /// </summary>
701 public int OtherCleanTime 573 public int OtherCleanTime {
702 { 574 get {
703 get
704 {
705 return _otherCleanTime; 575 return _otherCleanTime;
706 } 576 }
707 set 577 set {
708 {
709 _otherCleanTime = value; 578 _otherCleanTime = value;
710 } 579 }
711 } 580 }
@@ -713,14 +582,11 @@ namespace OpenSim.Framework
713 /// <summary> 582 /// <summary>
714 /// parcel media description 583 /// parcel media description
715 /// </summary> 584 /// </summary>
716 public string MediaDescription 585 public string MediaDescription {
717 { 586 get {
718 get
719 {
720 return _mediaDescription; 587 return _mediaDescription;
721 } 588 }
722 set 589 set {
723 {
724 _mediaDescription = value; 590 _mediaDescription = value;
725 } 591 }
726 } 592 }
@@ -756,7 +622,7 @@ namespace OpenSim.Framework
756 landData._mediaURL = _mediaURL; 622 landData._mediaURL = _mediaURL;
757 landData._musicURL = _musicURL; 623 landData._musicURL = _musicURL;
758 landData._ownerID = _ownerID; 624 landData._ownerID = _ownerID;
759 landData._bitmap = (byte[])_bitmap.Clone(); 625 landData._bitmap = (byte[]) _bitmap.Clone();
760 landData._description = _description; 626 landData._description = _description;
761 landData._flags = _flags; 627 landData._flags = _flags;
762 landData._name = _name; 628 landData._name = _name;
@@ -777,7 +643,6 @@ namespace OpenSim.Framework
777 landData._obscureMedia = _obscureMedia; 643 landData._obscureMedia = _obscureMedia;
778 landData._simwideArea = _simwideArea; 644 landData._simwideArea = _simwideArea;
779 landData._simwidePrims = _simwidePrims; 645 landData._simwidePrims = _simwidePrims;
780 landData._dwell = _dwell;
781 646
782 landData._parcelAccessList.Clear(); 647 landData._parcelAccessList.Clear();
783 foreach (LandAccessEntry entry in _parcelAccessList) 648 foreach (LandAccessEntry entry in _parcelAccessList)
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
index 446e3c0..9ee0876 100644
--- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
@@ -43,32 +43,27 @@ namespace OpenSim.Framework.Monitoring
43 StringBuilder sb = new StringBuilder(Environment.NewLine); 43 StringBuilder sb = new StringBuilder(Environment.NewLine);
44 sb.Append("MEMORY STATISTICS"); 44 sb.Append("MEMORY STATISTICS");
45 sb.Append(Environment.NewLine); 45 sb.Append(Environment.NewLine);
46 sb.AppendFormat( 46 sb.Append(
47 string.Format(
47 "Allocated to OpenSim objects: {0} MB\n", 48 "Allocated to OpenSim objects: {0} MB\n",
48 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); 49 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
49
50 sb.AppendFormat(
51 "OpenSim last object memory churn : {0} MB/s\n",
52 Math.Round((MemoryWatchdog.LastMemoryChurn * 1000) / 1024.0 / 1024, 3));
53
54 sb.AppendFormat(
55 "OpenSim average object memory churn : {0} MB/s\n",
56 Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
57 50
58 Process myprocess = Process.GetCurrentProcess(); 51 Process myprocess = Process.GetCurrentProcess();
59 if (!myprocess.HasExited) 52 if (!myprocess.HasExited)
60 { 53 {
61 myprocess.Refresh(); 54 myprocess.Refresh();
62 sb.AppendFormat( 55 sb.Append(
56 string.Format(
63 "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", 57 "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
64 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0), 58 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0),
65 Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0), 59 Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0),
66 Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)); 60 Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)));
67 sb.AppendFormat( 61 sb.Append(
62 string.Format(
68 "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", 63 "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
69 Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0), 64 Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0),
70 Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0), 65 Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0),
71 Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)); 66 Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)));
72 } 67 }
73 else 68 else
74 sb.Append("Process reported as Exited \n"); 69 sb.Append("Process reported as Exited \n");
diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
index c6010cd..a23cf1f 100644
--- a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
+++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Framework.Monitoring
60 private static bool m_enabled; 60 private static bool m_enabled;
61 61
62 /// <summary> 62 /// <summary>
63 /// Last memory churn in bytes per millisecond. 63 /// Average memory churn in bytes per millisecond.
64 /// </summary> 64 /// </summary>
65 public static double AverageMemoryChurn 65 public static double AverageMemoryChurn
66 { 66 {
@@ -68,14 +68,6 @@ namespace OpenSim.Framework.Monitoring
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// Average memory churn in bytes per millisecond.
72 /// </summary>
73 public static double LastMemoryChurn
74 {
75 get { if (m_samples.Count > 0) return m_samples.Last(); else return 0; }
76 }
77
78 /// <summary>
79 /// Maximum number of statistical samples. 71 /// Maximum number of statistical samples.
80 /// </summary> 72 /// </summary>
81 /// <remarks> 73 /// <remarks>
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index aa86202..cdd7cc7 100644
--- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -355,25 +355,10 @@ Asset service request failures: {3}" + Environment.NewLine,
355 sb.Append(Environment.NewLine); 355 sb.Append(Environment.NewLine);
356 sb.Append( 356 sb.Append(
357 string.Format( 357 string.Format(
358 "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n\n", 358 "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}",
359 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, 359 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
360 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); 360 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
361 361 sb.Append(Environment.NewLine);
362 Dictionary<string, Dictionary<string, Stat>> sceneStats;
363
364 if (StatsManager.TryGetStats("scene", out sceneStats))
365 {
366 foreach (KeyValuePair<string, Dictionary<string, Stat>> kvp in sceneStats)
367 {
368 foreach (Stat stat in kvp.Value.Values)
369 {
370 if (stat.Verbosity == StatVerbosity.Info)
371 {
372 sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName);
373 }
374 }
375 }
376 }
377 362
378 /* 363 /*
379 sb.Append(Environment.NewLine); 364 sb.Append(Environment.NewLine);
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 4844336..d78fa6a 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -25,9 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic;
30
31namespace OpenSim.Framework.Monitoring 28namespace OpenSim.Framework.Monitoring
32{ 29{
33 /// <summary> 30 /// <summary>
@@ -35,24 +32,6 @@ namespace OpenSim.Framework.Monitoring
35 /// </summary> 32 /// </summary>
36 public class StatsManager 33 public class StatsManager
37 { 34 {
38 // Subcommand used to list other stats.
39 public const string AllSubCommand = "all";
40
41 // Subcommand used to list other stats.
42 public const string ListSubCommand = "list";
43
44 // All subcommands
45 public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand };
46
47 /// <summary>
48 /// Registered stats categorized by category/container/shortname
49 /// </summary>
50 /// <remarks>
51 /// Do not add or remove directly from this dictionary.
52 /// </remarks>
53 public static Dictionary<string, Dictionary<string, Dictionary<string, Stat>>> RegisteredStats
54 = new Dictionary<string, Dictionary<string, Dictionary<string, Stat>>>();
55
56 private static AssetStatsCollector assetStats; 35 private static AssetStatsCollector assetStats;
57 private static UserStatsCollector userStats; 36 private static UserStatsCollector userStats;
58 private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector(); 37 private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
@@ -61,75 +40,6 @@ namespace OpenSim.Framework.Monitoring
61 public static UserStatsCollector UserStats { get { return userStats; } } 40 public static UserStatsCollector UserStats { get { return userStats; } }
62 public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } 41 public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
63 42
64 public static void RegisterConsoleCommands(ICommandConsole console)
65 {
66 console.Commands.AddCommand(
67 "General",
68 false,
69 "show stats",
70 "show stats [list|all|<category>]",
71 "Show statistical information for this server",
72 "If no final argument is specified then legacy statistics information is currently shown.\n"
73 + "If list is specified then statistic categories are shown.\n"
74 + "If all is specified then all registered statistics are shown.\n"
75 + "If a category name is specified then only statistics from that category are shown.\n"
76 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
77 HandleShowStatsCommand);
78 }
79
80 public static void HandleShowStatsCommand(string module, string[] cmd)
81 {
82 ICommandConsole con = MainConsole.Instance;
83
84 if (cmd.Length > 2)
85 {
86 var categoryName = cmd[2];
87
88 if (categoryName == AllSubCommand)
89 {
90 foreach (var category in RegisteredStats.Values)
91 {
92 OutputCategoryStatsToConsole(con, category);
93 }
94 }
95 else if (categoryName == ListSubCommand)
96 {
97 con.Output("Statistic categories available are:");
98 foreach (string category in RegisteredStats.Keys)
99 con.OutputFormat(" {0}", category);
100 }
101 else
102 {
103 Dictionary<string, Dictionary<string, Stat>> category;
104 if (!RegisteredStats.TryGetValue(categoryName, out category))
105 {
106 con.OutputFormat("No such category as {0}", categoryName);
107 }
108 else
109 {
110 OutputCategoryStatsToConsole(con, category);
111 }
112 }
113 }
114 else
115 {
116 // Legacy
117 con.Output(SimExtraStats.Report());
118 }
119 }
120
121 private static void OutputCategoryStatsToConsole(
122 ICommandConsole con, Dictionary<string, Dictionary<string, Stat>> category)
123 {
124 foreach (var container in category.Values)
125 {
126 foreach (Stat stat in container.Values)
127 {
128 con.Output(stat.ToConsoleString());
129 }
130 }
131 }
132
133 /// <summary> 43 /// <summary>
134 /// Start collecting statistics related to assets. 44 /// Start collecting statistics related to assets.
135 /// Should only be called once. 45 /// Should only be called once.
@@ -151,275 +61,5 @@ namespace OpenSim.Framework.Monitoring
151 61
152 return userStats; 62 return userStats;
153 } 63 }
154
155 /// <summary>
156 /// Registers a statistic.
157 /// </summary>
158 /// <param name='stat'></param>
159 /// <returns></returns>
160 public static bool RegisterStat(Stat stat)
161 {
162 Dictionary<string, Dictionary<string, Stat>> category = null, newCategory;
163 Dictionary<string, Stat> container = null, newContainer;
164
165 lock (RegisteredStats)
166 {
167 // Stat name is not unique across category/container/shortname key.
168 // XXX: For now just return false. This is to avoid problems in regression tests where all tests
169 // in a class are run in the same instance of the VM.
170 if (TryGetStat(stat, out category, out container))
171 return false;
172
173 // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
174 // This means that we don't need to lock or copy them on iteration, which will be a much more
175 // common operation after startup.
176 if (container != null)
177 newContainer = new Dictionary<string, Stat>(container);
178 else
179 newContainer = new Dictionary<string, Stat>();
180
181 if (category != null)
182 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category);
183 else
184 newCategory = new Dictionary<string, Dictionary<string, Stat>>();
185
186 newContainer[stat.ShortName] = stat;
187 newCategory[stat.Container] = newContainer;
188 RegisteredStats[stat.Category] = newCategory;
189 }
190
191 return true;
192 }
193
194 /// <summary>
195 /// Deregister a statistic
196 /// </summary>>
197 /// <param name='stat'></param>
198 /// <returns></returns
199 public static bool DeregisterStat(Stat stat)
200 {
201 Dictionary<string, Dictionary<string, Stat>> category = null, newCategory;
202 Dictionary<string, Stat> container = null, newContainer;
203
204 lock (RegisteredStats)
205 {
206 if (!TryGetStat(stat, out category, out container))
207 return false;
208
209 newContainer = new Dictionary<string, Stat>(container);
210 newContainer.Remove(stat.ShortName);
211
212 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category);
213 newCategory.Remove(stat.Container);
214
215 newCategory[stat.Container] = newContainer;
216 RegisteredStats[stat.Category] = newCategory;
217
218 return true;
219 }
220 }
221
222 public static bool TryGetStats(string category, out Dictionary<string, Dictionary<string, Stat>> stats)
223 {
224 return RegisteredStats.TryGetValue(category, out stats);
225 }
226
227 public static bool TryGetStat(
228 Stat stat,
229 out Dictionary<string, Dictionary<string, Stat>> category,
230 out Dictionary<string, Stat> container)
231 {
232 category = null;
233 container = null;
234
235 lock (RegisteredStats)
236 {
237 if (RegisteredStats.TryGetValue(stat.Category, out category))
238 {
239 if (category.TryGetValue(stat.Container, out container))
240 {
241 if (container.ContainsKey(stat.ShortName))
242 return true;
243 }
244 }
245 }
246
247 return false;
248 }
249 }
250
251 /// <summary>
252 /// Stat type.
253 /// </summary>
254 /// <remarks>
255 /// A push stat is one which is continually updated and so it's value can simply by read.
256 /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated.
257 /// </remarks>
258 public enum StatType
259 {
260 Push,
261 Pull
262 }
263
264 /// <summary>
265 /// Verbosity of stat.
266 /// </summary>
267 /// <remarks>
268 /// Info will always be displayed.
269 /// </remarks>
270 public enum StatVerbosity
271 {
272 Debug,
273 Info
274 }
275
276 /// <summary>
277 /// Holds individual static details
278 /// </summary>
279 public class Stat
280 {
281 /// <summary>
282 /// Category of this stat (e.g. cache, scene, etc).
283 /// </summary>
284 public string Category { get; private set; }
285
286 /// <summary>
287 /// Containing name for this stat.
288 /// FIXME: In the case of a scene, this is currently the scene name (though this leaves
289 /// us with a to-be-resolved problem of non-unique region names).
290 /// </summary>
291 /// <value>
292 /// The container.
293 /// </value>
294 public string Container { get; private set; }
295
296 public StatType StatType { get; private set; }
297
298 /// <summary>
299 /// Action used to update this stat when the value is requested if it's a pull type.
300 /// </summary>
301 public Action<Stat> PullAction { get; private set; }
302
303 public StatVerbosity Verbosity { get; private set; }
304 public string ShortName { get; private set; }
305 public string Name { get; private set; }
306 public string Description { get; private set; }
307 public virtual string UnitName { get; private set; }
308
309 public virtual double Value
310 {
311 get
312 {
313 // Asking for an update here means that the updater cannot access this value without infinite recursion.
314 // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
315 // called by the pull action and just return the value.
316 if (StatType == StatType.Pull)
317 PullAction(this);
318
319 return m_value;
320 }
321
322 set
323 {
324 m_value = value;
325 }
326 }
327
328 private double m_value;
329
330 /// <summary>
331 /// Constructor
332 /// </summary>
333 /// <param name='shortName'>Short name for the stat. Must not contain spaces. e.g. "LongFrames"</param>
334 /// <param name='name'>Human readable name for the stat. e.g. "Long frames"</param>
335 /// <param name='description'>Description of stat</param>
336 /// <param name='unitName'>
337 /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
338 /// e.g. " frames"
339 /// </param>
340 /// <param name='category'>Category under which this stat should appear, e.g. "scene". Do not capitalize.</param>
341 /// <param name='container'>Entity to which this stat relates. e.g. scene name if this is a per scene stat.</param>
342 /// <param name='type'>Push or pull</param>
343 /// <param name='pullAction'>Pull stats need an action to update the stat on request. Push stats should set null here.</param>
344 /// <param name='verbosity'>Verbosity of stat. Controls whether it will appear in short stat display or only full display.</param>
345 public Stat(
346 string shortName,
347 string name,
348 string description,
349 string unitName,
350 string category,
351 string container,
352 StatType type,
353 Action<Stat> pullAction,
354 StatVerbosity verbosity)
355 {
356 if (StatsManager.SubCommands.Contains(category))
357 throw new Exception(
358 string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
359
360 ShortName = shortName;
361 Name = name;
362 Description = description;
363 UnitName = unitName;
364 Category = category;
365 Container = container;
366 StatType = type;
367
368 if (StatType == StatType.Push && pullAction != null)
369 throw new Exception("A push stat cannot have a pull action");
370 else
371 PullAction = pullAction;
372
373 Verbosity = verbosity;
374 }
375
376 public virtual string ToConsoleString()
377 {
378 return string.Format(
379 "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
380 }
381 }
382
383 public class PercentageStat : Stat
384 {
385 public int Antecedent { get; set; }
386 public int Consequent { get; set; }
387
388 public override double Value
389 {
390 get
391 {
392 int c = Consequent;
393
394 // Avoid any chance of a multi-threaded divide-by-zero
395 if (c == 0)
396 return 0;
397
398 return (double)Antecedent / c * 100;
399 }
400
401 set
402 {
403 throw new Exception("Cannot set value on a PercentageStat");
404 }
405 }
406
407 public PercentageStat(
408 string shortName,
409 string name,
410 string description,
411 string category,
412 string container,
413 StatType type,
414 Action<Stat> pullAction,
415 StatVerbosity verbosity)
416 : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
417
418 public override string ToConsoleString()
419 {
420 return string.Format(
421 "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})",
422 Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
423 }
424 } 64 }
425} \ No newline at end of file 65} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 28d6d5c..b709baa 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -89,17 +89,6 @@ namespace OpenSim.Framework.Monitoring
89 FirstTick = Environment.TickCount & Int32.MaxValue; 89 FirstTick = Environment.TickCount & Int32.MaxValue;
90 LastTick = FirstTick; 90 LastTick = FirstTick;
91 } 91 }
92
93 public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
94 {
95 Thread = previousTwi.Thread;
96 FirstTick = previousTwi.FirstTick;
97 LastTick = previousTwi.LastTick;
98 Timeout = previousTwi.Timeout;
99 IsTimedOut = previousTwi.IsTimedOut;
100 AlarmIfTimeout = previousTwi.AlarmIfTimeout;
101 AlarmMethod = previousTwi.AlarmMethod;
102 }
103 } 92 }
104 93
105 /// <summary> 94 /// <summary>
@@ -231,25 +220,7 @@ namespace OpenSim.Framework.Monitoring
231 private static bool RemoveThread(int threadID) 220 private static bool RemoveThread(int threadID)
232 { 221 {
233 lock (m_threads) 222 lock (m_threads)
234 { 223 return m_threads.Remove(threadID);
235 ThreadWatchdogInfo twi;
236 if (m_threads.TryGetValue(threadID, out twi))
237 {
238 m_log.DebugFormat(
239 "[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
240
241 m_threads.Remove(threadID);
242
243 return true;
244 }
245 else
246 {
247 m_log.WarnFormat(
248 "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID);
249
250 return false;
251 }
252 }
253 } 224 }
254 225
255 public static bool AbortThread(int threadID) 226 public static bool AbortThread(int threadID)
@@ -364,9 +335,7 @@ namespace OpenSim.Framework.Monitoring
364 if (callbackInfos == null) 335 if (callbackInfos == null)
365 callbackInfos = new List<ThreadWatchdogInfo>(); 336 callbackInfos = new List<ThreadWatchdogInfo>();
366 337
367 // Send a copy of the watchdog info to prevent race conditions where the watchdog 338 callbackInfos.Add(threadInfo);
368 // thread updates the monitoring info after an alarm has been sent out.
369 callbackInfos.Add(new ThreadWatchdogInfo(threadInfo));
370 } 339 }
371 } 340 }
372 } 341 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Framework/PacketPool.cs
index 9f22fb4..41d17c5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Framework/PacketPool.cs
@@ -31,10 +31,10 @@ using System.Reflection;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
33using log4net; 33using log4net;
34using OpenSim.Framework.Monitoring;
35 34
36namespace OpenSim.Region.ClientStack.LindenUDP 35namespace OpenSim.Framework
37{ 36{
37
38 public sealed class PacketPool 38 public sealed class PacketPool
39 { 39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -44,32 +44,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
44 private bool packetPoolEnabled = true; 44 private bool packetPoolEnabled = true;
45 private bool dataBlockPoolEnabled = true; 45 private bool dataBlockPoolEnabled = true;
46 46
47 private PercentageStat m_packetsReusedStat = new PercentageStat(
48 "PacketsReused",
49 "Packets reused",
50 "Number of packets reused out of all requests to the packet pool",
51 "clientstack",
52 "packetpool",
53 StatType.Push,
54 null,
55 StatVerbosity.Debug);
56
57 private PercentageStat m_blocksReusedStat = new PercentageStat(
58 "PacketDataBlocksReused",
59 "Packet data blocks reused",
60 "Number of data blocks reused out of all requests to the packet pool",
61 "clientstack",
62 "packetpool",
63 StatType.Push,
64 null,
65 StatVerbosity.Debug);
66
67 /// <summary>
68 /// Pool of packets available for reuse.
69 /// </summary>
70 private readonly Dictionary<PacketType, Stack<Packet>> pool = new Dictionary<PacketType, Stack<Packet>>(); 47 private readonly Dictionary<PacketType, Stack<Packet>> pool = new Dictionary<PacketType, Stack<Packet>>();
71 48
72 private static Dictionary<Type, Stack<Object>> DataBlocks = new Dictionary<Type, Stack<Object>>(); 49 private static Dictionary<Type, Stack<Object>> DataBlocks =
50 new Dictionary<Type, Stack<Object>>();
51
52 static PacketPool()
53 {
54 }
73 55
74 public static PacketPool Instance 56 public static PacketPool Instance
75 { 57 {
@@ -88,45 +70,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
88 get { return dataBlockPoolEnabled; } 70 get { return dataBlockPoolEnabled; }
89 } 71 }
90 72
91 private PacketPool()
92 {
93 StatsManager.RegisterStat(m_packetsReusedStat);
94 StatsManager.RegisterStat(m_blocksReusedStat);
95
96 StatsManager.RegisterStat(
97 new Stat(
98 "PacketsPoolCount",
99 "Objects within the packet pool",
100 "The number of objects currently stored within the packet pool",
101 "",
102 "clientstack",
103 "packetpool",
104 StatType.Pull,
105 stat => { lock (pool) { stat.Value = pool.Count; } },
106 StatVerbosity.Debug));
107
108 StatsManager.RegisterStat(
109 new Stat(
110 "PacketDataBlocksPoolCount",
111 "Objects within the packet data block pool",
112 "The number of objects currently stored within the packet data block pool",
113 "",
114 "clientstack",
115 "packetpool",
116 StatType.Pull,
117 stat => { lock (DataBlocks) { stat.Value = DataBlocks.Count; } },
118 StatVerbosity.Debug));
119 }
120
121 /// <summary>
122 /// Gets a packet of the given type.
123 /// </summary>
124 /// <param name='type'></param>
125 /// <returns>Guaranteed to always return a packet, whether from the pool or newly constructed.</returns>
126 public Packet GetPacket(PacketType type) 73 public Packet GetPacket(PacketType type)
127 { 74 {
128 m_packetsReusedStat.Consequent++;
129
130 Packet packet; 75 Packet packet;
131 76
132 if (!packetPoolEnabled) 77 if (!packetPoolEnabled)
@@ -136,19 +81,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
136 { 81 {
137 if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0) 82 if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0)
138 { 83 {
139// m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type);
140
141 // Creating a new packet if we cannot reuse an old package 84 // Creating a new packet if we cannot reuse an old package
142 packet = Packet.BuildPacket(type); 85 packet = Packet.BuildPacket(type);
143 } 86 }
144 else 87 else
145 { 88 {
146// m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type);
147
148 // Recycle old packages 89 // Recycle old packages
149 m_packetsReusedStat.Antecedent++; 90 packet = (pool[type]).Pop();
150
151 packet = pool[type].Pop();
152 } 91 }
153 } 92 }
154 93
@@ -197,7 +136,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
197 { 136 {
198 PacketType type = GetType(bytes); 137 PacketType type = GetType(bytes);
199 138
200// Array.Clear(zeroBuffer, 0, zeroBuffer.Length); 139 Array.Clear(zeroBuffer, 0, zeroBuffer.Length);
201 140
202 int i = 0; 141 int i = 0;
203 Packet packet = GetPacket(type); 142 Packet packet = GetPacket(type);
@@ -244,7 +183,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
244 switch (packet.Type) 183 switch (packet.Type)
245 { 184 {
246 // List pooling packets here 185 // List pooling packets here
247 case PacketType.AgentUpdate:
248 case PacketType.PacketAck: 186 case PacketType.PacketAck:
249 case PacketType.ObjectUpdate: 187 case PacketType.ObjectUpdate:
250 case PacketType.ImprovedTerseObjectUpdate: 188 case PacketType.ImprovedTerseObjectUpdate:
@@ -259,9 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
259 197
260 if ((pool[type]).Count < 50) 198 if ((pool[type]).Count < 50)
261 { 199 {
262// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type); 200 (pool[type]).Push(packet);
263
264 pool[type].Push(packet);
265 } 201 }
266 } 202 }
267 break; 203 break;
@@ -273,21 +209,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
273 } 209 }
274 } 210 }
275 211
276 public T GetDataBlock<T>() where T: new() 212 public static T GetDataBlock<T>() where T: new()
277 { 213 {
278 lock (DataBlocks) 214 lock (DataBlocks)
279 { 215 {
280 m_blocksReusedStat.Consequent++;
281
282 Stack<Object> s; 216 Stack<Object> s;
283 217
284 if (DataBlocks.TryGetValue(typeof(T), out s)) 218 if (DataBlocks.TryGetValue(typeof(T), out s))
285 { 219 {
286 if (s.Count > 0) 220 if (s.Count > 0)
287 {
288 m_blocksReusedStat.Antecedent++;
289 return (T)s.Pop(); 221 return (T)s.Pop();
290 }
291 } 222 }
292 else 223 else
293 { 224 {
@@ -298,7 +229,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
298 } 229 }
299 } 230 }
300 231
301 public void ReturnDataBlock<T>(T block) where T: new() 232 public static void ReturnDataBlock<T>(T block) where T: new()
302 { 233 {
303 if (block == null) 234 if (block == null)
304 return; 235 return;
@@ -313,4 +244,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
313 } 244 }
314 } 245 }
315 } 246 }
316} \ No newline at end of file 247}
diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs
deleted file mode 100644
index 5484f5c..0000000
--- a/OpenSim/Framework/Pool.cs
+++ /dev/null
@@ -1,91 +0,0 @@
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
28using System;
29using System.Collections.Generic;
30
31namespace OpenSim.Framework
32{
33 /// <summary>
34 /// Naive pool implementation.
35 /// </summary>
36 /// <remarks>
37 /// Currently assumes that objects are in a useable state when returned.
38 /// </remarks>
39 public class Pool<T>
40 {
41 /// <summary>
42 /// Number of objects in the pool.
43 /// </summary>
44 public int Count
45 {
46 get
47 {
48 lock (m_pool)
49 return m_pool.Count;
50 }
51 }
52
53 private Stack<T> m_pool;
54
55 /// <summary>
56 /// Maximum pool size. Beyond this, any returned objects are not pooled.
57 /// </summary>
58 private int m_maxPoolSize;
59
60 private Func<T> m_createFunction;
61
62 public Pool(Func<T> createFunction, int maxSize)
63 {
64 m_maxPoolSize = maxSize;
65 m_createFunction = createFunction;
66 m_pool = new Stack<T>(m_maxPoolSize);
67 }
68
69 public T GetObject()
70 {
71 lock (m_pool)
72 {
73 if (m_pool.Count > 0)
74 return m_pool.Pop();
75 else
76 return m_createFunction();
77 }
78 }
79
80 public void ReturnObject(T obj)
81 {
82 lock (m_pool)
83 {
84 if (m_pool.Count >= m_maxPoolSize)
85 return;
86 else
87 m_pool.Push(obj);
88 }
89 }
90 }
91} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs
deleted file mode 100644
index a3089b0..0000000
--- a/OpenSim/Framework/RegionFlags.cs
+++ /dev/null
@@ -1,53 +0,0 @@
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
28using System;
29
30namespace OpenSim.Framework
31{
32 /// <summary>
33 /// Region flags used internally by OpenSimulator to store installation specific information about regions.
34 /// </summary>
35 /// <remarks>
36 /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire).
37 /// Returned by IGridService.GetRegionFlags()
38 /// </remarks>
39 [Flags]
40 public enum RegionFlags : int
41 {
42 DefaultRegion = 1, // Used for new Rez. Random if multiple defined
43 FallbackRegion = 2, // Regions we redirect to when the destination is down
44 RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false
45 NoDirectLogin = 8, // Region unavailable for direct logins (by name)
46 Persistent = 16, // Don't remove on unregister
47 LockedOut = 32, // Don't allow registration
48 NoMove = 64, // Don't allow moving this region
49 Reservation = 128, // This is an inactive reservation
50 Authenticate = 256, // Require authentication
51 Hyperlink = 512 // Record represents a HG link
52 }
53} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index e7bed6a..4bde7be 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -122,13 +122,10 @@ namespace OpenSim.Framework
122 public UUID lastMapUUID = UUID.Zero; 122 public UUID lastMapUUID = UUID.Zero;
123 public string lastMapRefresh = "0"; 123 public string lastMapRefresh = "0";
124 124
125 private float m_nonphysPrimMin = 0;
126 private int m_nonphysPrimMax = 0; 125 private int m_nonphysPrimMax = 0;
127 private float m_physPrimMin = 0;
128 private int m_physPrimMax = 0; 126 private int m_physPrimMax = 0;
129 private bool m_clampPrimSize = false; 127 private bool m_clampPrimSize = false;
130 private int m_objectCapacity = 0; 128 private int m_objectCapacity = 0;
131 private int m_linksetCapacity = 0;
132 private int m_agentCapacity = 0; 129 private int m_agentCapacity = 0;
133 private string m_regionType = String.Empty; 130 private string m_regionType = String.Empty;
134 private RegionLightShareData m_windlight = new RegionLightShareData(); 131 private RegionLightShareData m_windlight = new RegionLightShareData();
@@ -290,21 +287,11 @@ namespace OpenSim.Framework
290 set { m_windlight = value; } 287 set { m_windlight = value; }
291 } 288 }
292 289
293 public float NonphysPrimMin
294 {
295 get { return m_nonphysPrimMin; }
296 }
297
298 public int NonphysPrimMax 290 public int NonphysPrimMax
299 { 291 {
300 get { return m_nonphysPrimMax; } 292 get { return m_nonphysPrimMax; }
301 } 293 }
302 294
303 public float PhysPrimMin
304 {
305 get { return m_physPrimMin; }
306 }
307
308 public int PhysPrimMax 295 public int PhysPrimMax
309 { 296 {
310 get { return m_physPrimMax; } 297 get { return m_physPrimMax; }
@@ -320,11 +307,6 @@ namespace OpenSim.Framework
320 get { return m_objectCapacity; } 307 get { return m_objectCapacity; }
321 } 308 }
322 309
323 public int LinksetCapacity
324 {
325 get { return m_linksetCapacity; }
326 }
327
328 public int AgentCapacity 310 public int AgentCapacity
329 { 311 {
330 get { return m_agentCapacity; } 312 get { return m_agentCapacity; }
@@ -643,31 +625,16 @@ namespace OpenSim.Framework
643 m_regionType = config.GetString("RegionType", String.Empty); 625 m_regionType = config.GetString("RegionType", String.Empty);
644 allKeys.Remove("RegionType"); 626 allKeys.Remove("RegionType");
645 627
646 #region Prim stuff 628 // Prim stuff
647 629 //
648 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); 630 m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0);
649 allKeys.Remove("NonPhysicalPrimMin"); 631 allKeys.Remove("NonphysicalPrimMax");
650
651 m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0);
652 allKeys.Remove("NonPhysicalPrimMax");
653
654 m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0);
655 allKeys.Remove("PhysicalPrimMin");
656
657 m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); 632 m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
658 allKeys.Remove("PhysicalPrimMax"); 633 allKeys.Remove("PhysicalPrimMax");
659
660 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); 634 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
661 allKeys.Remove("ClampPrimSize"); 635 allKeys.Remove("ClampPrimSize");
662
663 m_objectCapacity = config.GetInt("MaxPrims", 15000); 636 m_objectCapacity = config.GetInt("MaxPrims", 15000);
664 allKeys.Remove("MaxPrims"); 637 allKeys.Remove("MaxPrims");
665
666 m_linksetCapacity = config.GetInt("LinksetPrims", 0);
667 allKeys.Remove("LinksetPrims");
668
669 #endregion
670
671 m_agentCapacity = config.GetInt("MaxAgents", 100); 638 m_agentCapacity = config.GetInt("MaxAgents", 100);
672 allKeys.Remove("MaxAgents"); 639 allKeys.Remove("MaxAgents");
673 640
@@ -706,27 +673,16 @@ namespace OpenSim.Framework
706 673
707 config.Set("ExternalHostName", m_externalHostName); 674 config.Set("ExternalHostName", m_externalHostName);
708 675
709 if (m_nonphysPrimMin > 0) 676 if (m_nonphysPrimMax != 0)
710 config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
711
712 if (m_nonphysPrimMax > 0)
713 config.Set("NonphysicalPrimMax", m_nonphysPrimMax); 677 config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
714 678 if (m_physPrimMax != 0)
715 if (m_physPrimMin > 0)
716 config.Set("PhysicalPrimMax", m_physPrimMin);
717
718 if (m_physPrimMax > 0)
719 config.Set("PhysicalPrimMax", m_physPrimMax); 679 config.Set("PhysicalPrimMax", m_physPrimMax);
720
721 config.Set("ClampPrimSize", m_clampPrimSize.ToString()); 680 config.Set("ClampPrimSize", m_clampPrimSize.ToString());
722 681
723 if (m_objectCapacity > 0) 682 if (m_objectCapacity != 0)
724 config.Set("MaxPrims", m_objectCapacity); 683 config.Set("MaxPrims", m_objectCapacity);
725 684
726 if (m_linksetCapacity > 0) 685 if (m_agentCapacity != 0)
727 config.Set("LinksetPrims", m_linksetCapacity);
728
729 if (m_agentCapacity > 0)
730 config.Set("MaxAgents", m_agentCapacity); 686 config.Set("MaxAgents", m_agentCapacity);
731 687
732 if (ScopeID != UUID.Zero) 688 if (ScopeID != UUID.Zero)
@@ -803,15 +759,9 @@ namespace OpenSim.Framework
803 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 759 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
804 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); 760 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
805 761
806 configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
807 "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
808
809 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 762 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
810 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); 763 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
811 764
812 configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
813 "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
814
815 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 765 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
816 "Maximum size for physical prims", m_physPrimMax.ToString(), true); 766 "Maximum size for physical prims", m_physPrimMax.ToString(), true);
817 767
@@ -821,9 +771,6 @@ namespace OpenSim.Framework
821 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 771 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
822 "Max objects this sim will hold", m_objectCapacity.ToString(), true); 772 "Max objects this sim will hold", m_objectCapacity.ToString(), true);
823 773
824 configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
825 "Max prims an object will hold", m_linksetCapacity.ToString(), true);
826
827 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 774 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
828 "Max avatars this sim will hold", m_agentCapacity.ToString(), true); 775 "Max avatars this sim will hold", m_agentCapacity.ToString(), true);
829 776
@@ -945,9 +892,6 @@ namespace OpenSim.Framework
945 case "object_capacity": 892 case "object_capacity":
946 m_objectCapacity = (int)configuration_result; 893 m_objectCapacity = (int)configuration_result;
947 break; 894 break;
948 case "linkset_capacity":
949 m_linksetCapacity = (int)configuration_result;
950 break;
951 case "agent_capacity": 895 case "agent_capacity":
952 m_agentCapacity = (int)configuration_result; 896 m_agentCapacity = (int)configuration_result;
953 break; 897 break;
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 48f1c4f..2c5e001 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -53,11 +53,6 @@ namespace OpenSim.Framework.Serialization
53 public const string INVENTORY_PATH = "inventory/"; 53 public const string INVENTORY_PATH = "inventory/";
54 54
55 /// <value> 55 /// <value>
56 /// Path for regions in a multi-region archive
57 /// </value>
58 public const string REGIONS_PATH = "regions/";
59
60 /// <value>
61 /// Path for the prims file 56 /// Path for the prims file
62 /// </value> 57 /// </value>
63 public const string OBJECTS_PATH = "objects/"; 58 public const string OBJECTS_PATH = "objects/";
diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs
index fa7160f..d31d27c 100644
--- a/OpenSim/Framework/Serialization/External/OspResolver.cs
+++ b/OpenSim/Framework/Serialization/External/OspResolver.cs
@@ -65,14 +65,9 @@ namespace OpenSim.Framework.Serialization
65 65
66 UserAccount account = userService.GetUserAccount(UUID.Zero, userId); 66 UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
67 if (account != null) 67 if (account != null)
68 {
69 return MakeOspa(account.FirstName, account.LastName); 68 return MakeOspa(account.FirstName, account.LastName);
70 }
71// else 69// else
72// {
73// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); 70// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
74// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId);
75// }
76 71
77 return null; 72 return null;
78 } 73 }
@@ -84,13 +79,10 @@ namespace OpenSim.Framework.Serialization
84 /// <returns></returns> 79 /// <returns></returns>
85 public static string MakeOspa(string firstName, string lastName) 80 public static string MakeOspa(string firstName, string lastName)
86 { 81 {
87 string ospa 82// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
88 = OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
89
90// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
91// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
92 83
93 return ospa; 84 return
85 OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
94 } 86 }
95 87
96 /// <summary> 88 /// <summary>
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 605909d..cf19002 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -96,6 +96,11 @@ namespace OpenSim.Framework.Servers
96 get { return m_httpServer; } 96 get { return m_httpServer; }
97 } 97 }
98 98
99 /// <summary>
100 /// Holds the non-viewer statistics collection object for this service/server
101 /// </summary>
102 protected IStatsCollector m_stats;
103
99 public BaseOpenSimServer() 104 public BaseOpenSimServer()
100 { 105 {
101 m_startuptime = DateTime.Now; 106 m_startuptime = DateTime.Now;
@@ -172,6 +177,10 @@ namespace OpenSim.Framework.Servers
172 "show info", 177 "show info",
173 "Show general information about the server", HandleShow); 178 "Show general information about the server", HandleShow);
174 179
180 m_console.Commands.AddCommand("General", false, "show stats",
181 "show stats",
182 "Show statistics", HandleShow);
183
175 m_console.Commands.AddCommand("General", false, "show threads", 184 m_console.Commands.AddCommand("General", false, "show threads",
176 "show threads", 185 "show threads",
177 "Show thread status", HandleShow); 186 "Show thread status", HandleShow);
@@ -192,19 +201,8 @@ namespace OpenSim.Framework.Servers
192 "threads show", 201 "threads show",
193 "Show thread status. Synonym for \"show threads\"", 202 "Show thread status. Synonym for \"show threads\"",
194 (string module, string[] args) => Notice(GetThreadsReport())); 203 (string module, string[] args) => Notice(GetThreadsReport()));
195
196 m_console.Commands.AddCommand("General", false, "force gc",
197 "force gc",
198 "Manually invoke runtime garbage collection. For debugging purposes",
199 HandleForceGc);
200 } 204 }
201 } 205 }
202
203 private void HandleForceGc(string module, string[] args)
204 {
205 MainConsole.Instance.Output("Manually invoking runtime garbage collection");
206 GC.Collect();
207 }
208 206
209 /// <summary> 207 /// <summary>
210 /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing 208 /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
@@ -228,7 +226,12 @@ namespace OpenSim.Framework.Servers
228 { 226 {
229 StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); 227 StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n");
230 sb.Append(GetUptimeReport()); 228 sb.Append(GetUptimeReport());
231 sb.Append(StatsManager.SimExtraStats.Report()); 229
230 if (m_stats != null)
231 {
232 sb.Append(m_stats.Report());
233 }
234
232 sb.Append(Environment.NewLine); 235 sb.Append(Environment.NewLine);
233 sb.Append(GetThreadsReport()); 236 sb.Append(GetThreadsReport());
234 237
@@ -379,6 +382,10 @@ namespace OpenSim.Framework.Servers
379 { 382 {
380 Notice("set log level [level] - change the console logging level only. For example, off or debug."); 383 Notice("set log level [level] - change the console logging level only. For example, off or debug.");
381 Notice("show info - show server information (e.g. startup path)."); 384 Notice("show info - show server information (e.g. startup path).");
385
386 if (m_stats != null)
387 Notice("show stats - show statistical information for this server");
388
382 Notice("show threads - list tracked threads"); 389 Notice("show threads - list tracked threads");
383 Notice("show uptime - show server startup time and uptime."); 390 Notice("show uptime - show server startup time and uptime.");
384 Notice("show version - show server version."); 391 Notice("show version - show server version.");
@@ -402,6 +409,11 @@ namespace OpenSim.Framework.Servers
402 ShowInfo(); 409 ShowInfo();
403 break; 410 break;
404 411
412 case "stats":
413 if (m_stats != null)
414 Notice(m_stats.Report());
415 break;
416
405 case "threads": 417 case "threads":
406 Notice(GetThreadsReport()); 418 Notice(GetThreadsReport());
407 break; 419 break;
@@ -592,7 +604,8 @@ namespace OpenSim.Framework.Servers
592 604
593 public string osSecret { 605 public string osSecret {
594 // Secret uuid for the simulator 606 // Secret uuid for the simulator
595 get { return m_osSecret; } 607 get { return m_osSecret; }
608
596 } 609 }
597 610
598 public string StatReport(IOSHttpRequest httpRequest) 611 public string StatReport(IOSHttpRequest httpRequest)
@@ -600,11 +613,11 @@ namespace OpenSim.Framework.Servers
600 // If we catch a request for "callback", wrap the response in the value for jsonp 613 // If we catch a request for "callback", wrap the response in the value for jsonp
601 if (httpRequest.Query.ContainsKey("callback")) 614 if (httpRequest.Query.ContainsKey("callback"))
602 { 615 {
603 return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; 616 return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");";
604 } 617 }
605 else 618 else
606 { 619 {
607 return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); 620 return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version);
608 } 621 }
609 } 622 }
610 623
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 3198891..788a0b9 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -54,23 +54,8 @@ namespace OpenSim.Framework.Servers.HttpServer
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); 55 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
56 56
57 /// <summary>
58 /// Gets or sets the debug level.
59 /// </summary>
60 /// <value>
61 /// See MainServer.DebugLevel.
62 /// </value>
63 public int DebugLevel { get; set; } 57 public int DebugLevel { get; set; }
64 58
65 /// <summary>
66 /// Request number for diagnostic purposes.
67 /// </summary>
68 /// <remarks>
69 /// This is an internal number. In some debug situations an external number may also be supplied in the
70 /// opensim-request-id header but we are not currently logging this.
71 /// </remarks>
72 public int RequestNumber { get; private set; }
73
74 private volatile int NotSocketErrors = 0; 59 private volatile int NotSocketErrors = 0;
75 public volatile bool HTTPDRunning = false; 60 public volatile bool HTTPDRunning = false;
76 61
@@ -82,7 +67,7 @@ namespace OpenSim.Framework.Servers.HttpServer
82 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>(); 67 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
83 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); 68 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
84 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); 69 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
85// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); 70 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
86 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = 71 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
87 new Dictionary<string, PollServiceEventArgs>(); 72 new Dictionary<string, PollServiceEventArgs>();
88 73
@@ -260,29 +245,29 @@ namespace OpenSim.Framework.Servers.HttpServer
260 return new List<string>(m_pollHandlers.Keys); 245 return new List<string>(m_pollHandlers.Keys);
261 } 246 }
262 247
263// // Note that the agent string is provided simply to differentiate 248 // Note that the agent string is provided simply to differentiate
264// // the handlers - it is NOT required to be an actual agent header 249 // the handlers - it is NOT required to be an actual agent header
265// // value. 250 // value.
266// public bool AddAgentHandler(string agent, IHttpAgentHandler handler) 251 public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
267// { 252 {
268// lock (m_agentHandlers) 253 lock (m_agentHandlers)
269// { 254 {
270// if (!m_agentHandlers.ContainsKey(agent)) 255 if (!m_agentHandlers.ContainsKey(agent))
271// { 256 {
272// m_agentHandlers.Add(agent, handler); 257 m_agentHandlers.Add(agent, handler);
273// return true; 258 return true;
274// } 259 }
275// } 260 }
276// 261
277// //must already have a handler for that path so return false 262 //must already have a handler for that path so return false
278// return false; 263 return false;
279// } 264 }
280// 265
281// public List<string> GetAgentHandlerKeys() 266 public List<string> GetAgentHandlerKeys()
282// { 267 {
283// lock (m_agentHandlers) 268 lock (m_agentHandlers)
284// return new List<string>(m_agentHandlers.Keys); 269 return new List<string>(m_agentHandlers.Keys);
285// } 270 }
286 271
287 public bool AddLLSDHandler(string path, LLSDMethod handler) 272 public bool AddLLSDHandler(string path, LLSDMethod handler)
288 { 273 {
@@ -311,8 +296,6 @@ namespace OpenSim.Framework.Servers.HttpServer
311 296
312 private void OnRequest(object source, RequestEventArgs args) 297 private void OnRequest(object source, RequestEventArgs args)
313 { 298 {
314 RequestNumber++;
315
316 try 299 try
317 { 300 {
318 IHttpClientContext context = (IHttpClientContext)source; 301 IHttpClientContext context = (IHttpClientContext)source;
@@ -423,6 +406,7 @@ namespace OpenSim.Framework.Servers.HttpServer
423 string requestMethod = request.HttpMethod; 406 string requestMethod = request.HttpMethod;
424 string uriString = request.RawUrl; 407 string uriString = request.RawUrl;
425 408
409// string reqnum = "unknown";
426 int requestStartTick = Environment.TickCount; 410 int requestStartTick = Environment.TickCount;
427 411
428 // Will be adjusted later on. 412 // Will be adjusted later on.
@@ -439,22 +423,22 @@ namespace OpenSim.Framework.Servers.HttpServer
439 423
440 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 424 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
441 425
442// // This is the REST agent interface. We require an agent to properly identify 426 // This is the REST agent interface. We require an agent to properly identify
443// // itself. If the REST handler recognizes the prefix it will attempt to 427 // itself. If the REST handler recognizes the prefix it will attempt to
444// // satisfy the request. If it is not recognizable, and no damage has occurred 428 // satisfy the request. If it is not recognizable, and no damage has occurred
445// // the request can be passed through to the other handlers. This is a low 429 // the request can be passed through to the other handlers. This is a low
446// // probability event; if a request is matched it is normally expected to be 430 // probability event; if a request is matched it is normally expected to be
447// // handled 431 // handled
448// IHttpAgentHandler agentHandler; 432 IHttpAgentHandler agentHandler;
449// 433
450// if (TryGetAgentHandler(request, response, out agentHandler)) 434 if (TryGetAgentHandler(request, response, out agentHandler))
451// { 435 {
452// if (HandleAgentRequest(agentHandler, request, response)) 436 if (HandleAgentRequest(agentHandler, request, response))
453// { 437 {
454// requestEndTick = Environment.TickCount; 438 requestEndTick = Environment.TickCount;
455// return; 439 return;
456// } 440 }
457// } 441 }
458 442
459 //response.KeepAlive = true; 443 //response.KeepAlive = true;
460 response.SendChunked = false; 444 response.SendChunked = false;
@@ -466,7 +450,9 @@ namespace OpenSim.Framework.Servers.HttpServer
466 if (TryGetStreamHandler(handlerKey, out requestHandler)) 450 if (TryGetStreamHandler(handlerKey, out requestHandler))
467 { 451 {
468 if (DebugLevel >= 3) 452 if (DebugLevel >= 3)
469 LogIncomingToStreamHandler(request, requestHandler); 453 m_log.DebugFormat(
454 "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
455 request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
470 456
471 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. 457 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
472 458
@@ -543,8 +529,11 @@ namespace OpenSim.Framework.Servers.HttpServer
543 { 529 {
544 case null: 530 case null:
545 case "text/html": 531 case "text/html":
532
546 if (DebugLevel >= 3) 533 if (DebugLevel >= 3)
547 LogIncomingToContentTypeHandler(request); 534 m_log.DebugFormat(
535 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
536 request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
548 537
549 buffer = HandleHTTPRequest(request, response); 538 buffer = HandleHTTPRequest(request, response);
550 break; 539 break;
@@ -552,8 +541,11 @@ namespace OpenSim.Framework.Servers.HttpServer
552 case "application/llsd+xml": 541 case "application/llsd+xml":
553 case "application/xml+llsd": 542 case "application/xml+llsd":
554 case "application/llsd+json": 543 case "application/llsd+json":
544
555 if (DebugLevel >= 3) 545 if (DebugLevel >= 3)
556 LogIncomingToContentTypeHandler(request); 546 m_log.DebugFormat(
547 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
548 request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
557 549
558 buffer = HandleLLSDRequests(request, response); 550 buffer = HandleLLSDRequests(request, response);
559 break; 551 break;
@@ -572,7 +564,9 @@ namespace OpenSim.Framework.Servers.HttpServer
572 if (DoWeHaveALLSDHandler(request.RawUrl)) 564 if (DoWeHaveALLSDHandler(request.RawUrl))
573 { 565 {
574 if (DebugLevel >= 3) 566 if (DebugLevel >= 3)
575 LogIncomingToContentTypeHandler(request); 567 m_log.DebugFormat(
568 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
569 request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
576 570
577 buffer = HandleLLSDRequests(request, response); 571 buffer = HandleLLSDRequests(request, response);
578 } 572 }
@@ -580,14 +574,18 @@ namespace OpenSim.Framework.Servers.HttpServer
580 else if (DoWeHaveAHTTPHandler(request.RawUrl)) 574 else if (DoWeHaveAHTTPHandler(request.RawUrl))
581 { 575 {
582 if (DebugLevel >= 3) 576 if (DebugLevel >= 3)
583 LogIncomingToContentTypeHandler(request); 577 m_log.DebugFormat(
578 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
579 request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
584 580
585 buffer = HandleHTTPRequest(request, response); 581 buffer = HandleHTTPRequest(request, response);
586 } 582 }
587 else 583 else
588 { 584 {
589 if (DebugLevel >= 3) 585 if (DebugLevel >= 3)
590 LogIncomingToXmlRpcHandler(request); 586 m_log.DebugFormat(
587 "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
588 request.HttpMethod, request.Url.PathAndQuery);
591 589
592 // generic login request. 590 // generic login request.
593 buffer = HandleXmlRpcRequests(request, response); 591 buffer = HandleXmlRpcRequests(request, response);
@@ -631,11 +629,11 @@ namespace OpenSim.Framework.Servers.HttpServer
631 } 629 }
632 catch (IOException e) 630 catch (IOException e)
633 { 631 {
634 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); 632 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
635 } 633 }
636 catch (Exception e) 634 catch (Exception e)
637 { 635 {
638 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); 636 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
639 SendHTML500(response); 637 SendHTML500(response);
640 } 638 }
641 finally 639 finally
@@ -646,93 +644,17 @@ namespace OpenSim.Framework.Servers.HttpServer
646 if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) 644 if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture"))
647 { 645 {
648 m_log.InfoFormat( 646 m_log.InfoFormat(
649 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", 647 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
650 RequestNumber,
651 requestMethod, 648 requestMethod,
652 uriString, 649 uriString,
653 requestHandler != null ? requestHandler.Name : "", 650 requestHandler != null ? requestHandler.Name : "",
654 requestHandler != null ? requestHandler.Description : "", 651 requestHandler != null ? requestHandler.Description : "",
655 request.RemoteIPEndPoint, 652 request.RemoteIPEndPoint.ToString(),
656 tickdiff);
657 }
658 else if (DebugLevel >= 4)
659 {
660 m_log.DebugFormat(
661 "[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms",
662 RequestNumber,
663 Port,
664 tickdiff); 653 tickdiff);
665 } 654 }
666 } 655 }
667 } 656 }
668 657
669 private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
670 {
671 m_log.DebugFormat(
672 "[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}",
673 RequestNumber,
674 Port,
675 request.HttpMethod,
676 request.Url.PathAndQuery,
677 requestHandler.Name,
678 requestHandler.Description,
679 request.RemoteIPEndPoint);
680
681 if (DebugLevel >= 5)
682 LogIncomingInDetail(request);
683 }
684
685 private void LogIncomingToContentTypeHandler(OSHttpRequest request)
686 {
687 m_log.DebugFormat(
688 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
689 RequestNumber,
690 Port,
691 (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType,
692 request.HttpMethod,
693 request.Url.PathAndQuery,
694 request.RemoteIPEndPoint);
695
696 if (DebugLevel >= 5)
697 LogIncomingInDetail(request);
698 }
699
700 private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
701 {
702 m_log.DebugFormat(
703 "[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}",
704 RequestNumber,
705 Port,
706 request.HttpMethod,
707 request.Url.PathAndQuery,
708 request.RemoteIPEndPoint);
709
710 if (DebugLevel >= 5)
711 LogIncomingInDetail(request);
712 }
713
714 private void LogIncomingInDetail(OSHttpRequest request)
715 {
716 using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8))
717 {
718 string output;
719
720 if (DebugLevel == 5)
721 {
722 const int sampleLength = 80;
723 char[] sampleChars = new char[sampleLength];
724 reader.Read(sampleChars, 0, sampleLength);
725 output = new string(sampleChars);
726 }
727 else
728 {
729 output = reader.ReadToEnd();
730 }
731
732 m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n"));
733 }
734 }
735
736 private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) 658 private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler)
737 { 659 {
738 string bestMatch = null; 660 string bestMatch = null;
@@ -825,24 +747,24 @@ namespace OpenSim.Framework.Servers.HttpServer
825 } 747 }
826 } 748 }
827 749
828// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) 750 private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
829// { 751 {
830// agentHandler = null; 752 agentHandler = null;
831// 753
832// lock (m_agentHandlers) 754 lock (m_agentHandlers)
833// { 755 {
834// foreach (IHttpAgentHandler handler in m_agentHandlers.Values) 756 foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
835// { 757 {
836// if (handler.Match(request, response)) 758 if (handler.Match(request, response))
837// { 759 {
838// agentHandler = handler; 760 agentHandler = handler;
839// return true; 761 return true;
840// } 762 }
841// } 763 }
842// } 764 }
843// 765
844// return false; 766 return false;
845// } 767 }
846 768
847 /// <summary> 769 /// <summary>
848 /// Try all the registered xmlrpc handlers when an xmlrpc request is received. 770 /// Try all the registered xmlrpc handlers when an xmlrpc request is received.
@@ -1815,21 +1737,21 @@ namespace OpenSim.Framework.Servers.HttpServer
1815 m_pollHandlers.Remove(path); 1737 m_pollHandlers.Remove(path);
1816 } 1738 }
1817 1739
1818// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) 1740 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
1819// { 1741 {
1820// lock (m_agentHandlers) 1742 lock (m_agentHandlers)
1821// { 1743 {
1822// IHttpAgentHandler foundHandler; 1744 IHttpAgentHandler foundHandler;
1823// 1745
1824// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) 1746 if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
1825// { 1747 {
1826// m_agentHandlers.Remove(agent); 1748 m_agentHandlers.Remove(agent);
1827// return true; 1749 return true;
1828// } 1750 }
1829// } 1751 }
1830// 1752
1831// return false; 1753 return false;
1832// } 1754 }
1833 1755
1834 public void RemoveXmlRPCHandler(string method) 1756 public void RemoveXmlRPCHandler(string method)
1835 { 1757 {
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index 0bd3aae..db58f6f 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
41 uint Port { get; } 41 uint Port { get; }
42 bool UseSSL { get; } 42 bool UseSSL { get; }
43 43
44// // Note that the agent string is provided simply to differentiate 44 // Note that the agent string is provided simply to differentiate
45// // the handlers - it is NOT required to be an actual agent header 45 // the handlers - it is NOT required to be an actual agent header
46// // value. 46 // value.
47// bool AddAgentHandler(string agent, IHttpAgentHandler handler); 47 bool AddAgentHandler(string agent, IHttpAgentHandler handler);
48 48
49 /// <summary> 49 /// <summary>
50 /// Add a handler for an HTTP request. 50 /// Add a handler for an HTTP request.
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
106 106
107 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); 107 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
108 108
109// /// <summary> 109 /// <summary>
110// /// Remove the agent if it is registered. 110 /// Remove the agent if it is registered.
111// /// </summary> 111 /// </summary>
112// /// <param name="agent"></param> 112 /// <param name="agent"></param>
113// /// <param name="handler"></param> 113 /// <param name="handler"></param>
114// /// <returns></returns> 114 /// <returns></returns>
115// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); 115 bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
116 116
117 /// <summary> 117 /// <summary>
118 /// Remove an HTTP handler 118 /// Remove an HTTP handler
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index ae7d515..8dc0e3a 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Net; 31using System.Net;
32using System.Text;
33using log4net; 32using log4net;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
@@ -48,12 +47,9 @@ namespace OpenSim.Framework.Servers
48 /// Control the printing of certain debug messages. 47 /// Control the printing of certain debug messages.
49 /// </summary> 48 /// </summary>
50 /// <remarks> 49 /// <remarks>
51 /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data. 50 /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data.
52 /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data. 51 /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data.
53 /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged. 52 /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged.
54 /// If DebugLevel >= 4 then the time taken to fulfill the request is logged.
55 /// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged.
56 /// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged.
57 /// </remarks> 53 /// </remarks>
58 public static int DebugLevel 54 public static int DebugLevel
59 { 55 {
@@ -105,28 +101,17 @@ namespace OpenSim.Framework.Servers
105 get { return new Dictionary<uint, BaseHttpServer>(m_Servers); } 101 get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
106 } 102 }
107 103
104
108 public static void RegisterHttpConsoleCommands(ICommandConsole console) 105 public static void RegisterHttpConsoleCommands(ICommandConsole console)
109 { 106 {
110 console.Commands.AddCommand( 107 console.Commands.AddCommand(
111 "Comms", false, "show http-handlers", 108 "Debug", false, "debug http", "debug http [<level>]",
112 "show http-handlers", 109 "Turn on inbound non-poll http request debugging.",
113 "Show all registered http handlers", HandleShowHttpHandlersCommand); 110 "If level <= 0, then no extra logging is done.\n"
114 111 + "If level >= 1, then short warnings are logged when receiving bad input data.\n"
115 console.Commands.AddCommand( 112 + "If level >= 2, then long warnings are logged when receiving bad input data.\n"
116 "Debug", false, "debug http", "debug http <in|out|all> [<level>]", 113 + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n"
117 "Turn on http request logging.", 114 + "If no level is specified then the current level is returned.",
118 "If in or all and\n"
119 + " level <= 0 then no extra logging is done.\n"
120 + " level >= 1 then short warnings are logged when receiving bad input data.\n"
121 + " level >= 2 then long warnings are logged when receiving bad input data.\n"
122 + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
123 + " level >= 4 then the time taken to fulfill the request is logged.\n"
124 + " level >= 5 then a sample from the beginning of the incoming data is logged.\n"
125 + " level >= 6 then the entire incoming data is logged.\n"
126 + " no level is specified then the current level is returned.\n\n"
127 + "If out or all and\n"
128 + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
129 + " level >= 4 then the time taken to fulfill the request is logged.\n",
130 HandleDebugHttpCommand); 115 HandleDebugHttpCommand);
131 } 116 }
132 117
@@ -134,120 +119,25 @@ namespace OpenSim.Framework.Servers
134 /// Turn on some debugging values for OpenSim. 119 /// Turn on some debugging values for OpenSim.
135 /// </summary> 120 /// </summary>
136 /// <param name="args"></param> 121 /// <param name="args"></param>
137 private static void HandleDebugHttpCommand(string module, string[] cmdparams) 122 private static void HandleDebugHttpCommand(string module, string[] args)
138 { 123 {
139 if (cmdparams.Length < 3) 124 if (args.Length == 3)
140 {
141 MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..6");
142 return;
143 }
144
145 bool inReqs = false;
146 bool outReqs = false;
147 bool allReqs = false;
148
149 string subCommand = cmdparams[2];
150
151 if (subCommand.ToLower() == "in")
152 {
153 inReqs = true;
154 }
155 else if (subCommand.ToLower() == "out")
156 {
157 outReqs = true;
158 }
159 else if (subCommand.ToLower() == "all")
160 {
161 allReqs = true;
162 }
163 else
164 { 125 {
165 MainConsole.Instance.Output("You must specify in, out or all");
166 return;
167 }
168
169 if (cmdparams.Length >= 4)
170 {
171 string rawNewDebug = cmdparams[3];
172 int newDebug; 126 int newDebug;
173 127 if (int.TryParse(args[2], out newDebug))
174 if (!int.TryParse(rawNewDebug, out newDebug))
175 {
176 MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug);
177 return;
178 }
179
180 if (newDebug < 0 || newDebug > 6)
181 {
182 MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..6", newDebug);
183 return;
184 }
185
186 if (allReqs || inReqs)
187 { 128 {
188 MainServer.DebugLevel = newDebug; 129 MainServer.DebugLevel = newDebug;
189 MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug); 130 MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
190 }
191
192 if (allReqs || outReqs)
193 {
194 WebUtil.DebugLevel = newDebug;
195 MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug);
196 } 131 }
197 } 132 }
198 else 133 else if (args.Length == 2)
199 { 134 {
200 if (allReqs || inReqs) 135 MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel);
201 MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel);
202
203 if (allReqs || outReqs)
204 MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel);
205 } 136 }
206 } 137 else
207
208 private static void HandleShowHttpHandlersCommand(string module, string[] args)
209 {
210 if (args.Length != 2)
211 {
212 MainConsole.Instance.Output("Usage: show http-handlers");
213 return;
214 }
215
216 StringBuilder handlers = new StringBuilder();
217
218 lock (m_Servers)
219 { 138 {
220 foreach (BaseHttpServer httpServer in m_Servers.Values) 139 MainConsole.Instance.Output("Usage: debug http 0..3");
221 {
222 handlers.AppendFormat(
223 "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port);
224
225 handlers.AppendFormat("* XMLRPC:\n");
226 foreach (String s in httpServer.GetXmlRpcHandlerKeys())
227 handlers.AppendFormat("\t{0}\n", s);
228
229 handlers.AppendFormat("* HTTP:\n");
230 List<String> poll = httpServer.GetPollServiceHandlerKeys();
231 foreach (String s in httpServer.GetHTTPHandlerKeys())
232 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
233
234// handlers.AppendFormat("* Agent:\n");
235// foreach (String s in httpServer.GetAgentHandlerKeys())
236// handlers.AppendFormat("\t{0}\n", s);
237
238 handlers.AppendFormat("* LLSD:\n");
239 foreach (String s in httpServer.GetLLSDHandlerKeys())
240 handlers.AppendFormat("\t{0}\n", s);
241
242 handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count);
243 foreach (String s in httpServer.GetStreamHandlerKeys())
244 handlers.AppendFormat("\t{0}\n", s);
245
246 handlers.Append("\n");
247 }
248 } 140 }
249
250 MainConsole.Instance.Output(handlers.ToString());
251 } 141 }
252 142
253 /// <summary> 143 /// <summary>
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index bb094ed..016a174 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.7.5CM"; 32 private const string VERSION_NUMBER = "0.7.4CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 34
35 public enum Flavour 35 public enum Flavour
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 62ecbd1..4d07746 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -39,12 +39,10 @@ using OpenMetaverse;
39namespace OpenSim.Framework 39namespace OpenSim.Framework
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// A dictionary containing task inventory items. Indexed by item UUID. 42 /// A dictionary for task inventory.
43 /// </summary> 43 /// </summary>
44 /// <remarks>
45 /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before 44 /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
46 /// iterating over it. 45 /// iterating over it.
47 /// </remarks>
48 public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>, 46 public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
49 ICloneable, IXmlSerializable 47 ICloneable, IXmlSerializable
50 { 48 {
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 574ee56..fb818ee 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -73,6 +73,9 @@ namespace OpenSim.Framework
73 73
74 private bool _ownerChanged = false; 74 private bool _ownerChanged = false;
75 75
76 // This used ONLY during copy. It can't be relied on at other times!
77 private bool _scriptRunning = true;
78
76 public UUID AssetID { 79 public UUID AssetID {
77 get { 80 get {
78 return _assetID; 81 return _assetID;
@@ -350,13 +353,14 @@ namespace OpenSim.Framework
350 } 353 }
351 } 354 }
352 355
353 /// <summary> 356 public bool ScriptRunning {
354 /// This used ONLY during copy. It can't be relied on at other times! 357 get {
355 /// </summary> 358 return _scriptRunning;
356 /// <remarks> 359 }
357 /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now. 360 set {
358 /// </remarks> 361 _scriptRunning = value;
359 public bool ScriptRunning { get; set; } 362 }
363 }
360 364
361 // See ICloneable 365 // See ICloneable
362 366
@@ -384,7 +388,6 @@ namespace OpenSim.Framework
384 388
385 public TaskInventoryItem() 389 public TaskInventoryItem()
386 { 390 {
387 ScriptRunning = true;
388 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 391 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
389 } 392 }
390 } 393 }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e76a37b..384f716 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -546,19 +546,6 @@ namespace OpenSim.Framework
546 } 546 }
547 547
548 /// <summary> 548 /// <summary>
549 /// Determines whether a point is inside a bounding box.
550 /// </summary>
551 /// <param name='v'></param>
552 /// <param name='min'></param>
553 /// <param name='max'></param>
554 /// <returns></returns>
555 public static bool IsInsideBox(Vector3 v, Vector3 min, Vector3 max)
556 {
557 return v.X >= min.X & v.Y >= min.Y && v.Z >= min.Z
558 && v.X <= max.X && v.Y <= max.Y && v.Z <= max.Z;
559 }
560
561 /// <summary>
562 /// Are the co-ordinates of the new region visible from the old region? 549 /// Are the co-ordinates of the new region visible from the old region?
563 /// </summary> 550 /// </summary>
564 /// <param name="oldx">Old region x-coord</param> 551 /// <param name="oldx">Old region x-coord</param>
@@ -875,12 +862,6 @@ namespace OpenSim.Framework
875 return Math.Min(Math.Max(x, min), max); 862 return Math.Min(Math.Max(x, min), max);
876 } 863 }
877 864
878 public static Vector3 Clip(Vector3 vec, float min, float max)
879 {
880 return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max),
881 Clip(vec.Z, min, max));
882 }
883
884 /// <summary> 865 /// <summary>
885 /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens. 866 /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
886 /// </summary> 867 /// </summary>
@@ -1032,38 +1013,6 @@ namespace OpenSim.Framework
1032 } 1013 }
1033 } 1014 }
1034 1015
1035 /// <summary>
1036 /// Copy data from one stream to another, leaving the read position of both streams at the beginning.
1037 /// </summary>
1038 /// <param name='inputStream'>
1039 /// Input stream. Must be seekable.
1040 /// </param>
1041 /// <exception cref='ArgumentException'>
1042 /// Thrown if the input stream is not seekable.
1043 /// </exception>
1044 public static Stream Copy(Stream inputStream)
1045 {
1046 if (!inputStream.CanSeek)
1047 throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek");
1048
1049 const int readSize = 256;
1050 byte[] buffer = new byte[readSize];
1051 MemoryStream ms = new MemoryStream();
1052
1053 int count = inputStream.Read(buffer, 0, readSize);
1054
1055 while (count > 0)
1056 {
1057 ms.Write(buffer, 0, count);
1058 count = inputStream.Read(buffer, 0, readSize);
1059 }
1060
1061 ms.Position = 0;
1062 inputStream.Position = 0;
1063
1064 return ms;
1065 }
1066
1067 public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) 1016 public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
1068 { 1017 {
1069 return SendXmlRpcCommand(url, methodName, args); 1018 return SendXmlRpcCommand(url, methodName, args);
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index b85d93d..30a8c28 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -54,17 +54,9 @@ namespace OpenSim.Framework
54 MethodBase.GetCurrentMethod().DeclaringType); 54 MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 /// <summary> 56 /// <summary>
57 /// Control the printing of certain debug messages.
58 /// </summary>
59 /// <remarks>
60 /// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged.
61 /// </remarks>
62 public static int DebugLevel { get; set; }
63
64 /// <summary>
65 /// Request number for diagnostic purposes. 57 /// Request number for diagnostic purposes.
66 /// </summary> 58 /// </summary>
67 public static int RequestNumber { get; internal set; } 59 public static int RequestNumber = 0;
68 60
69 /// <summary> 61 /// <summary>
70 /// this is the header field used to communicate the local request id 62 /// this is the header field used to communicate the local request id
@@ -154,11 +146,7 @@ namespace OpenSim.Framework
154 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) 146 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
155 { 147 {
156 int reqnum = RequestNumber++; 148 int reqnum = RequestNumber++;
157 149 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
158 if (DebugLevel >= 3)
159 m_log.DebugFormat(
160 "[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})",
161 reqnum, method, url, timeout, compressed);
162 150
163 string errorMessage = "unknown error"; 151 string errorMessage = "unknown error";
164 int tickstart = Util.EnvironmentTickCount(); 152 int tickstart = Util.EnvironmentTickCount();
@@ -242,7 +230,7 @@ namespace OpenSim.Framework
242 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 230 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
243 if (tickdiff > LongCallTime) 231 if (tickdiff > LongCallTime)
244 m_log.InfoFormat( 232 m_log.InfoFormat(
245 "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 233 "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
246 reqnum, 234 reqnum,
247 method, 235 method,
248 url, 236 url,
@@ -251,14 +239,10 @@ namespace OpenSim.Framework
251 strBuffer != null 239 strBuffer != null
252 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) 240 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
253 : ""); 241 : "");
254 else if (DebugLevel >= 4)
255 m_log.DebugFormat(
256 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
257 reqnum, tickdiff, tickdata);
258 } 242 }
259 243
260 m_log.DebugFormat( 244 m_log.DebugFormat(
261 "[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); 245 "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
262 246
263 return ErrorResponseMap(errorMessage); 247 return ErrorResponseMap(errorMessage);
264 } 248 }
@@ -334,11 +318,7 @@ namespace OpenSim.Framework
334 { 318 {
335 int reqnum = RequestNumber++; 319 int reqnum = RequestNumber++;
336 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; 320 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
337 321 // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
338 if (DebugLevel >= 3)
339 m_log.DebugFormat(
340 "[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})",
341 reqnum, method, url, timeout);
342 322
343 string errorMessage = "unknown error"; 323 string errorMessage = "unknown error";
344 int tickstart = Util.EnvironmentTickCount(); 324 int tickstart = Util.EnvironmentTickCount();
@@ -401,7 +381,7 @@ namespace OpenSim.Framework
401 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 381 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
402 if (tickdiff > LongCallTime) 382 if (tickdiff > LongCallTime)
403 m_log.InfoFormat( 383 m_log.InfoFormat(
404 "[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 384 "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
405 reqnum, 385 reqnum,
406 method, 386 method,
407 url, 387 url,
@@ -410,13 +390,9 @@ namespace OpenSim.Framework
410 queryString != null 390 queryString != null
411 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString 391 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
412 : ""); 392 : "");
413 else if (DebugLevel >= 4)
414 m_log.DebugFormat(
415 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
416 reqnum, tickdiff, tickdata);
417 } 393 }
418 394
419 m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); 395 m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
420 396
421 return ErrorResponseMap(errorMessage); 397 return ErrorResponseMap(errorMessage);
422 } 398 }
@@ -668,6 +644,7 @@ namespace OpenSim.Framework
668 /// <returns></returns> 644 /// <returns></returns>
669 public static string[] GetPreferredImageTypes(string accept) 645 public static string[] GetPreferredImageTypes(string accept)
670 { 646 {
647
671 if (accept == null || accept == string.Empty) 648 if (accept == null || accept == string.Empty)
672 return new string[0]; 649 return new string[0];
673 650
@@ -726,16 +703,14 @@ namespace OpenSim.Framework
726 int maxConnections) 703 int maxConnections)
727 { 704 {
728 int reqnum = WebUtil.RequestNumber++; 705 int reqnum = WebUtil.RequestNumber++;
729 706 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
730 if (WebUtil.DebugLevel >= 3)
731 m_log.DebugFormat(
732 "[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}",
733 reqnum, verb, requestUrl);
734 707
735 int tickstart = Util.EnvironmentTickCount(); 708 int tickstart = Util.EnvironmentTickCount();
736// int tickdata = 0; 709// int tickdata = 0;
737 int tickdiff = 0; 710 int tickdiff = 0;
738 711
712// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
713
739 Type type = typeof(TRequest); 714 Type type = typeof(TRequest);
740 715
741 WebRequest request = WebRequest.Create(requestUrl); 716 WebRequest request = WebRequest.Create(requestUrl);
@@ -893,7 +868,7 @@ namespace OpenSim.Framework
893 } 868 }
894 869
895 m_log.InfoFormat( 870 m_log.InfoFormat(
896 "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 871 "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
897 reqnum, 872 reqnum,
898 verb, 873 verb,
899 requestUrl, 874 requestUrl,
@@ -908,12 +883,6 @@ namespace OpenSim.Framework
908 requestUrl, 883 requestUrl,
909 tickdiff); 884 tickdiff);
910 } 885 }
911 else if (WebUtil.DebugLevel >= 4)
912 {
913 m_log.DebugFormat(
914 "[WEB UTIL]: HTTP OUT {0} took {1}ms",
915 reqnum, tickdiff);
916 }
917 } 886 }
918 } 887 }
919 888
@@ -934,11 +903,7 @@ namespace OpenSim.Framework
934 public static string MakeRequest(string verb, string requestUrl, string obj) 903 public static string MakeRequest(string verb, string requestUrl, string obj)
935 { 904 {
936 int reqnum = WebUtil.RequestNumber++; 905 int reqnum = WebUtil.RequestNumber++;
937 906 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
938 if (WebUtil.DebugLevel >= 3)
939 m_log.DebugFormat(
940 "[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}",
941 reqnum, verb, requestUrl);
942 907
943 int tickstart = Util.EnvironmentTickCount(); 908 int tickstart = Util.EnvironmentTickCount();
944 int tickdata = 0; 909 int tickdata = 0;
@@ -1025,7 +990,7 @@ namespace OpenSim.Framework
1025 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 990 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
1026 if (tickdiff > WebUtil.LongCallTime) 991 if (tickdiff > WebUtil.LongCallTime)
1027 m_log.InfoFormat( 992 m_log.InfoFormat(
1028 "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 993 "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}",
1029 reqnum, 994 reqnum,
1030 verb, 995 verb,
1031 requestUrl, 996 requestUrl,
@@ -1033,10 +998,6 @@ namespace OpenSim.Framework
1033 tickset, 998 tickset,
1034 tickdata, 999 tickdata,
1035 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1000 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1036 else if (WebUtil.DebugLevel >= 4)
1037 m_log.DebugFormat(
1038 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
1039 reqnum, tickdiff, tickdata);
1040 1001
1041 return respstring; 1002 return respstring;
1042 } 1003 }
@@ -1071,11 +1032,7 @@ namespace OpenSim.Framework
1071 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) 1032 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
1072 { 1033 {
1073 int reqnum = WebUtil.RequestNumber++; 1034 int reqnum = WebUtil.RequestNumber++;
1074 1035 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
1075 if (WebUtil.DebugLevel >= 3)
1076 m_log.DebugFormat(
1077 "[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}",
1078 reqnum, verb, requestUrl);
1079 1036
1080 int tickstart = Util.EnvironmentTickCount(); 1037 int tickstart = Util.EnvironmentTickCount();
1081 int tickdata = 0; 1038 int tickdata = 0;
@@ -1194,7 +1151,7 @@ namespace OpenSim.Framework
1194 } 1151 }
1195 1152
1196 m_log.InfoFormat( 1153 m_log.InfoFormat(
1197 "[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 1154 "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
1198 reqnum, 1155 reqnum,
1199 verb, 1156 verb,
1200 requestUrl, 1157 requestUrl,
@@ -1202,12 +1159,6 @@ namespace OpenSim.Framework
1202 tickdata, 1159 tickdata,
1203 originalRequest); 1160 originalRequest);
1204 } 1161 }
1205 else if (WebUtil.DebugLevel >= 4)
1206 {
1207 m_log.DebugFormat(
1208 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
1209 reqnum, tickdiff, tickdata);
1210 }
1211 1162
1212 return deserial; 1163 return deserial;
1213 } 1164 }