diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/ACL.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 68 | ||||
-rw-r--r-- | OpenSim/Framework/AgentUpdateArgs.cs | 34 | ||||
-rw-r--r-- | OpenSim/Framework/Animation.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 29 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarPickerAvatar.cs | 14 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/Culture.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/IProfileModule.cs | 37 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryFolderBase.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/LandData.cs | 129 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 339 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | 201 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/ThreadTrackerTests.cs | 192 | ||||
-rw-r--r-- | OpenSim/Framework/ThreadTracker.cs | 36 |
18 files changed, 1154 insertions, 21 deletions
diff --git a/OpenSim/Framework/ACL.cs b/OpenSim/Framework/ACL.cs index 9d7827e..3b1c0f0 100644 --- a/OpenSim/Framework/ACL.cs +++ b/OpenSim/Framework/ACL.cs | |||
@@ -46,6 +46,11 @@ namespace OpenSim.Framework | |||
46 | private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); | 46 | private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); |
47 | private Dictionary<string, Role> Roles = new Dictionary<string, Role>(); | 47 | private Dictionary<string, Role> Roles = new Dictionary<string, Role>(); |
48 | 48 | ||
49 | /// <summary> | ||
50 | /// Adds a new role | ||
51 | /// </summary> | ||
52 | /// <param name="role"></param> | ||
53 | /// <returns></returns> | ||
49 | public ACL AddRole(Role role) | 54 | public ACL AddRole(Role role) |
50 | { | 55 | { |
51 | if (Roles.ContainsKey(role.Name)) | 56 | if (Roles.ContainsKey(role.Name)) |
@@ -56,6 +61,11 @@ namespace OpenSim.Framework | |||
56 | return this; | 61 | return this; |
57 | } | 62 | } |
58 | 63 | ||
64 | /// <summary> | ||
65 | /// Adds a new resource | ||
66 | /// </summary> | ||
67 | /// <param name="resource"></param> | ||
68 | /// <returns></returns> | ||
59 | public ACL AddResource(Resource resource) | 69 | public ACL AddResource(Resource resource) |
60 | { | 70 | { |
61 | Resources.Add(resource.Name, resource); | 71 | Resources.Add(resource.Name, resource); |
@@ -63,6 +73,12 @@ namespace OpenSim.Framework | |||
63 | return this; | 73 | return this; |
64 | } | 74 | } |
65 | 75 | ||
76 | /// <summary> | ||
77 | /// Permision for user/roll on a resource | ||
78 | /// </summary> | ||
79 | /// <param name="role"></param> | ||
80 | /// <param name="resource"></param> | ||
81 | /// <returns></returns> | ||
66 | public Permission HasPermission(string role, string resource) | 82 | public Permission HasPermission(string role, string resource) |
67 | { | 83 | { |
68 | if (!Roles.ContainsKey(role)) | 84 | if (!Roles.ContainsKey(role)) |
@@ -234,6 +250,9 @@ namespace OpenSim.Framework | |||
234 | 250 | ||
235 | #region Tests | 251 | #region Tests |
236 | 252 | ||
253 | /// <summary> | ||
254 | /// ACL Test class | ||
255 | /// </summary> | ||
237 | internal class ACLTester | 256 | internal class ACLTester |
238 | { | 257 | { |
239 | public ACLTester() | 258 | public ACLTester() |
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index c38f0c3..6472f31 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -32,26 +32,83 @@ using OpenMetaverse.StructuredData; | |||
32 | 32 | ||
33 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
34 | { | 34 | { |
35 | /// <summary> | ||
36 | /// Circuit data for an agent. Connection information shared between | ||
37 | /// regions that accept UDP connections from a client | ||
38 | /// </summary> | ||
35 | public class AgentCircuitData | 39 | public class AgentCircuitData |
36 | { | 40 | { |
41 | /// <summary> | ||
42 | /// Avatar Unique Agent Identifier | ||
43 | /// </summary> | ||
37 | public UUID AgentID; | 44 | public UUID AgentID; |
45 | |||
46 | /// <summary> | ||
47 | /// Avatar's Appearance | ||
48 | /// </summary> | ||
38 | public AvatarAppearance Appearance; | 49 | public AvatarAppearance Appearance; |
50 | |||
51 | /// <summary> | ||
52 | /// Agent's root inventory folder | ||
53 | /// </summary> | ||
39 | public UUID BaseFolder; | 54 | public UUID BaseFolder; |
55 | |||
56 | /// <summary> | ||
57 | /// Base Caps path for user | ||
58 | /// </summary> | ||
40 | public string CapsPath = String.Empty; | 59 | public string CapsPath = String.Empty; |
60 | |||
61 | /// <summary> | ||
62 | /// Seed caps for neighbor regions that the user can see into | ||
63 | /// </summary> | ||
41 | public Dictionary<ulong, string> ChildrenCapSeeds; | 64 | public Dictionary<ulong, string> ChildrenCapSeeds; |
65 | |||
66 | /// <summary> | ||
67 | /// Root agent, or Child agent | ||
68 | /// </summary> | ||
42 | public bool child; | 69 | public bool child; |
70 | |||
71 | /// <summary> | ||
72 | /// Number given to the client when they log-in that they provide | ||
73 | /// as credentials to the UDP server | ||
74 | /// </summary> | ||
43 | public uint circuitcode; | 75 | public uint circuitcode; |
76 | |||
77 | /// <summary> | ||
78 | /// Agent's account first name | ||
79 | /// </summary> | ||
44 | public string firstname; | 80 | public string firstname; |
45 | public UUID InventoryFolder; | 81 | public UUID InventoryFolder; |
82 | |||
83 | /// <summary> | ||
84 | /// Agent's account last name | ||
85 | /// </summary> | ||
46 | public string lastname; | 86 | public string lastname; |
87 | |||
88 | /// <summary> | ||
89 | /// Random Unique GUID for this session. Client gets this at login and it's | ||
90 | /// only supposed to be disclosed over secure channels | ||
91 | /// </summary> | ||
47 | public UUID SecureSessionID; | 92 | public UUID SecureSessionID; |
93 | |||
94 | /// <summary> | ||
95 | /// Non secure Session ID | ||
96 | /// </summary> | ||
48 | public UUID SessionID; | 97 | public UUID SessionID; |
98 | |||
99 | /// <summary> | ||
100 | /// Position the Agent's Avatar starts in the region | ||
101 | /// </summary> | ||
49 | public Vector3 startpos; | 102 | public Vector3 startpos; |
50 | 103 | ||
51 | public AgentCircuitData() | 104 | public AgentCircuitData() |
52 | { | 105 | { |
53 | } | 106 | } |
54 | 107 | ||
108 | /// <summary> | ||
109 | /// Create AgentCircuitData from a Serializable AgentCircuitData | ||
110 | /// </summary> | ||
111 | /// <param name="cAgent"></param> | ||
55 | public AgentCircuitData(sAgentCircuitData cAgent) | 112 | public AgentCircuitData(sAgentCircuitData cAgent) |
56 | { | 113 | { |
57 | AgentID = new UUID(cAgent.AgentID); | 114 | AgentID = new UUID(cAgent.AgentID); |
@@ -68,6 +125,10 @@ namespace OpenSim.Framework | |||
68 | ChildrenCapSeeds = cAgent.ChildrenCapSeeds; | 125 | ChildrenCapSeeds = cAgent.ChildrenCapSeeds; |
69 | } | 126 | } |
70 | 127 | ||
128 | /// <summary> | ||
129 | /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json | ||
130 | /// </summary> | ||
131 | /// <returns>map of the agent circuit data</returns> | ||
71 | public OSDMap PackAgentCircuitData() | 132 | public OSDMap PackAgentCircuitData() |
72 | { | 133 | { |
73 | OSDMap args = new OSDMap(); | 134 | OSDMap args = new OSDMap(); |
@@ -98,6 +159,10 @@ namespace OpenSim.Framework | |||
98 | return args; | 159 | return args; |
99 | } | 160 | } |
100 | 161 | ||
162 | /// <summary> | ||
163 | /// Unpack agent circuit data map into an AgentCiruitData object | ||
164 | /// </summary> | ||
165 | /// <param name="args"></param> | ||
101 | public void UnpackAgentCircuitData(OSDMap args) | 166 | public void UnpackAgentCircuitData(OSDMap args) |
102 | { | 167 | { |
103 | if (args["agent_id"] != null) | 168 | if (args["agent_id"] != null) |
@@ -150,6 +215,9 @@ namespace OpenSim.Framework | |||
150 | } | 215 | } |
151 | } | 216 | } |
152 | 217 | ||
218 | /// <summary> | ||
219 | /// Serializable Agent Circuit Data | ||
220 | /// </summary> | ||
153 | [Serializable] | 221 | [Serializable] |
154 | public class sAgentCircuitData | 222 | public class sAgentCircuitData |
155 | { | 223 | { |
diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs index a19795d..7b9ec68 100644 --- a/OpenSim/Framework/AgentUpdateArgs.cs +++ b/OpenSim/Framework/AgentUpdateArgs.cs | |||
@@ -30,18 +30,52 @@ using OpenMetaverse; | |||
30 | 30 | ||
31 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
32 | { | 32 | { |
33 | /// <summary> | ||
34 | /// Client provided parameters for avatar movement | ||
35 | /// </summary> | ||
33 | public class AgentUpdateArgs : EventArgs | 36 | public class AgentUpdateArgs : EventArgs |
34 | { | 37 | { |
38 | /// <summary> | ||
39 | /// Agent's unique ID | ||
40 | /// </summary> | ||
35 | public UUID AgentID; | 41 | public UUID AgentID; |
42 | |||
43 | /// <summary> | ||
44 | /// Rotation of the avatar's body | ||
45 | /// </summary> | ||
36 | public Quaternion BodyRotation; | 46 | public Quaternion BodyRotation; |
47 | |||
48 | /// <summary> | ||
49 | /// AT portion of the camera matrix | ||
50 | /// </summary> | ||
37 | public Vector3 CameraAtAxis; | 51 | public Vector3 CameraAtAxis; |
52 | |||
53 | /// <summary> | ||
54 | /// Position of the camera in the Scene | ||
55 | /// </summary> | ||
38 | public Vector3 CameraCenter; | 56 | public Vector3 CameraCenter; |
39 | public Vector3 CameraLeftAxis; | 57 | public Vector3 CameraLeftAxis; |
40 | public Vector3 CameraUpAxis; | 58 | public Vector3 CameraUpAxis; |
59 | |||
60 | /// <summary> | ||
61 | /// Bitflag field for agent movement. Fly, forward, backward, turn left, turn right, go up, go down, Straffe, etc. | ||
62 | /// </summary> | ||
41 | public uint ControlFlags; | 63 | public uint ControlFlags; |
64 | |||
65 | /// <summary> | ||
66 | /// Agent's client Draw distance setting | ||
67 | /// </summary> | ||
42 | public float Far; | 68 | public float Far; |
43 | public byte Flags; | 69 | public byte Flags; |
70 | |||
71 | /// <summary> | ||
72 | /// Rotation of the avatar's head | ||
73 | /// </summary> | ||
44 | public Quaternion HeadRotation; | 74 | public Quaternion HeadRotation; |
75 | |||
76 | /// <summary> | ||
77 | /// Session Id | ||
78 | /// </summary> | ||
45 | public UUID SessionID; | 79 | public UUID SessionID; |
46 | public byte State; | 80 | public byte State; |
47 | } | 81 | } |
diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index 9f86513..232f5a1 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs | |||
@@ -31,10 +31,17 @@ using OpenMetaverse.StructuredData; | |||
31 | 31 | ||
32 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
33 | { | 33 | { |
34 | /// <summary> | ||
35 | /// Information about an Animation | ||
36 | /// </summary> | ||
34 | [Serializable] | 37 | [Serializable] |
35 | public class Animation | 38 | public class Animation |
36 | { | 39 | { |
37 | private UUID animID; | 40 | private UUID animID; |
41 | |||
42 | /// <summary> | ||
43 | /// ID of Animation | ||
44 | /// </summary> | ||
38 | public UUID AnimID | 45 | public UUID AnimID |
39 | { | 46 | { |
40 | get { return animID; } | 47 | get { return animID; } |
@@ -49,6 +56,10 @@ namespace OpenSim.Framework | |||
49 | } | 56 | } |
50 | 57 | ||
51 | private UUID objectID; | 58 | private UUID objectID; |
59 | |||
60 | /// <summary> | ||
61 | /// Unique ID of object that is being animated | ||
62 | /// </summary> | ||
52 | public UUID ObjectID | 63 | public UUID ObjectID |
53 | { | 64 | { |
54 | get { return objectID; } | 65 | get { return objectID; } |
@@ -59,6 +70,12 @@ namespace OpenSim.Framework | |||
59 | { | 70 | { |
60 | } | 71 | } |
61 | 72 | ||
73 | /// <summary> | ||
74 | /// Creates an Animation based on the data | ||
75 | /// </summary> | ||
76 | /// <param name="animID">UUID ID of animation</param> | ||
77 | /// <param name="sequenceNum"></param> | ||
78 | /// <param name="objectID">ID of object to be animated</param> | ||
62 | public Animation(UUID animID, int sequenceNum, UUID objectID) | 79 | public Animation(UUID animID, int sequenceNum, UUID objectID) |
63 | { | 80 | { |
64 | this.animID = animID; | 81 | this.animID = animID; |
@@ -66,11 +83,20 @@ namespace OpenSim.Framework | |||
66 | this.objectID = objectID; | 83 | this.objectID = objectID; |
67 | } | 84 | } |
68 | 85 | ||
86 | /// <summary> | ||
87 | /// Animation from OSDMap from LLSD XML or LLSD json | ||
88 | /// </summary> | ||
89 | /// <param name="args"></param> | ||
69 | public Animation(OSDMap args) | 90 | public Animation(OSDMap args) |
70 | { | 91 | { |
71 | UnpackUpdateMessage(args); | 92 | UnpackUpdateMessage(args); |
72 | } | 93 | } |
73 | 94 | ||
95 | |||
96 | /// <summary> | ||
97 | /// Pack this object up as an OSDMap for transferring via LLSD XML or LLSD json | ||
98 | /// </summary> | ||
99 | /// <returns></returns> | ||
74 | public OSDMap PackUpdateMessage() | 100 | public OSDMap PackUpdateMessage() |
75 | { | 101 | { |
76 | OSDMap anim = new OSDMap(); | 102 | OSDMap anim = new OSDMap(); |
@@ -80,6 +106,10 @@ namespace OpenSim.Framework | |||
80 | return anim; | 106 | return anim; |
81 | } | 107 | } |
82 | 108 | ||
109 | /// <summary> | ||
110 | /// Fill object with data from OSDMap | ||
111 | /// </summary> | ||
112 | /// <param name="args"></param> | ||
83 | public void UnpackUpdateMessage(OSDMap args) | 113 | public void UnpackUpdateMessage(OSDMap args) |
84 | { | 114 | { |
85 | if (args["animation"] != null) | 115 | if (args["animation"] != null) |
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 614670c..9679ff2 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -31,10 +31,20 @@ using OpenMetaverse; | |||
31 | 31 | ||
32 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
33 | { | 33 | { |
34 | /// <summary> | ||
35 | /// Asset class. All Assets are reference by this class or a class derived from this class | ||
36 | /// </summary> | ||
34 | [Serializable] | 37 | [Serializable] |
35 | public class AssetBase | 38 | public class AssetBase |
36 | { | 39 | { |
40 | /// <summary> | ||
41 | /// Data of the Asset | ||
42 | /// </summary> | ||
37 | private byte[] m_data; | 43 | private byte[] m_data; |
44 | |||
45 | /// <summary> | ||
46 | /// Meta Data of the Asset | ||
47 | /// </summary> | ||
38 | private AssetMetadata m_metadata; | 48 | private AssetMetadata m_metadata; |
39 | 49 | ||
40 | public AssetBase() | 50 | public AssetBase() |
@@ -71,6 +81,9 @@ namespace OpenSim.Framework | |||
71 | 81 | ||
72 | } | 82 | } |
73 | 83 | ||
84 | /// <summary> | ||
85 | /// Checks if this asset is a binary or text asset | ||
86 | /// </summary> | ||
74 | public bool IsBinaryAsset | 87 | public bool IsBinaryAsset |
75 | { | 88 | { |
76 | get | 89 | get |
@@ -102,12 +115,17 @@ namespace OpenSim.Framework | |||
102 | set { m_data = value; } | 115 | set { m_data = value; } |
103 | } | 116 | } |
104 | 117 | ||
118 | /// <summary> | ||
119 | /// Asset UUID | ||
120 | /// </summary> | ||
105 | public UUID FullID | 121 | public UUID FullID |
106 | { | 122 | { |
107 | get { return m_metadata.FullID; } | 123 | get { return m_metadata.FullID; } |
108 | set { m_metadata.FullID = value; } | 124 | set { m_metadata.FullID = value; } |
109 | } | 125 | } |
110 | 126 | /// <summary> | |
127 | /// Asset MetaData ID (transferring from UUID to string ID) | ||
128 | /// </summary> | ||
111 | public string ID | 129 | public string ID |
112 | { | 130 | { |
113 | get { return m_metadata.ID; } | 131 | get { return m_metadata.ID; } |
@@ -126,18 +144,27 @@ namespace OpenSim.Framework | |||
126 | set { m_metadata.Description = value; } | 144 | set { m_metadata.Description = value; } |
127 | } | 145 | } |
128 | 146 | ||
147 | /// <summary> | ||
148 | /// (sbyte) AssetType enum | ||
149 | /// </summary> | ||
129 | public sbyte Type | 150 | public sbyte Type |
130 | { | 151 | { |
131 | get { return m_metadata.Type; } | 152 | get { return m_metadata.Type; } |
132 | set { m_metadata.Type = value; } | 153 | set { m_metadata.Type = value; } |
133 | } | 154 | } |
134 | 155 | ||
156 | /// <summary> | ||
157 | /// Is this a region only asset, or does this exist on the asset server also | ||
158 | /// </summary> | ||
135 | public bool Local | 159 | public bool Local |
136 | { | 160 | { |
137 | get { return m_metadata.Local; } | 161 | get { return m_metadata.Local; } |
138 | set { m_metadata.Local = value; } | 162 | set { m_metadata.Local = value; } |
139 | } | 163 | } |
140 | 164 | ||
165 | /// <summary> | ||
166 | /// Is this asset going to be saved to the asset database? | ||
167 | /// </summary> | ||
141 | public bool Temporary | 168 | public bool Temporary |
142 | { | 169 | { |
143 | get { return m_metadata.Temporary; } | 170 | get { return m_metadata.Temporary; } |
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 6a07bc9..7270f32 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -28,14 +28,13 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Runtime.Serialization; | ||
32 | using System.Security.Permissions; | ||
33 | using OpenMetaverse; | 31 | using OpenMetaverse; |
34 | using log4net; | ||
35 | using System.Reflection; | ||
36 | 32 | ||
37 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
38 | { | 34 | { |
35 | /// <summary> | ||
36 | /// Contains the Avatar's Appearance and methods to manipulate the appearance. | ||
37 | /// </summary> | ||
39 | public class AvatarAppearance | 38 | public class AvatarAppearance |
40 | { | 39 | { |
41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Framework/AvatarPickerAvatar.cs b/OpenSim/Framework/AvatarPickerAvatar.cs index 0e8602d..200c054 100644 --- a/OpenSim/Framework/AvatarPickerAvatar.cs +++ b/OpenSim/Framework/AvatarPickerAvatar.cs | |||
@@ -29,10 +29,24 @@ using OpenMetaverse; | |||
29 | 29 | ||
30 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
31 | { | 31 | { |
32 | /// <summary> | ||
33 | /// Avatar returned by the Avatar Picker request | ||
34 | /// </summary> | ||
32 | public class AvatarPickerAvatar | 35 | public class AvatarPickerAvatar |
33 | { | 36 | { |
37 | /// <summary> | ||
38 | /// Avatar's Unique ID | ||
39 | /// </summary> | ||
34 | public UUID AvatarID; | 40 | public UUID AvatarID; |
41 | |||
42 | /// <summary> | ||
43 | /// Avatar's Account first name | ||
44 | /// </summary> | ||
35 | public string firstName; | 45 | public string firstName; |
46 | |||
47 | /// <summary> | ||
48 | /// Avatar's Account last name | ||
49 | /// </summary> | ||
36 | public string lastName; | 50 | public string lastName; |
37 | } | 51 | } |
38 | } | 52 | } |
diff --git a/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs b/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs index 8fd21d7..54835da 100644 --- a/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs +++ b/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs | |||
@@ -30,9 +30,19 @@ using OpenMetaverse; | |||
30 | 30 | ||
31 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
32 | { | 32 | { |
33 | /// <summary> | ||
34 | /// Args to return to a client that queries picker data | ||
35 | /// </summary> | ||
33 | public class AvatarPickerReplyAgentDataArgs : EventArgs | 36 | public class AvatarPickerReplyAgentDataArgs : EventArgs |
34 | { | 37 | { |
38 | /// <summary> | ||
39 | /// Unique Agent ID | ||
40 | /// </summary> | ||
35 | public UUID AgentID; | 41 | public UUID AgentID; |
42 | |||
43 | /// <summary> | ||
44 | /// ID of query user submitted | ||
45 | /// </summary> | ||
36 | public UUID QueryID; | 46 | public UUID QueryID; |
37 | } | 47 | } |
38 | } | 48 | } |
diff --git a/OpenSim/Framework/Culture.cs b/OpenSim/Framework/Culture.cs index c76841d..2066794 100644 --- a/OpenSim/Framework/Culture.cs +++ b/OpenSim/Framework/Culture.cs | |||
@@ -45,6 +45,9 @@ namespace OpenSim.Framework | |||
45 | get { return m_cultureInfo; } | 45 | get { return m_cultureInfo; } |
46 | } | 46 | } |
47 | 47 | ||
48 | /// <summary> | ||
49 | /// Set Culture to en-US to make string processing of numbers simpler. | ||
50 | /// </summary> | ||
48 | public static void SetCurrentCulture() | 51 | public static void SetCurrentCulture() |
49 | { | 52 | { |
50 | Thread.CurrentThread.CurrentCulture = m_cultureInfo; | 53 | Thread.CurrentThread.CurrentCulture = m_cultureInfo; |
diff --git a/OpenSim/Framework/IProfileModule.cs b/OpenSim/Framework/IProfileModule.cs new file mode 100644 index 0000000..f54810e --- /dev/null +++ b/OpenSim/Framework/IProfileModule.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | public interface IProfileModule | ||
34 | { | ||
35 | Hashtable GetProfileData(UUID userID); | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index e923f39..05f11a4 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs | |||
@@ -68,5 +68,24 @@ namespace OpenSim.Framework | |||
68 | get { return _version; } | 68 | get { return _version; } |
69 | set { _version = value; } | 69 | set { _version = value; } |
70 | } | 70 | } |
71 | |||
72 | public InventoryFolderBase() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | public InventoryFolderBase(UUID id) | ||
77 | { | ||
78 | ID = id; | ||
79 | } | ||
80 | |||
81 | public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) | ||
82 | { | ||
83 | ID = id; | ||
84 | Name = name; | ||
85 | Owner = owner; | ||
86 | Type = type; | ||
87 | ParentID = parent; | ||
88 | Version = version; | ||
89 | } | ||
71 | } | 90 | } |
72 | } | 91 | } |
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index d6afb95..a24af04 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -31,6 +31,9 @@ using OpenMetaverse; | |||
31 | 31 | ||
32 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
33 | { | 33 | { |
34 | /// <summary> | ||
35 | /// Details of a Parcel of land | ||
36 | /// </summary> | ||
34 | public class LandData | 37 | public class LandData |
35 | { | 38 | { |
36 | private Vector3 _AABBMax = new Vector3(); | 39 | private Vector3 _AABBMax = new Vector3(); |
@@ -80,6 +83,9 @@ namespace OpenSim.Framework | |||
80 | private int _dwell = 0; | 83 | private int _dwell = 0; |
81 | private int _otherCleanTime = 0; | 84 | private int _otherCleanTime = 0; |
82 | 85 | ||
86 | /// <summary> | ||
87 | /// Upper corner of the AABB for the parcel | ||
88 | /// </summary> | ||
83 | public Vector3 AABBMax { | 89 | public Vector3 AABBMax { |
84 | get { | 90 | get { |
85 | return _AABBMax; | 91 | return _AABBMax; |
@@ -88,7 +94,9 @@ namespace OpenSim.Framework | |||
88 | _AABBMax = value; | 94 | _AABBMax = value; |
89 | } | 95 | } |
90 | } | 96 | } |
91 | 97 | /// <summary> | |
98 | /// Lower corner of the AABB for the parcel | ||
99 | /// </summary> | ||
92 | public Vector3 AABBMin { | 100 | public Vector3 AABBMin { |
93 | get { | 101 | get { |
94 | return _AABBMin; | 102 | return _AABBMin; |
@@ -98,6 +106,9 @@ namespace OpenSim.Framework | |||
98 | } | 106 | } |
99 | } | 107 | } |
100 | 108 | ||
109 | /// <summary> | ||
110 | /// Area in meters^2 the parcel contains | ||
111 | /// </summary> | ||
101 | public int Area { | 112 | public int Area { |
102 | get { | 113 | get { |
103 | return _area; | 114 | return _area; |
@@ -107,6 +118,9 @@ namespace OpenSim.Framework | |||
107 | } | 118 | } |
108 | } | 119 | } |
109 | 120 | ||
121 | /// <summary> | ||
122 | /// ID of auction (3rd Party Integration) when parcel is being auctioned | ||
123 | /// </summary> | ||
110 | public uint AuctionID { | 124 | public uint AuctionID { |
111 | get { | 125 | get { |
112 | return _auctionID; | 126 | return _auctionID; |
@@ -116,6 +130,9 @@ namespace OpenSim.Framework | |||
116 | } | 130 | } |
117 | } | 131 | } |
118 | 132 | ||
133 | /// <summary> | ||
134 | /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it. | ||
135 | /// </summary> | ||
119 | public UUID AuthBuyerID { | 136 | public UUID AuthBuyerID { |
120 | get { | 137 | get { |
121 | return _authBuyerID; | 138 | return _authBuyerID; |
@@ -125,6 +142,9 @@ namespace OpenSim.Framework | |||
125 | } | 142 | } |
126 | } | 143 | } |
127 | 144 | ||
145 | /// <summary> | ||
146 | /// Category of parcel. Used for classifying the parcel in classified listings | ||
147 | /// </summary> | ||
128 | public ParcelCategory Category { | 148 | public ParcelCategory Category { |
129 | get { | 149 | get { |
130 | return _category; | 150 | return _category; |
@@ -134,6 +154,9 @@ namespace OpenSim.Framework | |||
134 | } | 154 | } |
135 | } | 155 | } |
136 | 156 | ||
157 | /// <summary> | ||
158 | /// Date that the current owner purchased or claimed the parcel | ||
159 | /// </summary> | ||
137 | public int ClaimDate { | 160 | public int ClaimDate { |
138 | get { | 161 | get { |
139 | return _claimDate; | 162 | return _claimDate; |
@@ -143,6 +166,9 @@ namespace OpenSim.Framework | |||
143 | } | 166 | } |
144 | } | 167 | } |
145 | 168 | ||
169 | /// <summary> | ||
170 | /// The last price that the parcel was sold at | ||
171 | /// </summary> | ||
146 | public int ClaimPrice { | 172 | public int ClaimPrice { |
147 | get { | 173 | get { |
148 | return _claimPrice; | 174 | return _claimPrice; |
@@ -152,6 +178,9 @@ namespace OpenSim.Framework | |||
152 | } | 178 | } |
153 | } | 179 | } |
154 | 180 | ||
181 | /// <summary> | ||
182 | /// Global ID for the parcel. (3rd Party Integration) | ||
183 | /// </summary> | ||
155 | public UUID GlobalID { | 184 | public UUID GlobalID { |
156 | get { | 185 | get { |
157 | return _globalID; | 186 | return _globalID; |
@@ -161,6 +190,9 @@ namespace OpenSim.Framework | |||
161 | } | 190 | } |
162 | } | 191 | } |
163 | 192 | ||
193 | /// <summary> | ||
194 | /// Unique ID of the Group that owns | ||
195 | /// </summary> | ||
164 | public UUID GroupID { | 196 | public UUID GroupID { |
165 | get { | 197 | get { |
166 | return _groupID; | 198 | return _groupID; |
@@ -170,6 +202,9 @@ namespace OpenSim.Framework | |||
170 | } | 202 | } |
171 | } | 203 | } |
172 | 204 | ||
205 | /// <summary> | ||
206 | /// Number of SceneObjectPart that are owned by a Group | ||
207 | /// </summary> | ||
173 | public int GroupPrims { | 208 | public int GroupPrims { |
174 | get { | 209 | get { |
175 | return _groupPrims; | 210 | return _groupPrims; |
@@ -179,6 +214,9 @@ namespace OpenSim.Framework | |||
179 | } | 214 | } |
180 | } | 215 | } |
181 | 216 | ||
217 | /// <summary> | ||
218 | /// Returns true if the Land Parcel is owned by a group | ||
219 | /// </summary> | ||
182 | public bool IsGroupOwned { | 220 | public bool IsGroupOwned { |
183 | get { | 221 | get { |
184 | return _isGroupOwned; | 222 | return _isGroupOwned; |
@@ -188,6 +226,9 @@ namespace OpenSim.Framework | |||
188 | } | 226 | } |
189 | } | 227 | } |
190 | 228 | ||
229 | /// <summary> | ||
230 | /// jp2 data for the image representative of the parcel in the parcel dialog | ||
231 | /// </summary> | ||
191 | public byte[] Bitmap { | 232 | public byte[] Bitmap { |
192 | get { | 233 | get { |
193 | return _bitmap; | 234 | return _bitmap; |
@@ -197,6 +238,9 @@ namespace OpenSim.Framework | |||
197 | } | 238 | } |
198 | } | 239 | } |
199 | 240 | ||
241 | /// <summary> | ||
242 | /// Parcel Description | ||
243 | /// </summary> | ||
200 | public string Description { | 244 | public string Description { |
201 | get { | 245 | get { |
202 | return _description; | 246 | return _description; |
@@ -206,6 +250,9 @@ namespace OpenSim.Framework | |||
206 | } | 250 | } |
207 | } | 251 | } |
208 | 252 | ||
253 | /// <summary> | ||
254 | /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags | ||
255 | /// </summary> | ||
209 | public uint Flags { | 256 | public uint Flags { |
210 | get { | 257 | get { |
211 | return _flags; | 258 | return _flags; |
@@ -215,6 +262,10 @@ namespace OpenSim.Framework | |||
215 | } | 262 | } |
216 | } | 263 | } |
217 | 264 | ||
265 | /// <summary> | ||
266 | /// Determines if people are able to teleport where they please on the parcel or if they | ||
267 | /// get constrainted to a specific point on teleport within the parcel | ||
268 | /// </summary> | ||
218 | public byte LandingType { | 269 | public byte LandingType { |
219 | get { | 270 | get { |
220 | return _landingType; | 271 | return _landingType; |
@@ -224,6 +275,9 @@ namespace OpenSim.Framework | |||
224 | } | 275 | } |
225 | } | 276 | } |
226 | 277 | ||
278 | /// <summary> | ||
279 | /// Parcel Name | ||
280 | /// </summary> | ||
227 | public string Name { | 281 | public string Name { |
228 | get { | 282 | get { |
229 | return _name; | 283 | return _name; |
@@ -233,6 +287,9 @@ namespace OpenSim.Framework | |||
233 | } | 287 | } |
234 | } | 288 | } |
235 | 289 | ||
290 | /// <summary> | ||
291 | /// Status of Parcel, Leased, Abandoned, For Sale | ||
292 | /// </summary> | ||
236 | public ParcelStatus Status { | 293 | public ParcelStatus Status { |
237 | get { | 294 | get { |
238 | return _status; | 295 | return _status; |
@@ -242,6 +299,9 @@ namespace OpenSim.Framework | |||
242 | } | 299 | } |
243 | } | 300 | } |
244 | 301 | ||
302 | /// <summary> | ||
303 | /// Internal ID of the parcel. Sometimes the client will try to use this value | ||
304 | /// </summary> | ||
245 | public int LocalID { | 305 | public int LocalID { |
246 | get { | 306 | get { |
247 | return _localID; | 307 | return _localID; |
@@ -251,6 +311,9 @@ namespace OpenSim.Framework | |||
251 | } | 311 | } |
252 | } | 312 | } |
253 | 313 | ||
314 | /// <summary> | ||
315 | /// Determines if we scale the media based on the surface it's on | ||
316 | /// </summary> | ||
254 | public byte MediaAutoScale { | 317 | public byte MediaAutoScale { |
255 | get { | 318 | get { |
256 | return _mediaAutoScale; | 319 | return _mediaAutoScale; |
@@ -260,6 +323,9 @@ namespace OpenSim.Framework | |||
260 | } | 323 | } |
261 | } | 324 | } |
262 | 325 | ||
326 | /// <summary> | ||
327 | /// Texture Guid to replace with the output of the media stream | ||
328 | /// </summary> | ||
263 | public UUID MediaID { | 329 | public UUID MediaID { |
264 | get { | 330 | get { |
265 | return _mediaID; | 331 | return _mediaID; |
@@ -269,6 +335,9 @@ namespace OpenSim.Framework | |||
269 | } | 335 | } |
270 | } | 336 | } |
271 | 337 | ||
338 | /// <summary> | ||
339 | /// URL to the media file to display | ||
340 | /// </summary> | ||
272 | public string MediaURL { | 341 | public string MediaURL { |
273 | get { | 342 | get { |
274 | return _mediaURL; | 343 | return _mediaURL; |
@@ -278,6 +347,9 @@ namespace OpenSim.Framework | |||
278 | } | 347 | } |
279 | } | 348 | } |
280 | 349 | ||
350 | /// <summary> | ||
351 | /// URL to the shoutcast music stream to play on the parcel | ||
352 | /// </summary> | ||
281 | public string MusicURL { | 353 | public string MusicURL { |
282 | get { | 354 | get { |
283 | return _musicURL; | 355 | return _musicURL; |
@@ -287,6 +359,10 @@ namespace OpenSim.Framework | |||
287 | } | 359 | } |
288 | } | 360 | } |
289 | 361 | ||
362 | /// <summary> | ||
363 | /// Number of SceneObjectPart that are owned by users who do not own the parcel | ||
364 | /// and don't have the 'group. These are elegable for AutoReturn collection | ||
365 | /// </summary> | ||
290 | public int OtherPrims { | 366 | public int OtherPrims { |
291 | get { | 367 | get { |
292 | return _otherPrims; | 368 | return _otherPrims; |
@@ -296,6 +372,10 @@ namespace OpenSim.Framework | |||
296 | } | 372 | } |
297 | } | 373 | } |
298 | 374 | ||
375 | /// <summary> | ||
376 | /// Owner Avatar or Group of the parcel. Naturally, all land masses must be | ||
377 | /// owned by someone | ||
378 | /// </summary> | ||
299 | public UUID OwnerID { | 379 | public UUID OwnerID { |
300 | get { | 380 | get { |
301 | return _ownerID; | 381 | return _ownerID; |
@@ -305,6 +385,9 @@ namespace OpenSim.Framework | |||
305 | } | 385 | } |
306 | } | 386 | } |
307 | 387 | ||
388 | /// <summary> | ||
389 | /// Number of SceneObjectPart that are owned by the owner of the parcel | ||
390 | /// </summary> | ||
308 | public int OwnerPrims { | 391 | public int OwnerPrims { |
309 | get { | 392 | get { |
310 | return _ownerPrims; | 393 | return _ownerPrims; |
@@ -314,6 +397,9 @@ namespace OpenSim.Framework | |||
314 | } | 397 | } |
315 | } | 398 | } |
316 | 399 | ||
400 | /// <summary> | ||
401 | /// List of access data for the parcel. User data, some bitflags, and a time | ||
402 | /// </summary> | ||
317 | public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { | 403 | public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { |
318 | get { | 404 | get { |
319 | return _parcelAccessList; | 405 | return _parcelAccessList; |
@@ -323,6 +409,9 @@ namespace OpenSim.Framework | |||
323 | } | 409 | } |
324 | } | 410 | } |
325 | 411 | ||
412 | /// <summary> | ||
413 | /// How long in hours a Pass to the parcel is given | ||
414 | /// </summary> | ||
326 | public float PassHours { | 415 | public float PassHours { |
327 | get { | 416 | get { |
328 | return _passHours; | 417 | return _passHours; |
@@ -332,6 +421,9 @@ namespace OpenSim.Framework | |||
332 | } | 421 | } |
333 | } | 422 | } |
334 | 423 | ||
424 | /// <summary> | ||
425 | /// Price to purchase a Pass to a restricted parcel | ||
426 | /// </summary> | ||
335 | public int PassPrice { | 427 | public int PassPrice { |
336 | get { | 428 | get { |
337 | return _passPrice; | 429 | return _passPrice; |
@@ -341,6 +433,9 @@ namespace OpenSim.Framework | |||
341 | } | 433 | } |
342 | } | 434 | } |
343 | 435 | ||
436 | /// <summary> | ||
437 | /// When the parcel is being sold, this is the price to purchase the parcel | ||
438 | /// </summary> | ||
344 | public int SalePrice { | 439 | public int SalePrice { |
345 | get { | 440 | get { |
346 | return _salePrice; | 441 | return _salePrice; |
@@ -350,6 +445,9 @@ namespace OpenSim.Framework | |||
350 | } | 445 | } |
351 | } | 446 | } |
352 | 447 | ||
448 | /// <summary> | ||
449 | /// Number of SceneObjectPart that are currently selected by avatar | ||
450 | /// </summary> | ||
353 | public int SelectedPrims { | 451 | public int SelectedPrims { |
354 | get { | 452 | get { |
355 | return _selectedPrims; | 453 | return _selectedPrims; |
@@ -359,6 +457,9 @@ namespace OpenSim.Framework | |||
359 | } | 457 | } |
360 | } | 458 | } |
361 | 459 | ||
460 | /// <summary> | ||
461 | /// Number of meters^2 in the Simulator | ||
462 | /// </summary> | ||
362 | public int SimwideArea { | 463 | public int SimwideArea { |
363 | get { | 464 | get { |
364 | return _simwideArea; | 465 | return _simwideArea; |
@@ -368,6 +469,9 @@ namespace OpenSim.Framework | |||
368 | } | 469 | } |
369 | } | 470 | } |
370 | 471 | ||
472 | /// <summary> | ||
473 | /// Number of SceneObjectPart in the Simulator | ||
474 | /// </summary> | ||
371 | public int SimwidePrims { | 475 | public int SimwidePrims { |
372 | get { | 476 | get { |
373 | return _simwidePrims; | 477 | return _simwidePrims; |
@@ -377,6 +481,9 @@ namespace OpenSim.Framework | |||
377 | } | 481 | } |
378 | } | 482 | } |
379 | 483 | ||
484 | /// <summary> | ||
485 | /// ID of the snapshot used in the client parcel dialog of the parcel | ||
486 | /// </summary> | ||
380 | public UUID SnapshotID { | 487 | public UUID SnapshotID { |
381 | get { | 488 | get { |
382 | return _snapshotID; | 489 | return _snapshotID; |
@@ -386,6 +493,10 @@ namespace OpenSim.Framework | |||
386 | } | 493 | } |
387 | } | 494 | } |
388 | 495 | ||
496 | /// <summary> | ||
497 | /// When teleporting is restricted to a certain point, this is the location | ||
498 | /// that the user will be redirected to | ||
499 | /// </summary> | ||
389 | public Vector3 UserLocation { | 500 | public Vector3 UserLocation { |
390 | get { | 501 | get { |
391 | return _userLocation; | 502 | return _userLocation; |
@@ -395,6 +506,10 @@ namespace OpenSim.Framework | |||
395 | } | 506 | } |
396 | } | 507 | } |
397 | 508 | ||
509 | /// <summary> | ||
510 | /// When teleporting is restricted to a certain point, this is the rotation | ||
511 | /// that the user will be positioned | ||
512 | /// </summary> | ||
398 | public Vector3 UserLookAt { | 513 | public Vector3 UserLookAt { |
399 | get { | 514 | get { |
400 | return _userLookAt; | 515 | return _userLookAt; |
@@ -404,6 +519,9 @@ namespace OpenSim.Framework | |||
404 | } | 519 | } |
405 | } | 520 | } |
406 | 521 | ||
522 | /// <summary> | ||
523 | /// Depreciated idea. Number of visitors ~= free money | ||
524 | /// </summary> | ||
407 | public int Dwell { | 525 | public int Dwell { |
408 | get { | 526 | get { |
409 | return _dwell; | 527 | return _dwell; |
@@ -413,6 +531,10 @@ namespace OpenSim.Framework | |||
413 | } | 531 | } |
414 | } | 532 | } |
415 | 533 | ||
534 | /// <summary> | ||
535 | /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own | ||
536 | /// the parcel and isn't set to the same 'group' as the parcel. | ||
537 | /// </summary> | ||
416 | public int OtherCleanTime { | 538 | public int OtherCleanTime { |
417 | get { | 539 | get { |
418 | return _otherCleanTime; | 540 | return _otherCleanTime; |
@@ -422,11 +544,16 @@ namespace OpenSim.Framework | |||
422 | } | 544 | } |
423 | } | 545 | } |
424 | 546 | ||
547 | |||
425 | public LandData() | 548 | public LandData() |
426 | { | 549 | { |
427 | _globalID = UUID.Random(); | 550 | _globalID = UUID.Random(); |
428 | } | 551 | } |
429 | 552 | ||
553 | /// <summary> | ||
554 | /// Make a new copy of the land data | ||
555 | /// </summary> | ||
556 | /// <returns></returns> | ||
430 | public LandData Copy() | 557 | public LandData Copy() |
431 | { | 558 | { |
432 | LandData landData = new LandData(); | 559 | LandData landData = new LandData(); |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 2a97528..7a244ff 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -443,7 +443,7 @@ namespace OpenSim.Framework.Servers | |||
443 | string inputLine; | 443 | string inputLine; |
444 | int strcmp; | 444 | int strcmp; |
445 | 445 | ||
446 | if (File.Exists( gitCommitFileName)) | 446 | if (File.Exists(gitCommitFileName)) |
447 | { | 447 | { |
448 | StreamReader CommitFile = File.OpenText(gitCommitFileName); | 448 | StreamReader CommitFile = File.OpenText(gitCommitFileName); |
449 | buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine(); | 449 | buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine(); |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index c74eab1..75c9310 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -964,8 +964,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
964 | } | 964 | } |
965 | } | 965 | } |
966 | 966 | ||
967 | response.ContentType = "application/llsd+json"; | 967 | // response.ContentType = "application/llsd+json"; |
968 | return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); | 968 | // return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); |
969 | response.ContentType = "application/llsd+xml"; | ||
970 | return OSDParser.SerializeLLSDXmlBytes(llsdResponse); | ||
969 | } | 971 | } |
970 | 972 | ||
971 | /// <summary> | 973 | /// <summary> |
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs new file mode 100644 index 0000000..0bf8f64 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs | |||
@@ -0,0 +1,339 @@ | |||
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 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | ||
29 | using OpenMetaverse.StructuredData; | ||
30 | using NUnit.Framework; | ||
31 | |||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class AgentCircuitDataTest | ||
37 | { | ||
38 | private UUID AgentId; | ||
39 | private AvatarAppearance AvAppearance; | ||
40 | private byte[] VisualParams; | ||
41 | private UUID BaseFolder; | ||
42 | private string CapsPath; | ||
43 | private Dictionary<ulong, string> ChildrenCapsPaths; | ||
44 | private uint circuitcode = 0949030; | ||
45 | private string firstname; | ||
46 | private string lastname; | ||
47 | private UUID SecureSessionId; | ||
48 | private UUID SessionId; | ||
49 | private Vector3 StartPos; | ||
50 | |||
51 | |||
52 | [SetUp] | ||
53 | public void setup() | ||
54 | { | ||
55 | AgentId = UUID.Random(); | ||
56 | BaseFolder = UUID.Random(); | ||
57 | CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
58 | ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
59 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
60 | firstname = "CoolAvatarTest"; | ||
61 | lastname = "test"; | ||
62 | StartPos = new Vector3(5,23,125); | ||
63 | |||
64 | SecureSessionId = UUID.Random(); | ||
65 | SessionId = UUID.Random(); | ||
66 | |||
67 | AvAppearance = new AvatarAppearance(AgentId); | ||
68 | AvAppearance.SetDefaultWearables(); | ||
69 | VisualParams = new byte[218]; | ||
70 | AvAppearance.SetDefaultParams(VisualParams); | ||
71 | |||
72 | //body | ||
73 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; | ||
74 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00; | ||
75 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BODY_FAT] = 0; | ||
76 | |||
77 | //Torso | ||
78 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48; | ||
79 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_THICKNESS] = 43; | ||
80 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255; | ||
81 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHOULDERS] = 94; | ||
82 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199; | ||
83 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ARM_LENGTH] = 255; | ||
84 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33; | ||
85 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_LENGTH] = 240; | ||
86 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0; | ||
87 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BELLY_SIZE] = 0; | ||
88 | |||
89 | // legs | ||
90 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82; | ||
91 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_LENGTH] = 255; | ||
92 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84; | ||
93 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_LENGTH] = 166; | ||
94 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64; | ||
95 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SADDLEBAGS] = 89; | ||
96 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127; | ||
97 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOOT_SIZE] = 45; | ||
98 | |||
99 | |||
100 | // head | ||
101 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255; | ||
102 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUASH_STRETCH_HEAD] = 0; // head stretch | ||
103 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155; | ||
104 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EGG_HEAD] = 127; | ||
105 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
106 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_LENGTH] = 45; | ||
107 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127; | ||
108 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOREHEAD_ANGLE] = 104; | ||
109 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94; | ||
110 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_PUFFY_UPPER_CHEEKS] = 0; // upper cheeks | ||
111 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122; // lower cheeks | ||
112 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIGH_CHEEK_BONES] = 130; | ||
113 | |||
114 | |||
115 | |||
116 | // eyes | ||
117 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105; | ||
118 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_EYES] = 135; | ||
119 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184; | ||
120 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_CORNER_UP] = 230; | ||
121 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120; | ||
122 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_DEPTH] = 158; | ||
123 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69; | ||
124 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BAGGY_EYES] = 38; | ||
125 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127; | ||
126 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POP_EYE] = 127; | ||
127 | |||
128 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25; | ||
129 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_LIGHTNESS] = 127; | ||
130 | |||
131 | // ears | ||
132 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255; | ||
133 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EARS_OUT] = 127; | ||
134 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127; | ||
135 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
136 | |||
137 | // nose | ||
138 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79; | ||
139 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE] = 35; | ||
140 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86; | ||
141 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOW_SEPTUM_NOSE] = 112; // nostril division | ||
142 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25; | ||
143 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOBLE_NOSE_BRIDGE] = 25; // upper bridge | ||
144 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25; // lower bridge | ||
145 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE_BRIDGE] = 25; | ||
146 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107; | ||
147 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE_TIP] = 25; | ||
148 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127; | ||
149 | |||
150 | |||
151 | // Mouth | ||
152 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_WIDTH] = 122; | ||
153 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10; // lip fullness | ||
154 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_THICKNESS] = 112; | ||
155 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137; | ||
156 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_HEIGHT] = 176; | ||
157 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140; // Sad --> happy | ||
158 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_CLEFT_DEEP] = 84; | ||
159 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84; | ||
160 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHIFT_MOUTH] = 127; | ||
161 | |||
162 | |||
163 | // chin | ||
164 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119; | ||
165 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUARE_JAW] = 5; | ||
166 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132; | ||
167 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_ANGLE] = 153; | ||
168 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100; | ||
169 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JOWLS] = 38; | ||
170 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89; | ||
171 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN_UPPER] = 89; | ||
172 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0; | ||
173 | |||
174 | |||
175 | // hair color | ||
176 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_WHITE_HAIR] = 0; | ||
177 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0; | ||
178 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BLONDE_HAIR] = 24; | ||
179 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0; | ||
180 | |||
181 | // hair style | ||
182 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_VOLUME] = 160; | ||
183 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153; | ||
184 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES] = 153; | ||
185 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170; | ||
186 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_FRONT] = 0; | ||
187 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117; | ||
188 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_BACK] = 170; | ||
189 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0; | ||
190 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDE_FRINGE] = 142; | ||
191 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0; | ||
192 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES_FULL] = 146; | ||
193 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0; | ||
194 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_FRONT] = 0; | ||
195 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0; | ||
196 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_FRONT] = 0; | ||
197 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0; | ||
198 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_RUMPLED] = 0; | ||
199 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0; | ||
200 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PONYTAIL] = 0; | ||
201 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0; | ||
202 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TILT] = 0; | ||
203 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0; | ||
204 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_RIGHT] = 0; | ||
205 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0; | ||
206 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BANGS_PART_MIDDLE] = 155; | ||
207 | |||
208 | //Eyebrows | ||
209 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20; | ||
210 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_DENSITY] = 140; | ||
211 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200; // eyebrow height | ||
212 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_ARCED_EYEBROWS] = 124; | ||
213 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65; | ||
214 | |||
215 | //Facial hair | ||
216 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_THICKNESS] = 65; | ||
217 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235; | ||
218 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_MOUSTACHE] = 75; | ||
219 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140; | ||
220 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SOULPATCH] = 0; | ||
221 | |||
222 | AvAppearance.VisualParams = VisualParams; | ||
223 | |||
224 | List<byte> wearbyte = new List<byte>(); | ||
225 | for (int i = 0; i < VisualParams.Length; i++) | ||
226 | { | ||
227 | wearbyte.Add(VisualParams[i]); | ||
228 | } | ||
229 | |||
230 | |||
231 | AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte); | ||
232 | } | ||
233 | |||
234 | /// <summary> | ||
235 | /// Test to ensure that the serialization format is the same and the underlying types don't change without notice | ||
236 | /// oldSerialization is just a json serialization of the OSDMap packed for the AgentCircuitData. | ||
237 | /// The idea is that if the current json serializer cannot parse the old serialization, then the underlying types | ||
238 | /// have changed and are incompatible. | ||
239 | /// </summary> | ||
240 | [Test] | ||
241 | public void HistoricalAgentCircuitDataOSDConversion() | ||
242 | { | ||
243 | string oldSerialization = "{\"agent_id\":\"522675bd-8214-40c1-b3ca-9c7f7fd170be\",\"base_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"caps_path\":\"http://www.opensimulator.org/Caps/Foo\",\"children_seeds\":[{\"handle\":\"18446744073709551615\",\"seed\":\"http://www.opensimulator.org/Caps/Foo2\"}],\"child\":false,\"circuit_code\":\"949030\",\"first_name\":\"CoolAvatarTest\",\"last_name\":\"test\",\"inventory_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"secure_session_id\":\"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a\",\"session_id\":\"aa06f798-9d70-4bdb-9bbf-012a02ee2baf\",\"start_pos\":\"<5, 23, 125>\"}"; | ||
244 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
245 | Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be"); | ||
246 | Agent1Data.Appearance = AvAppearance; | ||
247 | Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
248 | Agent1Data.CapsPath = CapsPath; | ||
249 | Agent1Data.child = false; | ||
250 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
251 | Agent1Data.circuitcode = circuitcode; | ||
252 | Agent1Data.firstname = firstname; | ||
253 | Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
254 | Agent1Data.lastname = lastname; | ||
255 | Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a"); | ||
256 | Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf"); | ||
257 | Agent1Data.startpos = StartPos; | ||
258 | |||
259 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(oldSerialization); | ||
260 | |||
261 | |||
262 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
263 | Agent2Data.UnpackAgentCircuitData(map2); | ||
264 | |||
265 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
266 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
267 | |||
268 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
269 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
270 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
271 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
272 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
273 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
274 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
275 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
276 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
277 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
278 | /* | ||
279 | Enable this once VisualParams go in the packing method | ||
280 | for (int i=0;i<208;i++) | ||
281 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
282 | */ | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// Test to ensure that the packing and unpacking methods work. | ||
287 | /// </summary> | ||
288 | [Test] | ||
289 | public void TestAgentCircuitDataOSDConversion() | ||
290 | { | ||
291 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
292 | Agent1Data.AgentID = AgentId; | ||
293 | Agent1Data.Appearance = AvAppearance; | ||
294 | Agent1Data.BaseFolder = BaseFolder; | ||
295 | Agent1Data.CapsPath = CapsPath; | ||
296 | Agent1Data.child = false; | ||
297 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
298 | Agent1Data.circuitcode = circuitcode; | ||
299 | Agent1Data.firstname = firstname; | ||
300 | Agent1Data.InventoryFolder = BaseFolder; | ||
301 | Agent1Data.lastname = lastname; | ||
302 | Agent1Data.SecureSessionID = SecureSessionId; | ||
303 | Agent1Data.SessionID = SessionId; | ||
304 | Agent1Data.startpos = StartPos; | ||
305 | |||
306 | |||
307 | OSDMap map = Agent1Data.PackAgentCircuitData(); | ||
308 | string str = OSDParser.SerializeJsonString(map); | ||
309 | //System.Console.WriteLine(str); | ||
310 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(str); | ||
311 | |||
312 | |||
313 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
314 | Agent2Data.UnpackAgentCircuitData(map2); | ||
315 | |||
316 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
317 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
318 | |||
319 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
320 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
321 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
322 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
323 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
324 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
325 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
326 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
327 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
328 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
329 | |||
330 | /* | ||
331 | Enable this once VisualParams go in the packing method | ||
332 | for (int i = 0; i < 208; i++) | ||
333 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
334 | */ | ||
335 | |||
336 | |||
337 | } | ||
338 | } | ||
339 | } | ||
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs new file mode 100644 index 0000000..ab5f04a --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | |||
@@ -0,0 +1,201 @@ | |||
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 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | ||
29 | using NUnit.Framework; | ||
30 | using System; | ||
31 | |||
32 | namespace OpenSim.Framework.Tests | ||
33 | { | ||
34 | [TestFixture] | ||
35 | public class AgentCircuitManagerTests | ||
36 | { | ||
37 | private AgentCircuitData m_agentCircuitData1; | ||
38 | private AgentCircuitData m_agentCircuitData2; | ||
39 | private UUID AgentId1; | ||
40 | private UUID AgentId2; | ||
41 | private uint circuitcode1; | ||
42 | private uint circuitcode2; | ||
43 | |||
44 | private UUID SessionId1; | ||
45 | private UUID SessionId2; | ||
46 | private Random rnd = new Random(Environment.TickCount); | ||
47 | |||
48 | [SetUp] | ||
49 | public void setup() | ||
50 | { | ||
51 | |||
52 | AgentId1 = UUID.Random(); | ||
53 | AgentId2 = UUID.Random(); | ||
54 | circuitcode1 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); | ||
55 | circuitcode2 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); | ||
56 | SessionId1 = UUID.Random(); | ||
57 | SessionId2 = UUID.Random(); | ||
58 | UUID BaseFolder = UUID.Random(); | ||
59 | string CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
60 | Dictionary<ulong,string> ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
61 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
62 | string firstname = "CoolAvatarTest"; | ||
63 | string lastname = "test"; | ||
64 | Vector3 StartPos = new Vector3(5, 23, 125); | ||
65 | |||
66 | UUID SecureSessionId = UUID.Random(); | ||
67 | UUID SessionId = UUID.Random(); | ||
68 | |||
69 | m_agentCircuitData1 = new AgentCircuitData(); | ||
70 | m_agentCircuitData1.AgentID = AgentId1; | ||
71 | m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1); | ||
72 | m_agentCircuitData1.BaseFolder = BaseFolder; | ||
73 | m_agentCircuitData1.CapsPath = CapsPath; | ||
74 | m_agentCircuitData1.child = false; | ||
75 | m_agentCircuitData1.ChildrenCapSeeds = ChildrenCapsPaths; | ||
76 | m_agentCircuitData1.circuitcode = circuitcode1; | ||
77 | m_agentCircuitData1.firstname = firstname; | ||
78 | m_agentCircuitData1.InventoryFolder = BaseFolder; | ||
79 | m_agentCircuitData1.lastname = lastname; | ||
80 | m_agentCircuitData1.SecureSessionID = SecureSessionId; | ||
81 | m_agentCircuitData1.SessionID = SessionId1; | ||
82 | m_agentCircuitData1.startpos = StartPos; | ||
83 | |||
84 | m_agentCircuitData2 = new AgentCircuitData(); | ||
85 | m_agentCircuitData2.AgentID = AgentId2; | ||
86 | m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2); | ||
87 | m_agentCircuitData2.BaseFolder = BaseFolder; | ||
88 | m_agentCircuitData2.CapsPath = CapsPath; | ||
89 | m_agentCircuitData2.child = false; | ||
90 | m_agentCircuitData2.ChildrenCapSeeds = ChildrenCapsPaths; | ||
91 | m_agentCircuitData2.circuitcode = circuitcode2; | ||
92 | m_agentCircuitData2.firstname = firstname; | ||
93 | m_agentCircuitData2.InventoryFolder = BaseFolder; | ||
94 | m_agentCircuitData2.lastname = lastname; | ||
95 | m_agentCircuitData2.SecureSessionID = SecureSessionId; | ||
96 | m_agentCircuitData2.SessionID = SessionId2; | ||
97 | m_agentCircuitData2.startpos = StartPos; | ||
98 | } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Validate that adding the circuit works appropriately | ||
102 | /// </summary> | ||
103 | [Test] | ||
104 | public void AddAgentCircuitTest() | ||
105 | { | ||
106 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
107 | agentCircuitManager.AddNewCircuit(circuitcode1,m_agentCircuitData1); | ||
108 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
109 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode1); | ||
110 | |||
111 | Assert.That((m_agentCircuitData1.AgentID == agent.AgentID)); | ||
112 | Assert.That((m_agentCircuitData1.BaseFolder == agent.BaseFolder)); | ||
113 | |||
114 | Assert.That((m_agentCircuitData1.CapsPath == agent.CapsPath)); | ||
115 | Assert.That((m_agentCircuitData1.child == agent.child)); | ||
116 | Assert.That((m_agentCircuitData1.ChildrenCapSeeds.Count == agent.ChildrenCapSeeds.Count)); | ||
117 | Assert.That((m_agentCircuitData1.circuitcode == agent.circuitcode)); | ||
118 | Assert.That((m_agentCircuitData1.firstname == agent.firstname)); | ||
119 | Assert.That((m_agentCircuitData1.InventoryFolder == agent.InventoryFolder)); | ||
120 | Assert.That((m_agentCircuitData1.lastname == agent.lastname)); | ||
121 | Assert.That((m_agentCircuitData1.SecureSessionID == agent.SecureSessionID)); | ||
122 | Assert.That((m_agentCircuitData1.SessionID == agent.SessionID)); | ||
123 | Assert.That((m_agentCircuitData1.startpos == agent.startpos)); | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Validate that removing the circuit code removes it appropriately | ||
128 | /// </summary> | ||
129 | [Test] | ||
130 | public void RemoveAgentCircuitTest() | ||
131 | { | ||
132 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
133 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
134 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
135 | agentCircuitManager.RemoveCircuit(circuitcode2); | ||
136 | |||
137 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode2); | ||
138 | Assert.That(agent == null); | ||
139 | |||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Validate that changing the circuit code works | ||
144 | /// </summary> | ||
145 | [Test] | ||
146 | public void ChangeAgentCircuitCodeTest() | ||
147 | { | ||
148 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
149 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
150 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
151 | bool result = false; | ||
152 | |||
153 | result = agentCircuitManager.TryChangeCiruitCode(circuitcode1, 393930); | ||
154 | |||
155 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(393930); | ||
156 | AgentCircuitData agent2 = agentCircuitManager.GetAgentCircuitData(circuitcode1); | ||
157 | Assert.That(agent != null); | ||
158 | Assert.That(agent2 == null); | ||
159 | Assert.That(result); | ||
160 | |||
161 | } | ||
162 | |||
163 | /// <summary> | ||
164 | /// Validates that the login authentication scheme is working | ||
165 | /// First one should be authorized | ||
166 | /// Rest should not be authorized | ||
167 | /// </summary> | ||
168 | [Test] | ||
169 | public void ValidateLoginTest() | ||
170 | { | ||
171 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
172 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
173 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
174 | |||
175 | // should be authorized | ||
176 | AuthenticateResponse resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode1); | ||
177 | Assert.That(resp.Authorised); | ||
178 | |||
179 | |||
180 | //should not be authorized | ||
181 | resp = agentCircuitManager.AuthenticateSession(SessionId1, UUID.Random(), circuitcode1); | ||
182 | Assert.That(!resp.Authorised); | ||
183 | |||
184 | resp = agentCircuitManager.AuthenticateSession(UUID.Random(), AgentId1, circuitcode1); | ||
185 | Assert.That(!resp.Authorised); | ||
186 | |||
187 | resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode2); | ||
188 | Assert.That(!resp.Authorised); | ||
189 | |||
190 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId1, circuitcode2); | ||
191 | Assert.That(!resp.Authorised); | ||
192 | |||
193 | agentCircuitManager.RemoveCircuit(circuitcode2); | ||
194 | |||
195 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); | ||
196 | Assert.That(!resp.Authorised); | ||
197 | |||
198 | } | ||
199 | |||
200 | } | ||
201 | } | ||
diff --git a/OpenSim/Framework/Tests/ThreadTrackerTests.cs b/OpenSim/Framework/Tests/ThreadTrackerTests.cs new file mode 100644 index 0000000..37c75ef --- /dev/null +++ b/OpenSim/Framework/Tests/ThreadTrackerTests.cs | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using NUnit.Framework; | ||
30 | using System.Threading; | ||
31 | using System.Collections.Generic; | ||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class ThreadTrackerTests | ||
37 | { | ||
38 | private bool running = true; | ||
39 | private bool running2 = true; | ||
40 | |||
41 | [Test] | ||
42 | public void DefaultThreadTrackerTest() | ||
43 | { | ||
44 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
45 | |||
46 | /* | ||
47 | foreach (Thread t in lThread) | ||
48 | { | ||
49 | System.Console.WriteLine(t.Name); | ||
50 | } | ||
51 | */ | ||
52 | |||
53 | Assert.That(lThread.Count == 1); | ||
54 | Assert.That(lThread[0].Name == "ThreadTrackerThread"); | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// Validate that adding a thread to the thread tracker works | ||
59 | /// Validate that removing a thread from the thread tracker also works. | ||
60 | /// </summary> | ||
61 | [Test] | ||
62 | public void AddThreadToThreadTrackerTestAndRemoveTest() | ||
63 | { | ||
64 | Thread t = new Thread(run); | ||
65 | t.Name = "TestThread"; | ||
66 | t.Priority = ThreadPriority.BelowNormal; | ||
67 | t.IsBackground = true; | ||
68 | t.SetApartmentState(ApartmentState.MTA); | ||
69 | t.Start(); | ||
70 | ThreadTracker.Add(t); | ||
71 | |||
72 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
73 | |||
74 | Assert.That(lThread.Count == 2); | ||
75 | |||
76 | foreach (Thread tr in lThread) | ||
77 | { | ||
78 | Assert.That((tr.Name == "ThreadTrackerThread" || tr.Name == "TestThread")); | ||
79 | } | ||
80 | running = false; | ||
81 | ThreadTracker.Remove(t); | ||
82 | |||
83 | lThread = ThreadTracker.GetThreads(); | ||
84 | |||
85 | Assert.That(lThread.Count == 1); | ||
86 | |||
87 | foreach (Thread tr in lThread) | ||
88 | { | ||
89 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
90 | } | ||
91 | |||
92 | |||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Test a dead thread removal by aborting it and setting it's last seen active date to 50 seconds | ||
97 | /// </summary> | ||
98 | [Test] | ||
99 | public void DeadThreadTest() | ||
100 | { | ||
101 | Thread t = new Thread(run2); | ||
102 | t.Name = "TestThread"; | ||
103 | t.Priority = ThreadPriority.BelowNormal; | ||
104 | t.IsBackground = true; | ||
105 | t.SetApartmentState(ApartmentState.MTA); | ||
106 | t.Start(); | ||
107 | ThreadTracker.Add(t); | ||
108 | t.Abort(); | ||
109 | Thread.Sleep(5000); | ||
110 | ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50*10000000); | ||
111 | ThreadTracker.CleanUp(); | ||
112 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
113 | |||
114 | Assert.That(lThread.Count == 1); | ||
115 | |||
116 | foreach (Thread tr in lThread) | ||
117 | { | ||
118 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | [Test] | ||
123 | public void UnstartedThreadTest() | ||
124 | { | ||
125 | Thread t = new Thread(run2); | ||
126 | t.Name = "TestThread"; | ||
127 | t.Priority = ThreadPriority.BelowNormal; | ||
128 | t.IsBackground = true; | ||
129 | t.SetApartmentState(ApartmentState.MTA); | ||
130 | ThreadTracker.Add(t); | ||
131 | ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50 * 10000000); | ||
132 | ThreadTracker.CleanUp(); | ||
133 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
134 | |||
135 | Assert.That(lThread.Count == 1); | ||
136 | |||
137 | foreach (Thread tr in lThread) | ||
138 | { | ||
139 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | [Test] | ||
144 | public void NullThreadTest() | ||
145 | { | ||
146 | Thread t = null; | ||
147 | ThreadTracker.Add(t); | ||
148 | |||
149 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
150 | |||
151 | Assert.That(lThread.Count == 1); | ||
152 | |||
153 | foreach (Thread tr in lThread) | ||
154 | { | ||
155 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
156 | } | ||
157 | } | ||
158 | |||
159 | |||
160 | /// <summary> | ||
161 | /// Worker thread 0 | ||
162 | /// </summary> | ||
163 | /// <param name="o"></param> | ||
164 | public void run( object o) | ||
165 | { | ||
166 | while (running) | ||
167 | { | ||
168 | Thread.Sleep(5000); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /// <summary> | ||
173 | /// Worker thread 1 | ||
174 | /// </summary> | ||
175 | /// <param name="o"></param> | ||
176 | public void run2(object o) | ||
177 | { | ||
178 | try | ||
179 | { | ||
180 | while (running2) | ||
181 | { | ||
182 | Thread.Sleep(5000); | ||
183 | } | ||
184 | |||
185 | } | ||
186 | catch (ThreadAbortException) | ||
187 | { | ||
188 | } | ||
189 | } | ||
190 | |||
191 | } | ||
192 | } | ||
diff --git a/OpenSim/Framework/ThreadTracker.cs b/OpenSim/Framework/ThreadTracker.cs index d8bd2c0..fa6f0b8 100644 --- a/OpenSim/Framework/ThreadTracker.cs +++ b/OpenSim/Framework/ThreadTracker.cs | |||
@@ -77,12 +77,15 @@ namespace OpenSim.Framework | |||
77 | public static void Add(Thread thread) | 77 | public static void Add(Thread thread) |
78 | { | 78 | { |
79 | #if DEBUG | 79 | #if DEBUG |
80 | lock (m_Threads) | 80 | if (thread != null) |
81 | { | 81 | { |
82 | ThreadTrackerItem tti = new ThreadTrackerItem(); | 82 | lock (m_Threads) |
83 | tti.Thread = thread; | 83 | { |
84 | tti.LastSeenActive = DateTime.Now.Ticks; | 84 | ThreadTrackerItem tti = new ThreadTrackerItem(); |
85 | m_Threads.Add(tti); | 85 | tti.Thread = thread; |
86 | tti.LastSeenActive = DateTime.Now.Ticks; | ||
87 | m_Threads.Add(tti); | ||
88 | } | ||
86 | } | 89 | } |
87 | #endif | 90 | #endif |
88 | } | 91 | } |
@@ -107,16 +110,25 @@ namespace OpenSim.Framework | |||
107 | { | 110 | { |
108 | foreach (ThreadTrackerItem tti in new ArrayList(m_Threads)) | 111 | foreach (ThreadTrackerItem tti in new ArrayList(m_Threads)) |
109 | { | 112 | { |
110 | if (tti.Thread.IsAlive) | 113 | try |
111 | { | 114 | { |
112 | // Its active | 115 | |
113 | tti.LastSeenActive = DateTime.Now.Ticks; | 116 | |
117 | if (tti.Thread.IsAlive) | ||
118 | { | ||
119 | // Its active | ||
120 | tti.LastSeenActive = DateTime.Now.Ticks; | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | // Its not active -- if its expired then remove it | ||
125 | if (tti.LastSeenActive + ThreadTimeout < DateTime.Now.Ticks) | ||
126 | m_Threads.Remove(tti); | ||
127 | } | ||
114 | } | 128 | } |
115 | else | 129 | catch (NullReferenceException) |
116 | { | 130 | { |
117 | // Its not active -- if its expired then remove it | 131 | m_Threads.Remove(tti); |
118 | if (tti.LastSeenActive + ThreadTimeout < DateTime.Now.Ticks) | ||
119 | m_Threads.Remove(tti); | ||
120 | } | 132 | } |
121 | } | 133 | } |
122 | } | 134 | } |