diff options
Diffstat (limited to 'OpenSim')
38 files changed, 694 insertions, 673 deletions
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 26e844e..d79e4fa 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs | |||
@@ -286,7 +286,7 @@ namespace OpenSim.Groups | |||
286 | string requestingAgentID = request["RequestingAgentID"].ToString(); | 286 | string requestingAgentID = request["RequestingAgentID"].ToString(); |
287 | 287 | ||
288 | if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID)) | 288 | if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID)) |
289 | NullResult(result, string.Format("Insufficient permissions.", agentID)); | 289 | NullResult(result, string.Format("Insufficient permissions. {0}", agentID)); |
290 | else | 290 | else |
291 | result["RESULT"] = "true"; | 291 | result["RESULT"] = "true"; |
292 | } | 292 | } |
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index c74033e..9a0044e 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -193,7 +193,9 @@ namespace OpenSim.Data.MySQL | |||
193 | { | 193 | { |
194 | using (MySqlCommand cmd = new MySqlCommand()) | 194 | using (MySqlCommand cmd = new MySqlCommand()) |
195 | { | 195 | { |
196 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); | 196 | // cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); |
197 | |||
198 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1"); | ||
197 | 199 | ||
198 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); | 200 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); |
199 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); | 201 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); |
@@ -212,7 +214,10 @@ namespace OpenSim.Data.MySQL | |||
212 | { | 214 | { |
213 | cmd.Connection = dbcon; | 215 | cmd.Connection = dbcon; |
214 | 216 | ||
215 | cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); | 217 | // cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); |
218 | |||
219 | cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID"); | ||
220 | |||
216 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 221 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); |
217 | cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); | 222 | cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); |
218 | 223 | ||
diff --git a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs index a22b882..c34a8dc 100644 --- a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs | |||
@@ -174,7 +174,9 @@ namespace OpenSim.Data.PGSQL | |||
174 | { | 174 | { |
175 | using (NpgsqlCommand cmd = new NpgsqlCommand()) | 175 | using (NpgsqlCommand cmd = new NpgsqlCommand()) |
176 | { | 176 | { |
177 | cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm); | 177 | // cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm); |
178 | |||
179 | cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1"); | ||
178 | 180 | ||
179 | UUID princID = UUID.Zero; | 181 | UUID princID = UUID.Zero; |
180 | UUID.TryParse(principalID, out princID); | 182 | UUID.TryParse(principalID, out princID); |
@@ -194,11 +196,18 @@ namespace OpenSim.Data.PGSQL | |||
194 | { | 196 | { |
195 | using (NpgsqlCommand cmd = new NpgsqlCommand()) | 197 | using (NpgsqlCommand cmd = new NpgsqlCommand()) |
196 | { | 198 | { |
199 | /* | ||
197 | cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" | 200 | cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" |
198 | from inventoryitems | 201 | from inventoryitems |
199 | where ""avatarID"" = :PrincipalID | 202 | where ""avatarID"" = :PrincipalID |
200 | and ""assetID"" = :AssetID | 203 | and ""assetID"" = :AssetID |
201 | group by ""assetID"" ", m_Realm); | 204 | group by ""assetID"" ", m_Realm); |
205 | */ | ||
206 | cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" | ||
207 | from inventoryitems | ||
208 | where ""avatarID"" = :PrincipalID | ||
209 | and ""assetID"" = :AssetID | ||
210 | group by ""assetID"" "); | ||
202 | 211 | ||
203 | cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID)); | 212 | cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID)); |
204 | cmd.Parameters.Add(m_database.CreateParameter("AssetID", assetID)); | 213 | cmd.Parameters.Add(m_database.CreateParameter("AssetID", assetID)); |
diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs index 660bc32..eaa7902 100644 --- a/OpenSim/Framework/AgentUpdateArgs.cs +++ b/OpenSim/Framework/AgentUpdateArgs.cs | |||
@@ -81,6 +81,7 @@ namespace OpenSim.Framework | |||
81 | 81 | ||
82 | public Vector3 ClientAgentPosition; | 82 | public Vector3 ClientAgentPosition; |
83 | public bool UseClientAgentPosition; | 83 | public bool UseClientAgentPosition; |
84 | public bool NeedsCameraCollision; | ||
84 | 85 | ||
85 | public AgentUpdateArgs() | 86 | public AgentUpdateArgs() |
86 | { | 87 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs index eabacb4..bf559d3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs | |||
@@ -120,14 +120,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
120 | 120 | ||
121 | public virtual void RegisterCaps(UUID agentID, Caps caps) | 121 | public virtual void RegisterCaps(UUID agentID, Caps caps) |
122 | { | 122 | { |
123 | UUID capID = UUID.Random(); | ||
124 | |||
125 | if (m_URL == "localhost") | 123 | if (m_URL == "localhost") |
126 | { | 124 | { |
127 | m_log.DebugFormat("[GET_DISPLAY_NAMES]: /CAPS/agents/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | 125 | string capUrl = "/CAPS/" + UUID.Random() + "/"; |
126 | // m_log.DebugFormat("[GET_DISPLAY_NAMES]: {0} in region {1}", capUrl, m_scene.RegionInfo.RegionName); | ||
128 | caps.RegisterHandler( | 127 | caps.RegisterHandler( |
129 | "GetDisplayNames", | 128 | "GetDisplayNames", |
130 | new GetDisplayNamesHandler("/CAPS/agents" + capID + "/", m_UserManager, "GetDisplayNames", agentID.ToString())); | 129 | new GetDisplayNamesHandler(capUrl, m_UserManager, "GetDisplayNames", agentID.ToString())); |
131 | } | 130 | } |
132 | else | 131 | else |
133 | { | 132 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 276b367..46c6a19 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -2856,6 +2856,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2856 | 2856 | ||
2857 | public void SendSelectedPartsProprieties(List<ISceneEntity> parts) | 2857 | public void SendSelectedPartsProprieties(List<ISceneEntity> parts) |
2858 | { | 2858 | { |
2859 | /* not in use | ||
2859 | // udp part | 2860 | // udp part |
2860 | ObjectPropertiesPacket packet = | 2861 | ObjectPropertiesPacket packet = |
2861 | (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); | 2862 | (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); |
@@ -2893,6 +2894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2893 | llsdBody.Add("ObjectData", array); | 2894 | llsdBody.Add("ObjectData", array); |
2894 | 2895 | ||
2895 | eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); | 2896 | eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); |
2897 | */ | ||
2896 | } | 2898 | } |
2897 | 2899 | ||
2898 | 2900 | ||
@@ -4839,7 +4841,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4839 | 4841 | ||
4840 | OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = | 4842 | OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = |
4841 | new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); | 4843 | new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); |
4842 | 4844 | ||
4845 | List<SceneObjectPart> needPhysics = new List<SceneObjectPart>(); | ||
4846 | |||
4843 | EntityUpdate iupdate; | 4847 | EntityUpdate iupdate; |
4844 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 4848 | Int32 timeinqueue; // this is just debugging code & can be dropped later |
4845 | 4849 | ||
@@ -4867,6 +4871,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4867 | if (update.Entity is SceneObjectPart) | 4871 | if (update.Entity is SceneObjectPart) |
4868 | { | 4872 | { |
4869 | SceneObjectPart sop = (SceneObjectPart)update.Entity; | 4873 | SceneObjectPart sop = (SceneObjectPart)update.Entity; |
4874 | needPhysics.Add(sop); | ||
4870 | ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); | 4875 | ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); |
4871 | objectPropertiesBlocks.Value.Add(objPropDB); | 4876 | objectPropertiesBlocks.Value.Add(objPropDB); |
4872 | propertyUpdates.Value.Add(update); | 4877 | propertyUpdates.Value.Add(update); |
@@ -4932,7 +4937,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4932 | // fpcnt++; | 4937 | // fpcnt++; |
4933 | // fbcnt++; | 4938 | // fbcnt++; |
4934 | } | 4939 | } |
4935 | 4940 | } | |
4941 | |||
4942 | if(needPhysics.Count > 0) | ||
4943 | { | ||
4944 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
4945 | if(eq != null) | ||
4946 | { | ||
4947 | OSDArray array = new OSDArray(); | ||
4948 | foreach(SceneObjectPart sop in needPhysics) | ||
4949 | { | ||
4950 | OSDMap physinfo = new OSDMap(6); | ||
4951 | physinfo["LocalID"] = sop.LocalId; | ||
4952 | physinfo["Density"] = sop.Density; | ||
4953 | physinfo["Friction"] = sop.Friction; | ||
4954 | physinfo["GravityMultiplier"] = sop.GravityModifier; | ||
4955 | physinfo["Restitution"] = sop.Restitution; | ||
4956 | physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType; | ||
4957 | array.Add(physinfo); | ||
4958 | } | ||
4959 | |||
4960 | OSDMap llsdBody = new OSDMap(1); | ||
4961 | llsdBody.Add("ObjectData", array); | ||
4962 | |||
4963 | eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); | ||
4964 | } | ||
4936 | } | 4965 | } |
4937 | 4966 | ||
4938 | // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt); | 4967 | // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt); |
@@ -6234,7 +6263,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6234 | 6263 | ||
6235 | bool movement = CheckAgentMovementUpdateSignificance(x); | 6264 | bool movement = CheckAgentMovementUpdateSignificance(x); |
6236 | bool camera = CheckAgentCameraUpdateSignificance(x); | 6265 | bool camera = CheckAgentCameraUpdateSignificance(x); |
6237 | 6266 | ||
6238 | // Was there a significant movement/state change? | 6267 | // Was there a significant movement/state change? |
6239 | if (movement) | 6268 | if (movement) |
6240 | { | 6269 | { |
@@ -6245,6 +6274,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6245 | m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; | 6274 | m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; |
6246 | m_thisAgentUpdateArgs.State = x.State; | 6275 | m_thisAgentUpdateArgs.State = x.State; |
6247 | 6276 | ||
6277 | m_thisAgentUpdateArgs.NeedsCameraCollision = !camera; | ||
6278 | |||
6248 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | 6279 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; |
6249 | UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; | 6280 | UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; |
6250 | 6281 | ||
@@ -6253,7 +6284,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6253 | 6284 | ||
6254 | if (handlerAgentUpdate != null) | 6285 | if (handlerAgentUpdate != null) |
6255 | OnAgentUpdate(this, m_thisAgentUpdateArgs); | 6286 | OnAgentUpdate(this, m_thisAgentUpdateArgs); |
6256 | 6287 | ||
6257 | } | 6288 | } |
6258 | 6289 | ||
6259 | // Was there a significant camera(s) change? | 6290 | // Was there a significant camera(s) change? |
@@ -6264,6 +6295,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6264 | m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; | 6295 | m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; |
6265 | m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; | 6296 | m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; |
6266 | 6297 | ||
6298 | m_thisAgentUpdateArgs.NeedsCameraCollision = true; | ||
6299 | |||
6267 | UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; | 6300 | UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; |
6268 | 6301 | ||
6269 | if (handlerAgentCameraUpdate != null) | 6302 | if (handlerAgentCameraUpdate != null) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 246f003..d59b761 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
161 | /// <summary>Total byte count of unacked packets sent to this client</summary> | 161 | /// <summary>Total byte count of unacked packets sent to this client</summary> |
162 | public int UnackedBytes; | 162 | public int UnackedBytes; |
163 | 163 | ||
164 | private int m_packetsUnAckReported; | ||
164 | /// <summary>Total number of received packets that we have reported to the OnPacketStats event(s)</summary> | 165 | /// <summary>Total number of received packets that we have reported to the OnPacketStats event(s)</summary> |
165 | private int m_packetsReceivedReported; | 166 | private int m_packetsReceivedReported; |
166 | /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary> | 167 | /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary> |
@@ -389,11 +390,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
389 | { | 390 | { |
390 | int newPacketsReceived = PacketsReceived - m_packetsReceivedReported; | 391 | int newPacketsReceived = PacketsReceived - m_packetsReceivedReported; |
391 | int newPacketsSent = PacketsSent - m_packetsSentReported; | 392 | int newPacketsSent = PacketsSent - m_packetsSentReported; |
392 | 393 | int newPacketUnAck = UnackedBytes - m_packetsUnAckReported; | |
393 | callback(newPacketsReceived, newPacketsSent, UnackedBytes); | 394 | callback(newPacketsReceived, newPacketsSent, UnackedBytes); |
394 | 395 | ||
395 | m_packetsReceivedReported += newPacketsReceived; | 396 | m_packetsReceivedReported += newPacketsReceived; |
396 | m_packetsSentReported += newPacketsSent; | 397 | m_packetsSentReported += newPacketsSent; |
398 | m_packetsUnAckReported += newPacketUnAck; | ||
397 | } | 399 | } |
398 | } | 400 | } |
399 | 401 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 0e67095..ffdb639 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -323,7 +323,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
323 | protected int m_elapsedMSSinceLastStatReport = 0; | 323 | protected int m_elapsedMSSinceLastStatReport = 0; |
324 | 324 | ||
325 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> | 325 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> |
326 | protected int m_tickLastOutgoingPacketHandler; | 326 | protected double m_tickLastOutgoingPacketHandler; |
327 | 327 | ||
328 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> | 328 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> |
329 | protected int m_elapsedMSOutgoingPacketHandler; | 329 | protected int m_elapsedMSOutgoingPacketHandler; |
@@ -356,20 +356,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | |||
360 | |||
361 | protected ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | 359 | protected ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); |
362 | 360 | ||
363 | /// <summary> | ||
364 | /// Event used to signal when queued packets are available for sending. | ||
365 | /// </summary> | ||
366 | /// <remarks> | ||
367 | /// This allows the outbound loop to only operate when there is data to send rather than continuously polling. | ||
368 | /// Some data is sent immediately and not queued. That data would not trigger this event. | ||
369 | /// WRONG use. May be usefull in future revision | ||
370 | /// </remarks> | ||
371 | // protected AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); | ||
372 | |||
373 | protected Pool<IncomingPacket> m_incomingPacketPool; | 361 | protected Pool<IncomingPacket> m_incomingPacketPool; |
374 | 362 | ||
375 | /// <summary> | 363 | /// <summary> |
@@ -456,10 +444,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
456 | int now = start; | 444 | int now = start; |
457 | while (now == start) | 445 | while (now == start) |
458 | now = Environment.TickCount; | 446 | now = Environment.TickCount; |
459 | TickCountResolution += (float)(now - start) * 0.1f; | 447 | TickCountResolution += (float)(now - start); |
448 | } | ||
449 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution * 0.1f + "ms"); | ||
450 | |||
451 | TickCountResolution = 0f; | ||
452 | for (int i = 0; i < 100; i++) | ||
453 | { | ||
454 | double start = Util.GetTimeStampMS(); | ||
455 | double now = start; | ||
456 | while (now == start) | ||
457 | now = Util.GetTimeStampMS(); | ||
458 | TickCountResolution += (float)((now - start)); | ||
460 | } | 459 | } |
461 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); | 460 | |
462 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | 461 | TickCountResolution = (float)Math.Round(TickCountResolution * 0.01f,6,MidpointRounding.AwayFromZero); |
462 | m_log.Info("[LLUDPSERVER]: Average Util.GetTimeStampMS resolution: " + TickCountResolution + "ms"); | ||
463 | 463 | ||
464 | #endregion Environment.TickCount Measurement | 464 | #endregion Environment.TickCount Measurement |
465 | 465 | ||
@@ -467,8 +467,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
467 | int sceneThrottleBps = 0; | 467 | int sceneThrottleBps = 0; |
468 | bool usePools = false; | 468 | bool usePools = false; |
469 | 469 | ||
470 | |||
471 | |||
472 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; | 470 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; |
473 | if (config != null) | 471 | if (config != null) |
474 | { | 472 | { |
@@ -927,10 +925,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
927 | } | 925 | } |
928 | 926 | ||
929 | PacketPool.Instance.ReturnPacket(packet); | 927 | PacketPool.Instance.ReturnPacket(packet); |
930 | |||
931 | /// WRONG use. May be usefull in future revision | ||
932 | // if (packetQueued) | ||
933 | // m_dataPresentEvent.Set(); | ||
934 | } | 928 | } |
935 | 929 | ||
936 | /// <summary> | 930 | /// <summary> |
@@ -2079,14 +2073,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2079 | m_sendPing = false; | 2073 | m_sendPing = false; |
2080 | 2074 | ||
2081 | // Update elapsed time | 2075 | // Update elapsed time |
2082 | int thisTick = Environment.TickCount & Int32.MaxValue; | 2076 | double thisTick = Util.GetTimeStampMS(); |
2083 | if (m_tickLastOutgoingPacketHandler > thisTick) | 2077 | int deltaMS = (int)(thisTick - m_tickLastOutgoingPacketHandler); |
2084 | m_elapsedMSOutgoingPacketHandler += ((Int32.MaxValue - m_tickLastOutgoingPacketHandler) + thisTick); | ||
2085 | else | ||
2086 | m_elapsedMSOutgoingPacketHandler += (thisTick - m_tickLastOutgoingPacketHandler); | ||
2087 | |||
2088 | m_tickLastOutgoingPacketHandler = thisTick; | 2078 | m_tickLastOutgoingPacketHandler = thisTick; |
2089 | 2079 | ||
2080 | // update some 1ms resolution chained timers | ||
2081 | |||
2082 | m_elapsedMSOutgoingPacketHandler += deltaMS; | ||
2083 | |||
2090 | // Check for pending outgoing resends every 100ms | 2084 | // Check for pending outgoing resends every 100ms |
2091 | if (m_elapsedMSOutgoingPacketHandler >= 100) | 2085 | if (m_elapsedMSOutgoingPacketHandler >= 100) |
2092 | { | 2086 | { |
@@ -2109,15 +2103,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2109 | m_sendPing = true; | 2103 | m_sendPing = true; |
2110 | m_elapsed500MSOutgoingPacketHandler = 0; | 2104 | m_elapsed500MSOutgoingPacketHandler = 0; |
2111 | } | 2105 | } |
2112 | |||
2113 | #endregion Update Timers | 2106 | #endregion Update Timers |
2114 | 2107 | ||
2115 | // Use this for emergency monitoring -- bug hunting | ||
2116 | //if (m_scene.EmergencyMonitoring) | ||
2117 | // clientPacketHandler = MonitoredClientOutgoingPacketHandler; | ||
2118 | //else | ||
2119 | // clientPacketHandler = ClientOutgoingPacketHandler; | ||
2120 | |||
2121 | // Handle outgoing packets, resends, acknowledgements, and pings for each | 2108 | // Handle outgoing packets, resends, acknowledgements, and pings for each |
2122 | // client. m_packetSent will be set to true if a packet is sent | 2109 | // client. m_packetSent will be set to true if a packet is sent |
2123 | Scene.ForEachClient(clientPacketHandler); | 2110 | Scene.ForEachClient(clientPacketHandler); |
@@ -2129,7 +2116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2129 | 2116 | ||
2130 | if(Scene.GetNumberOfClients() == 0) | 2117 | if(Scene.GetNumberOfClients() == 0) |
2131 | { | 2118 | { |
2132 | Thread.Sleep(250); // be friendly to PIs, but how long ?? | 2119 | Thread.Sleep(100); |
2133 | } | 2120 | } |
2134 | else if (!m_packetSent) | 2121 | else if (!m_packetSent) |
2135 | // Thread.Sleep((int)TickCountResolution); outch this is bad on linux | 2122 | // Thread.Sleep((int)TickCountResolution); outch this is bad on linux |
@@ -2204,99 +2191,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2204 | /// </summary> | 2191 | /// </summary> |
2205 | public long IncomingPacketsProcessed { get; protected set; } | 2192 | public long IncomingPacketsProcessed { get; protected set; } |
2206 | 2193 | ||
2207 | protected void MonitoredClientOutgoingPacketHandler(IClientAPI client) | ||
2208 | { | ||
2209 | nticks++; | ||
2210 | watch1.Start(); | ||
2211 | m_currentOutgoingClient = client; | ||
2212 | |||
2213 | try | ||
2214 | { | ||
2215 | if (client is LLClientView) | ||
2216 | { | ||
2217 | LLClientView llClient = (LLClientView)client; | ||
2218 | LLUDPClient udpClient = llClient.UDPClient; | ||
2219 | |||
2220 | if (udpClient.IsConnected) | ||
2221 | { | ||
2222 | if (m_resendUnacked) | ||
2223 | { | ||
2224 | nticksUnack++; | ||
2225 | watch2.Start(); | ||
2226 | |||
2227 | HandleUnacked(llClient); | ||
2228 | |||
2229 | watch2.Stop(); | ||
2230 | avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); | ||
2231 | watch2.Reset(); | ||
2232 | } | ||
2233 | |||
2234 | if (m_sendAcks) | ||
2235 | { | ||
2236 | nticksAck++; | ||
2237 | watch2.Start(); | ||
2238 | |||
2239 | SendAcks(udpClient); | ||
2240 | |||
2241 | watch2.Stop(); | ||
2242 | avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck); | ||
2243 | watch2.Reset(); | ||
2244 | } | ||
2245 | |||
2246 | if (m_sendPing) | ||
2247 | { | ||
2248 | nticksPing++; | ||
2249 | watch2.Start(); | ||
2250 | |||
2251 | SendPing(udpClient); | ||
2252 | |||
2253 | watch2.Stop(); | ||
2254 | avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing); | ||
2255 | watch2.Reset(); | ||
2256 | } | ||
2257 | |||
2258 | watch2.Start(); | ||
2259 | // Dequeue any outgoing packets that are within the throttle limits | ||
2260 | if (udpClient.DequeueOutgoing()) | ||
2261 | { | ||
2262 | m_packetSent = true; | ||
2263 | npacksSent++; | ||
2264 | } | ||
2265 | else | ||
2266 | { | ||
2267 | npackNotSent++; | ||
2268 | } | ||
2269 | |||
2270 | watch2.Stop(); | ||
2271 | avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); | ||
2272 | watch2.Reset(); | ||
2273 | |||
2274 | } | ||
2275 | else | ||
2276 | { | ||
2277 | m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); | ||
2278 | } | ||
2279 | } | ||
2280 | } | ||
2281 | catch (Exception ex) | ||
2282 | { | ||
2283 | m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name + | ||
2284 | " threw an exception: " + ex.Message, ex); | ||
2285 | } | ||
2286 | watch1.Stop(); | ||
2287 | avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks); | ||
2288 | watch1.Reset(); | ||
2289 | |||
2290 | // reuse this -- it's every ~100ms | ||
2291 | if (Scene.EmergencyMonitoring && nticks % 100 == 0) | ||
2292 | { | ||
2293 | m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})", | ||
2294 | avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent); | ||
2295 | npackNotSent = npacksSent = 0; | ||
2296 | } | ||
2297 | |||
2298 | } | ||
2299 | |||
2300 | #endregion | 2194 | #endregion |
2301 | 2195 | ||
2302 | protected void ProcessInPacket(IncomingPacket incomingPacket) | 2196 | protected void ProcessInPacket(IncomingPacket incomingPacket) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index a476b91..6278e36 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
@@ -92,8 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
92 | Asset = throttleConfig.GetInt("asset_default", 10500); | 92 | Asset = throttleConfig.GetInt("asset_default", 10500); |
93 | 93 | ||
94 | Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; | 94 | Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; |
95 | // 3000000 bps default max | 95 | // 5120000 bps default max |
96 | ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 375000); | 96 | ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 640000); |
97 | if (ClientMaxRate > 1000000) | 97 | if (ClientMaxRate > 1000000) |
98 | ClientMaxRate = 1000000; // no more than 8Mbps | 98 | ClientMaxRate = 1000000; // no more than 8Mbps |
99 | 99 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 0ac573a..7b9661b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
@@ -62,8 +62,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
62 | /// </summary> | 62 | /// </summary> |
63 | protected const float m_minimumDripRate = 1500; | 63 | protected const float m_minimumDripRate = 1500; |
64 | 64 | ||
65 | /// <summary>Time of the last drip, in system ticks</summary> | 65 | /// <summary>Time of the last drip</summary> |
66 | protected Int32 m_lastDrip; | 66 | protected double m_lastDrip; |
67 | 67 | ||
68 | /// <summary> | 68 | /// <summary> |
69 | /// The number of bytes that can be sent at this moment. This is the | 69 | /// The number of bytes that can be sent at this moment. This is the |
@@ -166,10 +166,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
166 | /// </summary> | 166 | /// </summary> |
167 | protected float m_totalDripRequest; | 167 | protected float m_totalDripRequest; |
168 | public float TotalDripRequest | 168 | public float TotalDripRequest |
169 | { | 169 | { |
170 | get { return m_totalDripRequest; } | 170 | get { return m_totalDripRequest; } |
171 | set { m_totalDripRequest = value; } | 171 | set { m_totalDripRequest = value; } |
172 | } | 172 | } |
173 | 173 | ||
174 | #endregion Properties | 174 | #endregion Properties |
175 | 175 | ||
@@ -193,9 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
193 | Parent = parent; | 193 | Parent = parent; |
194 | RequestedDripRate = dripRate; | 194 | RequestedDripRate = dripRate; |
195 | RequestedBurst = MaxBurst; | 195 | RequestedBurst = MaxBurst; |
196 | // TotalDripRequest = dripRate; // this will be overwritten when a child node registers | 196 | m_lastDrip = Util.GetTimeStampMS() + 50.0; |
197 | // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); | ||
198 | m_lastDrip = Util.EnvironmentTickCount() + 100000; | ||
199 | } | 197 | } |
200 | 198 | ||
201 | #endregion Constructor | 199 | #endregion Constructor |
@@ -210,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
210 | protected float DripRateModifier() | 208 | protected float DripRateModifier() |
211 | { | 209 | { |
212 | float driprate = DripRate; | 210 | float driprate = DripRate; |
213 | return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; | 211 | return driprate >= TotalDripRequest ? 1.0f : (driprate / TotalDripRequest); |
214 | } | 212 | } |
215 | 213 | ||
216 | /// <summary> | 214 | /// <summary> |
@@ -313,14 +311,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
313 | return; | 311 | return; |
314 | } | 312 | } |
315 | 313 | ||
316 | Int32 now = Util.EnvironmentTickCount(); | 314 | double now = Util.GetTimeStampMS(); |
317 | Int32 deltaMS = now - m_lastDrip; | 315 | double deltaMS = now - m_lastDrip; |
318 | m_lastDrip = now; | 316 | m_lastDrip = now; |
319 | 317 | ||
320 | if (deltaMS <= 0) | 318 | if (deltaMS <= 0) |
321 | return; | 319 | return; |
322 | 320 | ||
323 | m_tokenCount += deltaMS * DripRate * m_timeScale; | 321 | m_tokenCount += (float)deltaMS * DripRate * m_timeScale; |
324 | 322 | ||
325 | float burst = Burst; | 323 | float burst = Burst; |
326 | if (m_tokenCount > burst) | 324 | if (m_tokenCount > burst) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 2ba35df..7d54a00 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -45,10 +45,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
45 | private static readonly ILog m_log = LogManager.GetLogger( | 45 | private static readonly ILog m_log = LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | protected Timer m_logTimer = new Timer(10000); | ||
49 | protected List<GridInstantMessage> m_logData = new List<GridInstantMessage>(); | ||
50 | protected string m_restUrl; | ||
51 | |||
52 | /// <value> | 48 | /// <value> |
53 | /// Is this module enabled? | 49 | /// Is this module enabled? |
54 | /// </value> | 50 | /// </value> |
@@ -68,12 +64,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
68 | "InstantMessageModule", "InstantMessageModule") != | 64 | "InstantMessageModule", "InstantMessageModule") != |
69 | "InstantMessageModule") | 65 | "InstantMessageModule") |
70 | return; | 66 | return; |
71 | m_restUrl = config.Configs["Messaging"].GetString("LogURL", String.Empty); | ||
72 | } | 67 | } |
73 | 68 | ||
74 | m_enabled = true; | 69 | m_enabled = true; |
75 | m_logTimer.AutoReset = false; | ||
76 | m_logTimer.Elapsed += LogTimerElapsed; | ||
77 | } | 70 | } |
78 | 71 | ||
79 | public virtual void AddRegion(Scene scene) | 72 | public virtual void AddRegion(Scene scene) |
@@ -153,20 +146,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
153 | } | 146 | } |
154 | 147 | ||
155 | #endregion | 148 | #endregion |
156 | 149 | /* | |
157 | public virtual void OnViewerInstantMessage(IClientAPI client, GridInstantMessage im) | 150 | public virtual void OnViewerInstantMessage(IClientAPI client, GridInstantMessage im) |
158 | { | 151 | { |
159 | im.fromAgentName = client.FirstName + " " + client.LastName; | 152 | im.fromAgentName = client.FirstName + " " + client.LastName; |
160 | OnInstantMessage(client, im); | 153 | OnInstantMessage(client, im); |
161 | } | 154 | } |
162 | 155 | */ | |
163 | public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 156 | public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
164 | { | 157 | { |
165 | byte dialog = im.dialog; | 158 | byte dialog = im.dialog; |
166 | 159 | ||
167 | if (client != null && dialog == (byte)InstantMessageDialog.MessageFromAgent) | ||
168 | LogInstantMesssage(im); | ||
169 | |||
170 | if (dialog != (byte)InstantMessageDialog.MessageFromAgent | 160 | if (dialog != (byte)InstantMessageDialog.MessageFromAgent |
171 | && dialog != (byte)InstantMessageDialog.StartTyping | 161 | && dialog != (byte)InstantMessageDialog.StartTyping |
172 | && dialog != (byte)InstantMessageDialog.StopTyping | 162 | && dialog != (byte)InstantMessageDialog.StopTyping |
@@ -243,35 +233,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
243 | // | 233 | // |
244 | OnInstantMessage(null, msg); | 234 | OnInstantMessage(null, msg); |
245 | } | 235 | } |
246 | |||
247 | protected virtual void LogInstantMesssage(GridInstantMessage im) | ||
248 | { | ||
249 | if (m_logData.Count < 20) | ||
250 | { | ||
251 | // Restart the log write timer | ||
252 | m_logTimer.Stop(); | ||
253 | } | ||
254 | if (!m_logTimer.Enabled) | ||
255 | m_logTimer.Start(); | ||
256 | |||
257 | lock (m_logData) | ||
258 | { | ||
259 | m_logData.Add(im); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | protected virtual void LogTimerElapsed(object source, ElapsedEventArgs e) | ||
264 | { | ||
265 | lock (m_logData) | ||
266 | { | ||
267 | if (m_restUrl != String.Empty && m_logData.Count > 0) | ||
268 | { | ||
269 | bool success = SynchronousRestObjectRequester.MakeRequest<List<GridInstantMessage>, bool>("POST", m_restUrl + "/LogMessages/", m_logData); | ||
270 | if (!success) | ||
271 | m_log.ErrorFormat("[INSTANT MESSAGE]: Failed to save log data"); | ||
272 | } | ||
273 | m_logData.Clear(); | ||
274 | } | ||
275 | } | ||
276 | } | 236 | } |
277 | } | 237 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 3127199..b72ffbb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -154,14 +154,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
154 | { | 154 | { |
155 | bool inCache = false; | 155 | bool inCache = false; |
156 | UserAccount account; | 156 | UserAccount account; |
157 | lock(m_Cache) | 157 | account = m_Cache.Get(userID, out inCache); |
158 | account = m_Cache.Get(userID, out inCache); | ||
159 | if (inCache) | 158 | if (inCache) |
160 | return account; | 159 | return account; |
161 | 160 | ||
162 | account = UserAccountService.GetUserAccount(scopeID, userID); | 161 | account = UserAccountService.GetUserAccount(scopeID, userID); |
163 | lock(m_Cache) | 162 | m_Cache.Cache(userID, account); |
164 | m_Cache.Cache(userID, account); | ||
165 | 163 | ||
166 | return account; | 164 | return account; |
167 | } | 165 | } |
@@ -170,15 +168,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
170 | { | 168 | { |
171 | bool inCache = false; | 169 | bool inCache = false; |
172 | UserAccount account; | 170 | UserAccount account; |
173 | lock(m_Cache) | 171 | account = m_Cache.Get(firstName + " " + lastName, out inCache); |
174 | account = m_Cache.Get(firstName + " " + lastName, out inCache); | ||
175 | if (inCache) | 172 | if (inCache) |
176 | return account; | 173 | return account; |
177 | 174 | ||
178 | account = UserAccountService.GetUserAccount(scopeID, firstName, lastName); | 175 | account = UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
179 | if (account != null) | 176 | if (account != null) |
180 | lock(m_Cache) | 177 | m_Cache.Cache(account.PrincipalID, account); |
181 | m_Cache.Cache(account.PrincipalID, account); | ||
182 | 178 | ||
183 | return account; | 179 | return account; |
184 | } | 180 | } |
@@ -201,8 +197,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
201 | { | 197 | { |
202 | if(UUID.TryParse(id, out uuid)) | 198 | if(UUID.TryParse(id, out uuid)) |
203 | { | 199 | { |
204 | lock(m_Cache) | 200 | account = m_Cache.Get(uuid, out inCache); |
205 | account = m_Cache.Get(uuid, out inCache); | ||
206 | if (inCache) | 201 | if (inCache) |
207 | ret.Add(account); | 202 | ret.Add(account); |
208 | else | 203 | else |
@@ -216,12 +211,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
216 | List<UserAccount> ext = UserAccountService.GetUserAccounts(scopeID, missing); | 211 | List<UserAccount> ext = UserAccountService.GetUserAccounts(scopeID, missing); |
217 | if(ext != null && ext.Count > 0) | 212 | if(ext != null && ext.Count > 0) |
218 | { | 213 | { |
219 | ret.AddRange(ext); | ||
220 | foreach(UserAccount acc in ext) | 214 | foreach(UserAccount acc in ext) |
221 | { | 215 | { |
222 | if(acc != null) | 216 | if(acc != null) |
223 | lock(m_Cache) | 217 | { |
224 | m_Cache.Cache(acc.PrincipalID, acc); | 218 | ret.Add(acc); |
219 | m_Cache.Cache(acc.PrincipalID, acc); | ||
220 | } | ||
225 | } | 221 | } |
226 | } | 222 | } |
227 | return ret; | 223 | return ret; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index eead05d..f5eda11 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -128,8 +128,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
128 | // flags, title, etc. And country, don't forget country! | 128 | // flags, title, etc. And country, don't forget country! |
129 | private void OnNewClient(IClientAPI client) | 129 | private void OnNewClient(IClientAPI client) |
130 | { | 130 | { |
131 | lock(m_Cache) | 131 | m_Cache.Remove(client.Name); |
132 | m_Cache.Remove(client.Name); | ||
133 | } | 132 | } |
134 | 133 | ||
135 | #region Overwritten methods from IUserAccountService | 134 | #region Overwritten methods from IUserAccountService |
@@ -138,15 +137,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
138 | { | 137 | { |
139 | bool inCache = false; | 138 | bool inCache = false; |
140 | UserAccount account; | 139 | UserAccount account; |
141 | lock(m_Cache) | 140 | account = m_Cache.Get(userID, out inCache); |
142 | account = m_Cache.Get(userID, out inCache); | ||
143 | if (inCache) | 141 | if (inCache) |
144 | return account; | 142 | return account; |
145 | 143 | ||
146 | account = base.GetUserAccount(scopeID, userID); | 144 | account = base.GetUserAccount(scopeID, userID); |
147 | lock(m_Cache) | 145 | m_Cache.Cache(userID, account); |
148 | if(account != null) | ||
149 | m_Cache.Cache(userID, account); | ||
150 | 146 | ||
151 | return account; | 147 | return account; |
152 | } | 148 | } |
@@ -155,15 +151,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
155 | { | 151 | { |
156 | bool inCache = false; | 152 | bool inCache = false; |
157 | UserAccount account; | 153 | UserAccount account; |
158 | lock(m_Cache) | 154 | account = m_Cache.Get(firstName + " " + lastName, out inCache); |
159 | account = m_Cache.Get(firstName + " " + lastName, out inCache); | ||
160 | if (inCache) | 155 | if (inCache) |
161 | return account; | 156 | return account; |
162 | 157 | ||
163 | account = base.GetUserAccount(scopeID, firstName, lastName); | 158 | account = base.GetUserAccount(scopeID, firstName, lastName); |
164 | if (account != null) | 159 | if (account != null) |
165 | lock(m_Cache) | 160 | m_Cache.Cache(account.PrincipalID, account); |
166 | m_Cache.Cache(account.PrincipalID, account); | ||
167 | 161 | ||
168 | return account; | 162 | return account; |
169 | } | 163 | } |
@@ -181,8 +175,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
181 | { | 175 | { |
182 | if(UUID.TryParse(id, out uuid)) | 176 | if(UUID.TryParse(id, out uuid)) |
183 | { | 177 | { |
184 | lock(m_Cache) | 178 | account = m_Cache.Get(uuid, out inCache); |
185 | account = m_Cache.Get(uuid, out inCache); | ||
186 | if (inCache) | 179 | if (inCache) |
187 | accs.Add(account); | 180 | accs.Add(account); |
188 | else | 181 | else |
@@ -195,16 +188,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
195 | List<UserAccount> ext = base.GetUserAccounts(scopeID, missing); | 188 | List<UserAccount> ext = base.GetUserAccounts(scopeID, missing); |
196 | if(ext != null && ext.Count >0 ) | 189 | if(ext != null && ext.Count >0 ) |
197 | { | 190 | { |
198 | accs.AddRange(ext); | ||
199 | foreach(UserAccount acc in ext) | 191 | foreach(UserAccount acc in ext) |
200 | { | 192 | { |
201 | if(acc != null) | 193 | if(acc != null) |
202 | lock(m_Cache) | 194 | { |
203 | m_Cache.Cache(acc.PrincipalID, acc); | 195 | accs.Add(acc); |
196 | m_Cache.Cache(acc.PrincipalID, acc); | ||
197 | } | ||
204 | } | 198 | } |
205 | } | 199 | } |
206 | } | 200 | } |
207 | |||
208 | return accs; | 201 | return accs; |
209 | } | 202 | } |
210 | 203 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index 53610d9..6c1cc52 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -36,7 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
36 | { | 36 | { |
37 | public class UserAccountCache : IUserAccountCacheModule | 37 | public class UserAccountCache : IUserAccountCacheModule |
38 | { | 38 | { |
39 | private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! | 39 | private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour! |
40 | private const double CACHE_NULL_EXPIRATION_SECONDS = 600; // 10minutes | ||
40 | 41 | ||
41 | // private static readonly ILog m_log = | 42 | // private static readonly ILog m_log = |
42 | // LogManager.GetLogger( | 43 | // LogManager.GetLogger( |
@@ -44,6 +45,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
44 | 45 | ||
45 | private ExpiringCache<UUID, UserAccount> m_UUIDCache; | 46 | private ExpiringCache<UUID, UserAccount> m_UUIDCache; |
46 | private ExpiringCache<string, UUID> m_NameCache; | 47 | private ExpiringCache<string, UUID> m_NameCache; |
48 | private object accessLock = new object(); | ||
47 | 49 | ||
48 | public UserAccountCache() | 50 | public UserAccountCache() |
49 | { | 51 | { |
@@ -54,60 +56,77 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
54 | public void Cache(UUID userID, UserAccount account) | 56 | public void Cache(UUID userID, UserAccount account) |
55 | { | 57 | { |
56 | // Cache even null accounts | 58 | // Cache even null accounts |
57 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); | 59 | lock(accessLock) |
58 | if (account != null) | 60 | { |
59 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); | 61 | if (account == null) |
62 | m_UUIDCache.AddOrUpdate(userID, null, CACHE_NULL_EXPIRATION_SECONDS); | ||
63 | else | ||
64 | { | ||
65 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); | ||
66 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); | ||
67 | } | ||
60 | 68 | ||
61 | //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); | 69 | //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); |
70 | } | ||
62 | } | 71 | } |
63 | 72 | ||
64 | public void Invalidate(UUID userID) | 73 | public void Invalidate(UUID userID) |
65 | { | 74 | { |
66 | m_UUIDCache.Remove(userID); | 75 | lock(accessLock) |
76 | m_UUIDCache.Remove(userID); | ||
67 | } | 77 | } |
68 | 78 | ||
69 | public UserAccount Get(UUID userID, out bool inCache) | 79 | public UserAccount Get(UUID userID, out bool inCache) |
70 | { | 80 | { |
71 | UserAccount account = null; | 81 | UserAccount account = null; |
72 | inCache = false; | 82 | inCache = false; |
73 | if (m_UUIDCache.TryGetValue(userID, out account)) | 83 | lock(accessLock) |
74 | { | 84 | { |
75 | //m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName); | 85 | if (m_UUIDCache.TryGetValue(userID, out account)) |
76 | inCache = true; | 86 | { |
77 | return account; | 87 | //m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName); |
88 | inCache = true; | ||
89 | return account; | ||
90 | } | ||
78 | } | 91 | } |
79 | |||
80 | return null; | 92 | return null; |
81 | } | 93 | } |
82 | 94 | ||
83 | public UserAccount Get(string name, out bool inCache) | 95 | public UserAccount Get(string name, out bool inCache) |
84 | { | 96 | { |
85 | inCache = false; | 97 | inCache = false; |
86 | if (!m_NameCache.Contains(name)) | 98 | lock(accessLock) |
87 | return null; | 99 | { |
100 | if (!m_NameCache.Contains(name)) | ||
101 | return null; | ||
88 | 102 | ||
89 | UserAccount account = null; | 103 | UserAccount account = null; |
90 | UUID uuid = UUID.Zero; | 104 | UUID uuid = UUID.Zero; |
91 | if (m_NameCache.TryGetValue(name, out uuid)) | 105 | if (m_NameCache.TryGetValue(name, out uuid)) |
92 | if (m_UUIDCache.TryGetValue(uuid, out account)) | ||
93 | { | 106 | { |
94 | inCache = true; | 107 | if (m_UUIDCache.TryGetValue(uuid, out account)) |
95 | return account; | 108 | { |
109 | inCache = true; | ||
110 | return account; | ||
111 | } | ||
96 | } | 112 | } |
97 | 113 | } | |
98 | return null; | 114 | return null; |
99 | } | 115 | } |
100 | 116 | ||
101 | public void Remove(string name) | 117 | public void Remove(string name) |
102 | { | 118 | { |
103 | if (!m_NameCache.Contains(name)) | 119 | lock(accessLock) |
104 | return; | ||
105 | |||
106 | UUID uuid = UUID.Zero; | ||
107 | if (m_NameCache.TryGetValue(name, out uuid)) | ||
108 | { | 120 | { |
109 | m_NameCache.Remove(name); | 121 | if (!m_NameCache.Contains(name)) |
110 | m_UUIDCache.Remove(uuid); | 122 | return; |
123 | |||
124 | UUID uuid = UUID.Zero; | ||
125 | if (m_NameCache.TryGetValue(name, out uuid)) | ||
126 | { | ||
127 | m_NameCache.Remove(name); | ||
128 | m_UUIDCache.Remove(uuid); | ||
129 | } | ||
111 | } | 130 | } |
112 | } | 131 | } |
113 | } | 132 | } |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index e65f860..688648b 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -920,7 +920,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
920 | return false; | 920 | return false; |
921 | } | 921 | } |
922 | 922 | ||
923 | string rawConsoleEndVector = rawComponents.Skip(2).Take(1).Single(); | 923 | string rawConsoleEndVector = rawComponents.Skip(1).Take(1).Single(); |
924 | 924 | ||
925 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | 925 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) |
926 | { | 926 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index a5abe76..24a2db7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -166,8 +166,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | /// <param name="remoteClient"></param> | 166 | /// <param name="remoteClient"></param> |
167 | public void SelectPrim(List<uint> primIDs, IClientAPI remoteClient) | 167 | public void SelectPrim(List<uint> primIDs, IClientAPI remoteClient) |
168 | { | 168 | { |
169 | List<ISceneEntity> needUpdates = new List<ISceneEntity>(); | ||
170 | |||
171 | foreach(uint primLocalID in primIDs) | 169 | foreach(uint primLocalID in primIDs) |
172 | { | 170 | { |
173 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 171 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
@@ -179,8 +177,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | if (sog == null) | 177 | if (sog == null) |
180 | continue; | 178 | continue; |
181 | 179 | ||
182 | needUpdates.Add((ISceneEntity)part); | ||
183 | |||
184 | // waste of time because properties do not send prim flags as they should | 180 | // waste of time because properties do not send prim flags as they should |
185 | // if a friend got or lost edit rights after login, a full update is needed | 181 | // if a friend got or lost edit rights after login, a full update is needed |
186 | if(sog.OwnerID != remoteClient.AgentId) | 182 | if(sog.OwnerID != remoteClient.AgentId) |
@@ -193,10 +189,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
193 | part.IsSelected = true; | 189 | part.IsSelected = true; |
194 | EventManager.TriggerParcelPrimCountTainted(); | 190 | EventManager.TriggerParcelPrimCountTainted(); |
195 | } | 191 | } |
196 | } | ||
197 | 192 | ||
198 | if(needUpdates.Count > 0) | 193 | part.SendPropertiesToClient(remoteClient); |
199 | remoteClient.SendSelectedPartsProprieties(needUpdates); | 194 | } |
200 | } | 195 | } |
201 | 196 | ||
202 | /// <summary> | 197 | /// <summary> |
@@ -248,38 +243,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
248 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 243 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
249 | if (part == null) | 244 | if (part == null) |
250 | return; | 245 | return; |
251 | /* | 246 | |
252 | // A deselect packet contains all the local prims being deselected. However, since selection is still | ||
253 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims | ||
254 | // we end up sending many duplicate ObjectUpdates | ||
255 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) | ||
256 | return; | ||
257 | |||
258 | // This is wrong, wrong, wrong. Selection should not be | ||
259 | // handled by group, but by prim. Legacy cruft. | ||
260 | // TODO: Make selection flagging per prim! | ||
261 | // | ||
262 | if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) | ||
263 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | ||
264 | part.ParentGroup.IsSelected = false; | ||
265 | |||
266 | part.ParentGroup.ScheduleGroupForFullUpdate(); | ||
267 | |||
268 | // If it's not an attachment, and we are allowed to move it, | ||
269 | // then we might have done so. If we moved across a parcel | ||
270 | // boundary, we will need to recount prims on the parcels. | ||
271 | // For attachments, that makes no sense. | ||
272 | // | ||
273 | if (!part.ParentGroup.IsAttachment) | ||
274 | { | ||
275 | if (Permissions.CanEditObject( | ||
276 | part.UUID, remoteClient.AgentId) | ||
277 | || Permissions.CanMoveObject( | ||
278 | part.UUID, remoteClient.AgentId)) | ||
279 | EventManager.TriggerParcelPrimCountTainted(); | ||
280 | } | ||
281 | */ | ||
282 | |||
283 | bool oldgprSelect = part.ParentGroup.IsSelected; | 247 | bool oldgprSelect = part.ParentGroup.IsSelected; |
284 | 248 | ||
285 | // This is wrong, wrong, wrong. Selection should not be | 249 | // This is wrong, wrong, wrong. Selection should not be |
@@ -614,7 +578,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
614 | { | 578 | { |
615 | m_log.Error( | 579 | m_log.Error( |
616 | string.Format( | 580 | string.Format( |
617 | "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); | 581 | "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e, folderID)); |
618 | } | 582 | } |
619 | Thread.Sleep(20); | 583 | Thread.Sleep(20); |
620 | } | 584 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 168080f..ca32940 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -67,8 +67,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | 67 | ||
68 | #region Fields | 68 | #region Fields |
69 | 69 | ||
70 | public bool EmergencyMonitoring = false; | ||
71 | |||
72 | /// <summary> | 70 | /// <summary> |
73 | /// Show debug information about animations. | 71 | /// Show debug information about animations. |
74 | /// </summary> | 72 | /// </summary> |
@@ -4606,7 +4604,8 @@ Label_GroupsDone: | |||
4606 | } | 4604 | } |
4607 | 4605 | ||
4608 | // TODO: This check should probably be in QueryAccess(). | 4606 | // TODO: This check should probably be in QueryAccess(). |
4609 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); | 4607 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, |
4608 | (float)RegionInfo.RegionSizeX * 0.5f, (float)RegionInfo.RegionSizeY * 0.5f); | ||
4610 | if (nearestParcel == null) | 4609 | if (nearestParcel == null) |
4611 | { | 4610 | { |
4612 | m_log.InfoFormat( | 4611 | m_log.InfoFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 1de55ec..d406625 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -287,7 +287,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
287 | } | 287 | } |
288 | catch (Exception e) | 288 | catch (Exception e) |
289 | { | 289 | { |
290 | m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); | 290 | m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception {0}", e)); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1141f54..f5f83ca 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -246,11 +246,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | // try to work around that scale down X and Y acording to region size, so reducing the resolution | 246 | // try to work around that scale down X and Y acording to region size, so reducing the resolution |
247 | // | 247 | // |
248 | // viewers need to scale up | 248 | // viewers need to scale up |
249 | float scaleX = m_parentScene.RegionInfo.RegionSizeX / Constants.RegionSize; | 249 | float scaleX = (float)m_parentScene.RegionInfo.RegionSizeX / (float)Constants.RegionSize; |
250 | if (scaleX == 0) | 250 | if (scaleX == 0) |
251 | scaleX = 1.0f; | 251 | scaleX = 1.0f; |
252 | scaleX = 1.0f / scaleX; | 252 | scaleX = 1.0f / scaleX; |
253 | float scaleY = m_parentScene.RegionInfo.RegionSizeY / Constants.RegionSize; | 253 | float scaleY = (float)m_parentScene.RegionInfo.RegionSizeY / (float)Constants.RegionSize; |
254 | if (scaleY == 0) | 254 | if (scaleY == 0) |
255 | scaleY = 1.0f; | 255 | scaleY = 1.0f; |
256 | scaleY = 1.0f / scaleY; | 256 | scaleY = 1.0f / scaleY; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6f4d6c3..3378ead 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -781,6 +781,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | // requested Velocity for physics engines avatar motors | ||
785 | // only makes sense if there is a physical rep | ||
786 | public Vector3 TargetVelocity | ||
787 | { | ||
788 | get | ||
789 | { | ||
790 | if (PhysicsActor != null) | ||
791 | return PhysicsActor.TargetVelocity; | ||
792 | else | ||
793 | return Vector3.Zero; | ||
794 | } | ||
795 | |||
796 | set | ||
797 | { | ||
798 | if (PhysicsActor != null) | ||
799 | { | ||
800 | try | ||
801 | { | ||
802 | PhysicsActor.TargetVelocity = value; | ||
803 | } | ||
804 | catch (Exception e) | ||
805 | { | ||
806 | m_log.Error("[SCENE PRESENCE]: TARGETVELOCITY " + e.Message); | ||
807 | } | ||
808 | } | ||
809 | } | ||
810 | } | ||
811 | |||
784 | private Quaternion m_bodyRot = Quaternion.Identity; | 812 | private Quaternion m_bodyRot = Quaternion.Identity; |
785 | 813 | ||
786 | /// <summary> | 814 | /// <summary> |
@@ -2269,6 +2297,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
2269 | /// <param name="distance"></param> | 2297 | /// <param name="distance"></param> |
2270 | /// | 2298 | /// |
2271 | 2299 | ||
2300 | private void checkCameraCollision() | ||
2301 | { | ||
2302 | if(!m_scene.PhysicsScene.SupportsRayCast()) | ||
2303 | return; | ||
2304 | |||
2305 | ++m_movementUpdateCount; | ||
2306 | if (m_movementUpdateCount < 1) | ||
2307 | m_movementUpdateCount = 1; | ||
2308 | |||
2309 | if (m_doingCamRayCast || m_movementUpdateCount % NumMovementsBetweenRayCast != 0) | ||
2310 | return; | ||
2311 | |||
2312 | if (m_followCamAuto && !m_mouseLook) | ||
2313 | { | ||
2314 | Vector3 posAdjusted = AbsolutePosition; | ||
2315 | // posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f; | ||
2316 | // not good for tiny or huge avatars | ||
2317 | posAdjusted.Z += 1.0f; // viewer current camera focus point | ||
2318 | Vector3 tocam = CameraPosition - posAdjusted; | ||
2319 | |||
2320 | float distTocamlen = tocam.LengthSquared(); | ||
2321 | if (distTocamlen > 0.08f && distTocamlen < 400) | ||
2322 | { | ||
2323 | distTocamlen = (float)Math.Sqrt(distTocamlen); | ||
2324 | tocam *= (1.0f / distTocamlen); | ||
2325 | |||
2326 | m_doingCamRayCast = true; | ||
2327 | m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback); | ||
2328 | return; | ||
2329 | } | ||
2330 | } | ||
2331 | |||
2332 | if (CameraConstraintActive) | ||
2333 | { | ||
2334 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right... | ||
2335 | UpdateCameraCollisionPlane(plane); | ||
2336 | CameraConstraintActive = false; | ||
2337 | } | ||
2338 | } | ||
2339 | |||
2272 | private void UpdateCameraCollisionPlane(Vector4 plane) | 2340 | private void UpdateCameraCollisionPlane(Vector4 plane) |
2273 | { | 2341 | { |
2274 | if (m_lastCameraCollisionPlane != plane) | 2342 | if (m_lastCameraCollisionPlane != plane) |
@@ -2280,17 +2348,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2280 | 2348 | ||
2281 | public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal) | 2349 | public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal) |
2282 | { | 2350 | { |
2283 | const float POSITION_TOLERANCE = 0.02f; | 2351 | // const float POSITION_TOLERANCE = 0.02f; |
2284 | const float ROTATION_TOLERANCE = 0.02f; | 2352 | // const float ROTATION_TOLERANCE = 0.02f; |
2285 | 2353 | ||
2286 | m_doingCamRayCast = false; | ||
2287 | if (hitYN && localid != LocalId) | 2354 | if (hitYN && localid != LocalId) |
2288 | { | 2355 | { |
2289 | SceneObjectGroup group = m_scene.GetGroupByPrim(localid); | 2356 | if (localid != 0) |
2290 | bool IsPrim = group != null; | ||
2291 | if (IsPrim) | ||
2292 | { | 2357 | { |
2293 | SceneObjectPart part = group.GetPart(localid); | 2358 | SceneObjectPart part = m_scene.GetSceneObjectPart(localid); |
2294 | if (part != null && !part.VolumeDetectActive) | 2359 | if (part != null && !part.VolumeDetectActive) |
2295 | { | 2360 | { |
2296 | CameraConstraintActive = true; | 2361 | CameraConstraintActive = true; |
@@ -2323,13 +2388,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2323 | UpdateCameraCollisionPlane(plane); | 2388 | UpdateCameraCollisionPlane(plane); |
2324 | } | 2389 | } |
2325 | } | 2390 | } |
2326 | else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 2391 | // else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || |
2327 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) | 2392 | // !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) |
2393 | else if(CameraConstraintActive) | ||
2328 | { | 2394 | { |
2329 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right... | 2395 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right... |
2330 | UpdateCameraCollisionPlane(plane); | 2396 | UpdateCameraCollisionPlane(plane); |
2331 | CameraConstraintActive = false; | 2397 | CameraConstraintActive = false; |
2332 | } | 2398 | } |
2399 | |||
2400 | m_doingCamRayCast = false; | ||
2333 | } | 2401 | } |
2334 | 2402 | ||
2335 | /// <summary> | 2403 | /// <summary> |
@@ -2414,38 +2482,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2414 | 2482 | ||
2415 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | 2483 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view |
2416 | // this exclude checks may not be complete | 2484 | // this exclude checks may not be complete |
2417 | 2485 | if(agentData.NeedsCameraCollision && ParentID == 0) // condition parentID may be wrong | |
2418 | if (m_movementUpdateCount % NumMovementsBetweenRayCast == 0 && m_scene.PhysicsScene.SupportsRayCast()) | 2486 | checkCameraCollision(); |
2419 | { | ||
2420 | if (!m_doingCamRayCast && !m_mouseLook && ParentID == 0) | ||
2421 | { | ||
2422 | Vector3 posAdjusted = AbsolutePosition; | ||
2423 | // posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f; | ||
2424 | posAdjusted.Z += 1.0f; // viewer current camera focus point | ||
2425 | Vector3 tocam = CameraPosition - posAdjusted; | ||
2426 | tocam.X = (float)Math.Round(tocam.X, 1); | ||
2427 | tocam.Y = (float)Math.Round(tocam.Y, 1); | ||
2428 | tocam.Z = (float)Math.Round(tocam.Z, 1); | ||
2429 | |||
2430 | float distTocamlen = tocam.Length(); | ||
2431 | if (distTocamlen > 0.3f) | ||
2432 | { | ||
2433 | tocam *= (1.0f / distTocamlen); | ||
2434 | posAdjusted.X = (float)Math.Round(posAdjusted.X, 1); | ||
2435 | posAdjusted.Y = (float)Math.Round(posAdjusted.Y, 1); | ||
2436 | posAdjusted.Z = (float)Math.Round(posAdjusted.Z, 1); | ||
2437 | |||
2438 | m_doingCamRayCast = true; | ||
2439 | m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback); | ||
2440 | } | ||
2441 | } | ||
2442 | else if (CameraConstraintActive && (m_mouseLook || ParentID != 0)) | ||
2443 | { | ||
2444 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right... | ||
2445 | UpdateCameraCollisionPlane(plane); | ||
2446 | CameraConstraintActive = false; | ||
2447 | } | ||
2448 | } | ||
2449 | 2487 | ||
2450 | uint flagsForScripts = (uint)flags; | 2488 | uint flagsForScripts = (uint)flags; |
2451 | flags = RemoveIgnoredControls(flags, IgnoredControls); | 2489 | flags = RemoveIgnoredControls(flags, IgnoredControls); |
@@ -2714,14 +2752,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2714 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | 2752 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
2715 | 2753 | ||
2716 | if (IsChildAgent) | 2754 | if (IsChildAgent) |
2717 | { | ||
2718 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | ||
2719 | return; | 2755 | return; |
2720 | } | ||
2721 | 2756 | ||
2722 | ++m_movementUpdateCount; | 2757 | if(IsInTransit) |
2723 | if (m_movementUpdateCount < 1) | 2758 | return; |
2724 | m_movementUpdateCount = 1; | ||
2725 | 2759 | ||
2726 | // AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | 2760 | // AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; |
2727 | 2761 | ||
@@ -2731,7 +2765,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2731 | // Use these three vectors to figure out what the agent is looking at | 2765 | // Use these three vectors to figure out what the agent is looking at |
2732 | // Convert it to a Matrix and/or Quaternion | 2766 | // Convert it to a Matrix and/or Quaternion |
2733 | 2767 | ||
2734 | // this my need lock | 2768 | // this may need lock |
2735 | CameraAtAxis = agentData.CameraAtAxis; | 2769 | CameraAtAxis = agentData.CameraAtAxis; |
2736 | CameraLeftAxis = agentData.CameraLeftAxis; | 2770 | CameraLeftAxis = agentData.CameraLeftAxis; |
2737 | CameraUpAxis = agentData.CameraUpAxis; | 2771 | CameraUpAxis = agentData.CameraUpAxis; |
@@ -2745,24 +2779,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2745 | 2779 | ||
2746 | DrawDistance = agentData.Far; | 2780 | DrawDistance = agentData.Far; |
2747 | 2781 | ||
2748 | // Check if Client has camera in 'follow cam' or 'build' mode. | ||
2749 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | ||
2750 | |||
2751 | m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) | ||
2752 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; | ||
2753 | 2782 | ||
2754 | 2783 | // Check if Client has camera in 'follow cam' or 'build' mode. | |
2755 | //m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto); | 2784 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
2756 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | 2785 | m_followCamAuto = false; |
2757 | if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) | 2786 | if(!m_mouseLook) |
2758 | { | 2787 | { |
2759 | if (m_followCamAuto) | 2788 | if((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f)) |
2760 | { | 2789 | { |
2761 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; | 2790 | Vector3 camdif = new Vector3(1f, 0f, 0f) * Rotation; |
2762 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); | 2791 | float ftmp = camdif.X - CameraAtAxis.X; |
2792 | if(Math.Abs(ftmp) < 0.1f) | ||
2793 | { | ||
2794 | ftmp = camdif.Y - CameraAtAxis.Y; | ||
2795 | if(Math.Abs(ftmp) < 0.1f) | ||
2796 | m_followCamAuto = true; | ||
2797 | } | ||
2763 | } | 2798 | } |
2764 | } | 2799 | } |
2765 | 2800 | ||
2801 | if(agentData.NeedsCameraCollision) | ||
2802 | checkCameraCollision(); | ||
2803 | |||
2766 | TriggerScenePresenceUpdated(); | 2804 | TriggerScenePresenceUpdated(); |
2767 | } | 2805 | } |
2768 | 2806 | ||
@@ -3649,7 +3687,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3649 | m_forceToApplyValid = true; | 3687 | m_forceToApplyValid = true; |
3650 | } | 3688 | } |
3651 | */ | 3689 | */ |
3652 | Velocity = direc; | 3690 | TargetVelocity = direc; |
3653 | Animator.UpdateMovementAnimations(); | 3691 | Animator.UpdateMovementAnimations(); |
3654 | } | 3692 | } |
3655 | 3693 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 08d0fbf..071530b 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -126,13 +126,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
126 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); | 126 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); |
127 | 127 | ||
128 | scene.AddCommand( | 128 | scene.AddCommand( |
129 | "Comms", this, "emergency-monitoring", | ||
130 | "emergency-monitoring", | ||
131 | "Go on/off emergency monitoring mode", | ||
132 | "Go on/off emergency monitoring mode", | ||
133 | HandleEmergencyMonitoring); | ||
134 | |||
135 | scene.AddCommand( | ||
136 | "Comms", this, "show client stats", | 129 | "Comms", this, "show client stats", |
137 | "show client stats [first_name last_name]", | 130 | "show client stats [first_name last_name]", |
138 | "Show client request stats", | 131 | "Show client request stats", |
@@ -197,24 +190,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
197 | return report.ToString(); | 190 | return report.ToString(); |
198 | } | 191 | } |
199 | 192 | ||
200 | protected void HandleEmergencyMonitoring(string module, string[] cmd) | ||
201 | { | ||
202 | bool mode = true; | ||
203 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) | ||
204 | { | ||
205 | mode = true; | ||
206 | MainConsole.Instance.Output("Emergency Monitoring ON"); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | mode = false; | ||
211 | MainConsole.Instance.Output("Emergency Monitoring OFF"); | ||
212 | } | ||
213 | |||
214 | foreach (Scene s in m_scenes.Values) | ||
215 | s.EmergencyMonitoring = mode; | ||
216 | } | ||
217 | |||
218 | protected string GetColumnEntry(string entry, int maxLength, int columnPadding) | 193 | protected string GetColumnEntry(string entry, int maxLength, int columnPadding) |
219 | { | 194 | { |
220 | return string.Format( | 195 | return string.Format( |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs index 79ee00f..40c6b98 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs | |||
@@ -108,10 +108,6 @@ public class BSActorAvatarMove : BSActor | |||
108 | { | 108 | { |
109 | if (m_velocityMotor != null) | 109 | if (m_velocityMotor != null) |
110 | { | 110 | { |
111 | // if (targ == OMV.Vector3.Zero) | ||
112 | // Util.PrintCallStack(); | ||
113 | // | ||
114 | // Console.WriteLine("SetVelocityAndTarget, {0} {1}", vel, targ); | ||
115 | m_velocityMotor.Reset(); | 111 | m_velocityMotor.Reset(); |
116 | m_velocityMotor.SetTarget(targ); | 112 | m_velocityMotor.SetTarget(targ); |
117 | m_velocityMotor.SetCurrent(vel); | 113 | m_velocityMotor.SetCurrent(vel); |
@@ -128,7 +124,7 @@ public class BSActorAvatarMove : BSActor | |||
128 | m_waitingForLowVelocityForStationary = true; | 124 | m_waitingForLowVelocityForStationary = true; |
129 | } | 125 | } |
130 | 126 | ||
131 | // If a movement motor has not been created, create one and start the hovering. | 127 | // If a movement motor has not been created, create one and start the movement |
132 | private void ActivateAvatarMove() | 128 | private void ActivateAvatarMove() |
133 | { | 129 | { |
134 | if (m_velocityMotor == null) | 130 | if (m_velocityMotor == null) |
@@ -161,7 +157,7 @@ public class BSActorAvatarMove : BSActor | |||
161 | } | 157 | } |
162 | } | 158 | } |
163 | 159 | ||
164 | // Called just before the simulation step. Update the vertical position for hoverness. | 160 | // Called just before the simulation step. |
165 | private void Mover(float timeStep) | 161 | private void Mover(float timeStep) |
166 | { | 162 | { |
167 | // Don't do movement while the object is selected. | 163 | // Don't do movement while the object is selected. |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 757f06c..6322695 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | |||
@@ -449,6 +449,7 @@ public sealed class BSCharacter : BSPhysObject | |||
449 | public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } } | 449 | public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } } |
450 | public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } } | 450 | public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } } |
451 | 451 | ||
452 | // PhysicsActor.TargetVelocity | ||
452 | // Sets the target in the motor. This starts the changing of the avatar's velocity. | 453 | // Sets the target in the motor. This starts the changing of the avatar's velocity. |
453 | public override OMV.Vector3 TargetVelocity | 454 | public override OMV.Vector3 TargetVelocity |
454 | { | 455 | { |
@@ -459,7 +460,7 @@ public sealed class BSCharacter : BSPhysObject | |||
459 | set | 460 | set |
460 | { | 461 | { |
461 | DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); | 462 | DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); |
462 | m_targetVelocity = value; | 463 | base.m_targetVelocity = value; |
463 | OMV.Vector3 targetVel = value; | 464 | OMV.Vector3 targetVel = value; |
464 | if (_setAlwaysRun && !_flying) | 465 | if (_setAlwaysRun && !_flying) |
465 | targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f); | 466 | targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f); |
@@ -472,46 +473,38 @@ public sealed class BSCharacter : BSPhysObject | |||
472 | public override OMV.Vector3 Velocity { | 473 | public override OMV.Vector3 Velocity { |
473 | get { return RawVelocity; } | 474 | get { return RawVelocity; } |
474 | set { | 475 | set { |
475 | RawVelocity = value; | 476 | if (m_moveActor != null) |
476 | OMV.Vector3 vel = RawVelocity; | ||
477 | |||
478 | DetailLog("{0}: set Velocity = {1}", LocalID, value); | ||
479 | |||
480 | PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate() | ||
481 | { | 477 | { |
482 | if (m_moveActor != null) | 478 | // m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */); |
483 | m_moveActor.SetVelocityAndTarget(vel, vel, true /* inTaintTime */); | 479 | m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false /* inTaintTime */); |
480 | } | ||
481 | base.Velocity = value; | ||
482 | } | ||
483 | } | ||
484 | 484 | ||
485 | DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, vel); | 485 | // SetMomentum just sets the velocity without a target. We need to stop the movement actor if a character. |
486 | ForceVelocity = vel; | 486 | public override void SetMomentum(OMV.Vector3 momentum) |
487 | }); | 487 | { |
488 | if (m_moveActor != null) | ||
489 | { | ||
490 | // m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */); | ||
491 | m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false /* inTaintTime */); | ||
488 | } | 492 | } |
493 | base.SetMomentum(momentum); | ||
489 | } | 494 | } |
490 | 495 | ||
491 | public override OMV.Vector3 ForceVelocity { | 496 | public override OMV.Vector3 ForceVelocity { |
492 | get { return RawVelocity; } | 497 | get { return RawVelocity; } |
493 | set { | 498 | set { |
494 | PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); | 499 | PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); |
495 | // Util.PrintCallStack(); | 500 | DetailLog("{0}: BSCharacter.ForceVelocity.set = {1}", LocalID, value); |
496 | DetailLog("{0}: set ForceVelocity = {1}", LocalID, value); | ||
497 | 501 | ||
498 | RawVelocity = value; | 502 | RawVelocity = Util.ClampV(value, BSParam.MaxLinearVelocity); |
499 | PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); | 503 | PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); |
500 | PhysScene.PE.Activate(PhysBody, true); | 504 | PhysScene.PE.Activate(PhysBody, true); |
501 | } | 505 | } |
502 | } | 506 | } |
503 | 507 | ||
504 | // SetMomentum just sets the velocity without a target. We need to stop the movement actor if a character. | ||
505 | public override void SetMomentum(OMV.Vector3 momentum) | ||
506 | { | ||
507 | if (m_moveActor != null) | ||
508 | { | ||
509 | m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */); | ||
510 | } | ||
511 | base.SetMomentum(momentum); | ||
512 | } | ||
513 | |||
514 | |||
515 | public override OMV.Vector3 Torque { | 508 | public override OMV.Vector3 Torque { |
516 | get { return RawTorque; } | 509 | get { return RawTorque; } |
517 | set { RawTorque = value; | 510 | set { RawTorque = value; |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index 3682455..a846869 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs | |||
@@ -230,15 +230,22 @@ public abstract class BSPhysObject : PhysicsActor | |||
230 | // Update the physical location and motion of the object. Called with data from Bullet. | 230 | // Update the physical location and motion of the object. Called with data from Bullet. |
231 | public abstract void UpdateProperties(EntityProperties entprop); | 231 | public abstract void UpdateProperties(EntityProperties entprop); |
232 | 232 | ||
233 | // The position value as known by BulletSim. Does not effect the physics engine. | ||
233 | public virtual OMV.Vector3 RawPosition { get; set; } | 234 | public virtual OMV.Vector3 RawPosition { get; set; } |
235 | // Set position in BulletSim and the physics engined to a value immediately. Must be called at taint time. | ||
234 | public abstract OMV.Vector3 ForcePosition { get; set; } | 236 | public abstract OMV.Vector3 ForcePosition { get; set; } |
235 | 237 | ||
238 | // The orientation value as known by BulletSim. Does not effect the physics engine. | ||
236 | public virtual OMV.Quaternion RawOrientation { get; set; } | 239 | public virtual OMV.Quaternion RawOrientation { get; set; } |
240 | // Set orientation in BulletSim and the physics engine to a value immediately. Must be called at taint time. | ||
237 | public abstract OMV.Quaternion ForceOrientation { get; set; } | 241 | public abstract OMV.Quaternion ForceOrientation { get; set; } |
238 | 242 | ||
243 | // The velocity value as known by BulletSim. Does not effect the physics engine. | ||
239 | public virtual OMV.Vector3 RawVelocity { get; set; } | 244 | public virtual OMV.Vector3 RawVelocity { get; set; } |
245 | // Set velocity in BulletSim and the physics engined to a value immediately. Must be called at taint time. | ||
240 | public abstract OMV.Vector3 ForceVelocity { get; set; } | 246 | public abstract OMV.Vector3 ForceVelocity { get; set; } |
241 | 247 | ||
248 | // The rotational velocity value as known by BulletSim. Does not effect the physics engine. | ||
242 | public OMV.Vector3 RawRotationalVelocity { get; set; } | 249 | public OMV.Vector3 RawRotationalVelocity { get; set; } |
243 | 250 | ||
244 | // RawForce is a constant force applied to object (see Force { set; } ) | 251 | // RawForce is a constant force applied to object (see Force { set; } ) |
@@ -252,17 +259,28 @@ public abstract class BSPhysObject : PhysicsActor | |||
252 | public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); | 259 | public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); |
253 | public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); | 260 | public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); |
254 | 261 | ||
262 | // PhysicsActor.Velocity | ||
263 | public override OMV.Vector3 Velocity | ||
264 | { | ||
265 | get { return RawVelocity; } | ||
266 | set | ||
267 | { | ||
268 | // This sets the velocity now. BSCharacter will override to clear target velocity | ||
269 | // before calling this. | ||
270 | RawVelocity = value; | ||
271 | PhysScene.TaintedObject(LocalID, TypeName + ".SetVelocity", delegate () { | ||
272 | // DetailLog("{0},BSPhysObject.Velocity.set,vel={1}", LocalID, RawVelocity); | ||
273 | ForceVelocity = RawVelocity; | ||
274 | }); | ||
275 | } | ||
276 | } | ||
277 | |||
255 | // PhysicsActor.SetMomentum | 278 | // PhysicsActor.SetMomentum |
256 | // All the physics engined use this as a way of forcing the velocity to something. | 279 | // All the physics engines use this as a way of forcing the velocity to something. |
280 | // BSCharacter overrides this so it can set the target velocity to zero before calling this. | ||
257 | public override void SetMomentum(OMV.Vector3 momentum) | 281 | public override void SetMomentum(OMV.Vector3 momentum) |
258 | { | 282 | { |
259 | // This doesn't just set Velocity=momentum because velocity is ramped up to (see MoveActor) | 283 | this.Velocity = momentum; |
260 | RawVelocity = momentum; | ||
261 | PhysScene.TaintedObject(LocalID, TypeName + ".SetMomentum", delegate() | ||
262 | { | ||
263 | // DetailLog("{0},BSPrim.SetMomentum,taint,vel={1}", LocalID, RawVelocity); | ||
264 | ForceVelocity = RawVelocity; | ||
265 | }); | ||
266 | } | 284 | } |
267 | 285 | ||
268 | public override OMV.Vector3 RotationalVelocity { | 286 | public override OMV.Vector3 RotationalVelocity { |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index 78a617d..db2b9db 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs | |||
@@ -787,17 +787,6 @@ public class BSPrim : BSPhysObject | |||
787 | } | 787 | } |
788 | } | 788 | } |
789 | } | 789 | } |
790 | public override OMV.Vector3 Velocity { | ||
791 | get { return RawVelocity; } | ||
792 | set { | ||
793 | RawVelocity = value; | ||
794 | PhysScene.TaintedObject(LocalID, "BSPrim.setVelocity", delegate() | ||
795 | { | ||
796 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity); | ||
797 | ForceVelocity = RawVelocity; | ||
798 | }); | ||
799 | } | ||
800 | } | ||
801 | public override OMV.Vector3 ForceVelocity { | 790 | public override OMV.Vector3 ForceVelocity { |
802 | get { return RawVelocity; } | 791 | get { return RawVelocity; } |
803 | set { | 792 | set { |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 9640e91..f7e1044 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | |||
@@ -632,6 +632,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
632 | } | 632 | } |
633 | } | 633 | } |
634 | 634 | ||
635 | public override Vector3 TargetVelocity | ||
636 | { | ||
637 | get | ||
638 | { | ||
639 | return m_targetVelocity; | ||
640 | } | ||
641 | set | ||
642 | { | ||
643 | if (value.IsFinite()) | ||
644 | { | ||
645 | AddChange(changes.TargetVelocity, value); | ||
646 | } | ||
647 | else | ||
648 | { | ||
649 | m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); | ||
650 | } | ||
651 | } | ||
652 | } | ||
653 | |||
635 | public override Vector3 Torque | 654 | public override Vector3 Torque |
636 | { | 655 | { |
637 | get { return Vector3.Zero; } | 656 | get { return Vector3.Zero; } |
@@ -689,7 +708,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
689 | } | 708 | } |
690 | else | 709 | else |
691 | { | 710 | { |
692 | AddChange(changes.Velocity, force); | 711 | AddChange(changes.TargetVelocity, force); |
693 | } | 712 | } |
694 | } | 713 | } |
695 | else | 714 | else |
@@ -1671,16 +1690,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1671 | { | 1690 | { |
1672 | AvatarGeomAndBodyDestroy(); | 1691 | AvatarGeomAndBodyDestroy(); |
1673 | 1692 | ||
1674 | |||
1675 | float oldsz = m_size.Z; | 1693 | float oldsz = m_size.Z; |
1676 | m_size = pSize; | 1694 | m_size = pSize; |
1677 | 1695 | ||
1678 | |||
1679 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 1696 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
1680 | _position.Z + (m_size.Z - oldsz) * 0.5f); | 1697 | _position.Z + (m_size.Z - oldsz) * 0.5f); |
1681 | 1698 | ||
1682 | Velocity = Vector3.Zero; | 1699 | // Velocity = Vector3.Zero; |
1683 | 1700 | m_targetVelocity = Vector3.Zero; | |
1684 | 1701 | ||
1685 | _parent_scene.actor_name_map[collider] = (PhysicsActor)this; | 1702 | _parent_scene.actor_name_map[collider] = (PhysicsActor)this; |
1686 | _parent_scene.actor_name_map[capsule] = (PhysicsActor)this; | 1703 | _parent_scene.actor_name_map[capsule] = (PhysicsActor)this; |
@@ -1739,6 +1756,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1739 | 1756 | ||
1740 | private void changeVelocity(Vector3 newVel) | 1757 | private void changeVelocity(Vector3 newVel) |
1741 | { | 1758 | { |
1759 | _velocity = newVel; | ||
1760 | setFreeMove(); | ||
1761 | |||
1762 | if (Body != IntPtr.Zero) | ||
1763 | d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); | ||
1764 | } | ||
1765 | |||
1766 | private void changeTargetVelocity(Vector3 newVel) | ||
1767 | { | ||
1742 | m_pidControllerActive = true; | 1768 | m_pidControllerActive = true; |
1743 | m_freemove = false; | 1769 | m_freemove = false; |
1744 | _target_velocity = newVel; | 1770 | _target_velocity = newVel; |
@@ -1881,6 +1907,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1881 | changeVelocity((Vector3)arg); | 1907 | changeVelocity((Vector3)arg); |
1882 | break; | 1908 | break; |
1883 | 1909 | ||
1910 | case changes.TargetVelocity: | ||
1911 | changeTargetVelocity((Vector3)arg); | ||
1912 | break; | ||
1913 | |||
1884 | // case changes.Acceleration: | 1914 | // case changes.Acceleration: |
1885 | // changeacceleration((Vector3)arg); | 1915 | // changeacceleration((Vector3)arg); |
1886 | // break; | 1916 | // break; |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 4adf87e..60b24ec 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -1157,6 +1157,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1157 | 1157 | ||
1158 | m_building = true; // control must set this to false when done | 1158 | m_building = true; // control must set this to false when done |
1159 | 1159 | ||
1160 | AddChange(changes.Add, null); | ||
1161 | |||
1160 | // get basic mass parameters | 1162 | // get basic mass parameters |
1161 | ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, m_shapetype); | 1163 | ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, m_shapetype); |
1162 | 1164 | ||
@@ -1165,8 +1167,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1165 | m_OBBOffset = repData.OBBOffset; | 1167 | m_OBBOffset = repData.OBBOffset; |
1166 | 1168 | ||
1167 | UpdatePrimBodyData(); | 1169 | UpdatePrimBodyData(); |
1168 | |||
1169 | AddChange(changes.Add, null); | ||
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | private void resetCollisionAccounting() | 1172 | private void resetCollisionAccounting() |
@@ -3805,6 +3805,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3805 | changevelocity((Vector3)arg); | 3805 | changevelocity((Vector3)arg); |
3806 | break; | 3806 | break; |
3807 | 3807 | ||
3808 | case changes.TargetVelocity: | ||
3809 | break; | ||
3810 | |||
3808 | // case changes.Acceleration: | 3811 | // case changes.Acceleration: |
3809 | // changeacceleration((Vector3)arg); | 3812 | // changeacceleration((Vector3)arg); |
3810 | // break; | 3813 | // break; |
@@ -3933,8 +3936,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3933 | donullchange(); | 3936 | donullchange(); |
3934 | break; | 3937 | break; |
3935 | 3938 | ||
3936 | |||
3937 | |||
3938 | default: | 3939 | default: |
3939 | donullchange(); | 3940 | donullchange(); |
3940 | break; | 3941 | break; |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index e6aa7ef..f642699 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -112,6 +112,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
112 | OriOffset, // not in use | 112 | OriOffset, // not in use |
113 | // arg Vector3 new position in local coords. Changes prim position in object | 113 | // arg Vector3 new position in local coords. Changes prim position in object |
114 | Velocity, | 114 | Velocity, |
115 | TargetVelocity, | ||
115 | AngVelocity, | 116 | AngVelocity, |
116 | Acceleration, | 117 | Acceleration, |
117 | Force, | 118 | Force, |
@@ -1220,8 +1221,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1220 | /// <param name="obj"></param> | 1221 | /// <param name="obj"></param> |
1221 | public void RemoveCollisionEventReporting(PhysicsActor obj) | 1222 | public void RemoveCollisionEventReporting(PhysicsActor obj) |
1222 | { | 1223 | { |
1223 | if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj)) | 1224 | lock(_collisionEventPrimRemove) |
1224 | _collisionEventPrimRemove.Add(obj); | 1225 | { |
1226 | if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj)) | ||
1227 | _collisionEventPrimRemove.Add(obj); | ||
1228 | } | ||
1225 | } | 1229 | } |
1226 | 1230 | ||
1227 | public override float TimeDilation | 1231 | public override float TimeDilation |
@@ -1758,10 +1762,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1758 | prm.SleeperAddCollisionEvents(); | 1762 | prm.SleeperAddCollisionEvents(); |
1759 | sleepers.Clear(); | 1763 | sleepers.Clear(); |
1760 | 1764 | ||
1761 | foreach (PhysicsActor obj in _collisionEventPrimRemove) | 1765 | lock(_collisionEventPrimRemove) |
1762 | _collisionEventPrim.Remove(obj); | 1766 | { |
1767 | foreach (PhysicsActor obj in _collisionEventPrimRemove) | ||
1768 | _collisionEventPrim.Remove(obj); | ||
1763 | 1769 | ||
1764 | _collisionEventPrimRemove.Clear(); | 1770 | _collisionEventPrimRemove.Clear(); |
1771 | } | ||
1765 | 1772 | ||
1766 | // do a ode simulation step | 1773 | // do a ode simulation step |
1767 | d.WorldQuickStep(world, ODE_STEPSIZE); | 1774 | d.WorldQuickStep(world, ODE_STEPSIZE); |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index bcd1530..ca94034 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -395,6 +395,10 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
395 | { | 395 | { |
396 | // m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName); | 396 | // m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName); |
397 | 397 | ||
398 | |||
399 | // for ubOde we have a diferent mesh use priority | ||
400 | // priority is to use full mesh then decomposition | ||
401 | // SL does the oposite | ||
398 | bool usemesh = false; | 402 | bool usemesh = false; |
399 | 403 | ||
400 | coords = new List<Coord>(); | 404 | coords = new List<Coord>(); |
@@ -443,16 +447,10 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
443 | 447 | ||
444 | if (physicsParms != null) | 448 | if (physicsParms != null) |
445 | usemesh = true; | 449 | usemesh = true; |
446 | else | ||
447 | { | ||
448 | m_log.WarnFormat("[MESH]: Data for PRIM shape type not found for prim {0}",primName); | ||
449 | return false; | ||
450 | } | ||
451 | } | 450 | } |
452 | 451 | ||
453 | if(!usemesh && (map.ContainsKey("physics_convex"))) | 452 | if(!usemesh && (map.ContainsKey("physics_convex"))) |
454 | physicsParms = (OSDMap)map["physics_convex"]; | 453 | physicsParms = (OSDMap)map["physics_convex"]; |
455 | |||
456 | 454 | ||
457 | if (physicsParms == null) | 455 | if (physicsParms == null) |
458 | { | 456 | { |
@@ -555,160 +553,168 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
555 | range = range - min; | 553 | range = range - min; |
556 | range *= invMaxU16; | 554 | range *= invMaxU16; |
557 | 555 | ||
558 | if (!convex && cmap.ContainsKey("HullList") && cmap.ContainsKey("Positions")) | 556 | if(!convex) |
559 | { | 557 | { |
560 | List<int> hsizes = new List<int>(); | 558 | // if mesh data not present and not convex then we need convex decomposition data |
561 | int totalpoints = 0; | 559 | if (cmap.ContainsKey("HullList") && cmap.ContainsKey("Positions")) |
562 | data = cmap["HullList"].AsBinary(); | ||
563 | for (i = 0; i < data.Length; i++) | ||
564 | { | 560 | { |
565 | t1 = data[i]; | 561 | List<int> hsizes = new List<int>(); |
566 | if (t1 == 0) | 562 | int totalpoints = 0; |
567 | t1 = 256; | 563 | data = cmap["HullList"].AsBinary(); |
568 | totalpoints += t1; | 564 | for (i = 0; i < data.Length; i++) |
569 | hsizes.Add(t1); | 565 | { |
570 | } | 566 | t1 = data[i]; |
567 | if (t1 == 0) | ||
568 | t1 = 256; | ||
569 | totalpoints += t1; | ||
570 | hsizes.Add(t1); | ||
571 | } | ||
571 | 572 | ||
572 | data = cmap["Positions"].AsBinary(); | 573 | data = cmap["Positions"].AsBinary(); |
573 | int ptr = 0; | 574 | int ptr = 0; |
574 | int vertsoffset = 0; | 575 | int vertsoffset = 0; |
575 | 576 | ||
576 | if (totalpoints == data.Length / 6) // 2 bytes per coord, 3 coords per point | 577 | if (totalpoints == data.Length / 6) // 2 bytes per coord, 3 coords per point |
577 | { | ||
578 | foreach (int hullsize in hsizes) | ||
579 | { | 578 | { |
580 | for (i = 0; i < hullsize; i++ ) | 579 | foreach (int hullsize in hsizes) |
581 | { | ||
582 | t1 = data[ptr++]; | ||
583 | t1 += data[ptr++] << 8; | ||
584 | t2 = data[ptr++]; | ||
585 | t2 += data[ptr++] << 8; | ||
586 | t3 = data[ptr++]; | ||
587 | t3 += data[ptr++] << 8; | ||
588 | |||
589 | f3 = new float3((t1 * range.X + min.X), | ||
590 | (t2 * range.Y + min.Y), | ||
591 | (t3 * range.Z + min.Z)); | ||
592 | vs.Add(f3); | ||
593 | } | ||
594 | |||
595 | if(hullsize <3) | ||
596 | { | 580 | { |
597 | vs.Clear(); | 581 | for (i = 0; i < hullsize; i++ ) |
598 | continue; | 582 | { |
599 | } | 583 | t1 = data[ptr++]; |
584 | t1 += data[ptr++] << 8; | ||
585 | t2 = data[ptr++]; | ||
586 | t2 += data[ptr++] << 8; | ||
587 | t3 = data[ptr++]; | ||
588 | t3 += data[ptr++] << 8; | ||
589 | |||
590 | f3 = new float3((t1 * range.X + min.X), | ||
591 | (t2 * range.Y + min.Y), | ||
592 | (t3 * range.Z + min.Z)); | ||
593 | vs.Add(f3); | ||
594 | } | ||
600 | 595 | ||
601 | if (hullsize <5) | 596 | if(hullsize <3) |
602 | { | ||
603 | foreach (float3 point in vs) | ||
604 | { | 597 | { |
605 | c.X = point.x; | 598 | vs.Clear(); |
606 | c.Y = point.y; | 599 | continue; |
607 | c.Z = point.z; | ||
608 | coords.Add(c); | ||
609 | } | 600 | } |
610 | f = new Face(vertsoffset, vertsoffset + 1, vertsoffset + 2); | ||
611 | faces.Add(f); | ||
612 | 601 | ||
613 | if (hullsize == 4) | 602 | if (hullsize <5) |
614 | { | 603 | { |
615 | // not sure about orientation.. | 604 | foreach (float3 point in vs) |
616 | f = new Face(vertsoffset, vertsoffset + 2, vertsoffset + 3); | 605 | { |
617 | faces.Add(f); | 606 | c.X = point.x; |
618 | f = new Face(vertsoffset, vertsoffset + 3, vertsoffset + 1); | 607 | c.Y = point.y; |
619 | faces.Add(f); | 608 | c.Z = point.z; |
620 | f = new Face(vertsoffset + 3, vertsoffset + 2, vertsoffset + 1); | 609 | coords.Add(c); |
610 | } | ||
611 | f = new Face(vertsoffset, vertsoffset + 1, vertsoffset + 2); | ||
621 | faces.Add(f); | 612 | faces.Add(f); |
613 | |||
614 | if (hullsize == 4) | ||
615 | { | ||
616 | // not sure about orientation.. | ||
617 | f = new Face(vertsoffset, vertsoffset + 2, vertsoffset + 3); | ||
618 | faces.Add(f); | ||
619 | f = new Face(vertsoffset, vertsoffset + 3, vertsoffset + 1); | ||
620 | faces.Add(f); | ||
621 | f = new Face(vertsoffset + 3, vertsoffset + 2, vertsoffset + 1); | ||
622 | faces.Add(f); | ||
623 | } | ||
624 | vertsoffset += vs.Count; | ||
625 | vs.Clear(); | ||
626 | continue; | ||
627 | } | ||
628 | /* | ||
629 | if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f)) | ||
630 | { | ||
631 | vs.Clear(); | ||
632 | continue; | ||
622 | } | 633 | } |
623 | vertsoffset += vs.Count; | ||
624 | vs.Clear(); | ||
625 | continue; | ||
626 | } | ||
627 | /* | ||
628 | if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f)) | ||
629 | { | ||
630 | vs.Clear(); | ||
631 | continue; | ||
632 | } | ||
633 | 634 | ||
634 | nverts = hullr.Vertices.Count; | 635 | nverts = hullr.Vertices.Count; |
635 | nindexs = hullr.Indices.Count; | 636 | nindexs = hullr.Indices.Count; |
636 | 637 | ||
637 | if (nindexs % 3 != 0) | 638 | if (nindexs % 3 != 0) |
638 | { | 639 | { |
639 | vs.Clear(); | 640 | vs.Clear(); |
640 | continue; | 641 | continue; |
641 | } | 642 | } |
642 | 643 | ||
643 | for (i = 0; i < nverts; i++) | 644 | for (i = 0; i < nverts; i++) |
644 | { | 645 | { |
645 | c.X = hullr.Vertices[i].x; | 646 | c.X = hullr.Vertices[i].x; |
646 | c.Y = hullr.Vertices[i].y; | 647 | c.Y = hullr.Vertices[i].y; |
647 | c.Z = hullr.Vertices[i].z; | 648 | c.Z = hullr.Vertices[i].z; |
648 | coords.Add(c); | 649 | coords.Add(c); |
649 | } | 650 | } |
650 | 651 | ||
651 | for (i = 0; i < nindexs; i += 3) | 652 | for (i = 0; i < nindexs; i += 3) |
652 | { | 653 | { |
653 | t1 = hullr.Indices[i]; | 654 | t1 = hullr.Indices[i]; |
654 | if (t1 > nverts) | 655 | if (t1 > nverts) |
655 | break; | 656 | break; |
656 | t2 = hullr.Indices[i + 1]; | 657 | t2 = hullr.Indices[i + 1]; |
657 | if (t2 > nverts) | 658 | if (t2 > nverts) |
658 | break; | 659 | break; |
659 | t3 = hullr.Indices[i + 2]; | 660 | t3 = hullr.Indices[i + 2]; |
660 | if (t3 > nverts) | 661 | if (t3 > nverts) |
661 | break; | 662 | break; |
662 | f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3); | 663 | f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3); |
663 | faces.Add(f); | 664 | faces.Add(f); |
664 | } | 665 | } |
665 | */ | 666 | */ |
666 | List<int> indices; | 667 | List<int> indices; |
667 | if (!HullUtils.ComputeHull(vs, out indices)) | 668 | if (!HullUtils.ComputeHull(vs, out indices)) |
668 | { | 669 | { |
669 | vs.Clear(); | 670 | vs.Clear(); |
670 | continue; | 671 | continue; |
671 | } | 672 | } |
672 | 673 | ||
673 | nverts = vs.Count; | 674 | nverts = vs.Count; |
674 | nindexs = indices.Count; | 675 | nindexs = indices.Count; |
675 | 676 | ||
676 | if (nindexs % 3 != 0) | 677 | if (nindexs % 3 != 0) |
677 | { | 678 | { |
678 | vs.Clear(); | 679 | vs.Clear(); |
679 | continue; | 680 | continue; |
680 | } | 681 | } |
681 | 682 | ||
682 | for (i = 0; i < nverts; i++) | 683 | for (i = 0; i < nverts; i++) |
683 | { | 684 | { |
684 | c.X = vs[i].x; | 685 | c.X = vs[i].x; |
685 | c.Y = vs[i].y; | 686 | c.Y = vs[i].y; |
686 | c.Z = vs[i].z; | 687 | c.Z = vs[i].z; |
687 | coords.Add(c); | 688 | coords.Add(c); |
688 | } | 689 | } |
689 | 690 | ||
690 | for (i = 0; i < nindexs; i += 3) | 691 | for (i = 0; i < nindexs; i += 3) |
691 | { | 692 | { |
692 | t1 = indices[i]; | 693 | t1 = indices[i]; |
693 | if (t1 > nverts) | 694 | if (t1 > nverts) |
694 | break; | 695 | break; |
695 | t2 = indices[i + 1]; | 696 | t2 = indices[i + 1]; |
696 | if (t2 > nverts) | 697 | if (t2 > nverts) |
697 | break; | 698 | break; |
698 | t3 = indices[i + 2]; | 699 | t3 = indices[i + 2]; |
699 | if (t3 > nverts) | 700 | if (t3 > nverts) |
700 | break; | 701 | break; |
701 | f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3); | 702 | f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3); |
702 | faces.Add(f); | 703 | faces.Add(f); |
704 | } | ||
705 | vertsoffset += nverts; | ||
706 | vs.Clear(); | ||
703 | } | 707 | } |
704 | vertsoffset += nverts; | ||
705 | vs.Clear(); | ||
706 | } | 708 | } |
709 | if (coords.Count > 0 && faces.Count > 0) | ||
710 | return true; | ||
711 | } | ||
712 | else | ||
713 | { | ||
714 | // if neither mesh or decomposition present, warn and use convex | ||
715 | m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName); | ||
707 | } | 716 | } |
708 | if (coords.Count > 0 && faces.Count > 0) | ||
709 | return true; | ||
710 | } | 717 | } |
711 | |||
712 | vs.Clear(); | 718 | vs.Clear(); |
713 | 719 | ||
714 | if (cmap.ContainsKey("BoundingVerts")) | 720 | if (cmap.ContainsKey("BoundingVerts")) |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 6355669..361a0b9 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
68 | void SetMinEventDelay(UUID itemID, double delay); | 68 | void SetMinEventDelay(UUID itemID, double delay); |
69 | int GetStartParameter(UUID itemID); | 69 | int GetStartParameter(UUID itemID); |
70 | 70 | ||
71 | void SetScriptState(UUID itemID, bool state); | 71 | void SetScriptState(UUID itemID, bool state, bool self); |
72 | bool GetScriptState(UUID itemID); | 72 | bool GetScriptState(UUID itemID); |
73 | void SetState(UUID itemID, string newState); | 73 | void SetState(UUID itemID, string newState); |
74 | void ApiResetScript(UUID itemID); | 74 | void ApiResetScript(UUID itemID); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1a73c3e..af04951 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -521,7 +521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
521 | 521 | ||
522 | if ((item = GetScriptByName(name)) != UUID.Zero) | 522 | if ((item = GetScriptByName(name)) != UUID.Zero) |
523 | { | 523 | { |
524 | m_ScriptEngine.SetScriptState(item, run == 0 ? false : true); | 524 | m_ScriptEngine.SetScriptState(item, run == 0 ? false : true, item == m_item.ItemID); |
525 | } | 525 | } |
526 | else | 526 | else |
527 | { | 527 | { |
@@ -14358,6 +14358,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14358 | return contacts.ToArray(); | 14358 | return contacts.ToArray(); |
14359 | } | 14359 | } |
14360 | 14360 | ||
14361 | private ContactResult? GroundIntersection2(Vector3 rayStart, Vector3 rayEnd) | ||
14362 | { | ||
14363 | // get work copies | ||
14364 | float sx = rayStart.X; | ||
14365 | float ex = rayEnd.X; | ||
14366 | float sy = rayStart.Y; | ||
14367 | float ey = rayEnd.Y; | ||
14368 | |||
14369 | float dx = ex - sx; | ||
14370 | float dy = ey - sy; | ||
14371 | |||
14372 | // region size info | ||
14373 | float rsx = World.RegionInfo.RegionSizeX; | ||
14374 | |||
14375 | float tmp; | ||
14376 | |||
14377 | // region bounds | ||
14378 | if(sx < 0) | ||
14379 | { | ||
14380 | if(ex < 0) // totally outside | ||
14381 | return null; | ||
14382 | if(dx <= 0) // out and going away | ||
14383 | return null; | ||
14384 | else if(ex >= rsx) | ||
14385 | ex = rsx - 0.001f; | ||
14386 | tmp = -sx / dx; | ||
14387 | sy += dy * dx; | ||
14388 | sx = 0; | ||
14389 | } | ||
14390 | else if(sx >= rsx) | ||
14391 | { | ||
14392 | if(ex >= rsx) // totally outside | ||
14393 | return null; | ||
14394 | if(dx >= 0) // out and going away | ||
14395 | return null; | ||
14396 | else if(ex < 0) | ||
14397 | ex = 0; | ||
14398 | tmp = (rsx - sx) / dx; | ||
14399 | sy += dy * dx; | ||
14400 | sx = rsx - 0.001f; | ||
14401 | } | ||
14402 | |||
14403 | float rsy = World.RegionInfo.RegionSizeY; | ||
14404 | if(sy < 0) | ||
14405 | { | ||
14406 | if(dy <= 0) // out and going away | ||
14407 | return null; | ||
14408 | else if(ey >= rsy) | ||
14409 | ey = rsy - 0.001f; | ||
14410 | tmp = -sy / dy; | ||
14411 | sx += dy * dx; | ||
14412 | sy = 0; | ||
14413 | } | ||
14414 | else if(sy >= rsy) | ||
14415 | { | ||
14416 | if(dy >= 0) // out and going away | ||
14417 | return null; | ||
14418 | else if(ey < 0) | ||
14419 | ey = 0; | ||
14420 | tmp = (rsy - sy) / dy; | ||
14421 | sx += dy * dx; | ||
14422 | sy = rsy - 0.001f; | ||
14423 | } | ||
14424 | |||
14425 | if(sx < 0 || sx >= rsx) | ||
14426 | return null; | ||
14427 | |||
14428 | float sz = rayStart.Z; | ||
14429 | float ez = rayEnd.Z; | ||
14430 | float dz = ez - sz; | ||
14431 | |||
14432 | float dist = dx * dx + dy * dy + dz * dz; | ||
14433 | if(dist < 0.001) | ||
14434 | return null; | ||
14435 | dist = (float)Math.Sqrt(dist); | ||
14436 | tmp = 1.0f / dist; | ||
14437 | Vector3 rayn = new Vector3(dx * tmp, dy * tmp, dz * tmp); | ||
14438 | |||
14439 | ContactResult? result = null; | ||
14440 | |||
14441 | |||
14442 | |||
14443 | return result; | ||
14444 | } | ||
14445 | |||
14361 | private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd) | 14446 | private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd) |
14362 | { | 14447 | { |
14363 | double[,] heightfield = World.Heightmap.GetDoubles(); | 14448 | double[,] heightfield = World.Heightmap.GetDoubles(); |
@@ -16024,8 +16109,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
16024 | catch (InvalidCastException e) | 16109 | catch (InvalidCastException e) |
16025 | { | 16110 | { |
16026 | Error(originFunc,string.Format( | 16111 | Error(originFunc,string.Format( |
16027 | " error running rule #{1}: arg #{2} ", | 16112 | " error running rule #{0}: arg #{1} {2}", |
16028 | rulesParsed, idx - idxStart) + e.Message); | 16113 | rulesParsed, idx - idxStart, e.Message)); |
16029 | } | 16114 | } |
16030 | finally | 16115 | finally |
16031 | { | 16116 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index e5e43f8..8cd065b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -295,7 +295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
295 | idx++; | 295 | idx++; |
296 | try | 296 | try |
297 | { | 297 | { |
298 | iQ = rules.GetQuaternionItem(idx); | 298 | iQ = rules.GetVector4Item(idx); |
299 | } | 299 | } |
300 | catch (InvalidCastException) | 300 | catch (InvalidCastException) |
301 | { | 301 | { |
@@ -319,7 +319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
319 | idx++; | 319 | idx++; |
320 | try | 320 | try |
321 | { | 321 | { |
322 | iQ = rules.GetQuaternionItem(idx); | 322 | iQ = rules.GetVector4Item(idx); |
323 | } | 323 | } |
324 | catch (InvalidCastException) | 324 | catch (InvalidCastException) |
325 | { | 325 | { |
@@ -342,7 +342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
342 | idx++; | 342 | idx++; |
343 | try | 343 | try |
344 | { | 344 | { |
345 | iQ = rules.GetQuaternionItem(idx); | 345 | iQ = rules.GetVector4Item(idx); |
346 | } | 346 | } |
347 | catch (InvalidCastException) | 347 | catch (InvalidCastException) |
348 | { | 348 | { |
@@ -532,7 +532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
532 | idx++; | 532 | idx++; |
533 | try | 533 | try |
534 | { | 534 | { |
535 | iQ = rules.GetQuaternionItem(idx); | 535 | iQ = rules.GetVector4Item(idx); |
536 | } | 536 | } |
537 | catch (InvalidCastException) | 537 | catch (InvalidCastException) |
538 | { | 538 | { |
@@ -654,7 +654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
654 | break; | 654 | break; |
655 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | 655 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: |
656 | idx++; | 656 | idx++; |
657 | iQ = rules.GetQuaternionItem(idx); | 657 | iQ = rules.GetVector4Item(idx); |
658 | try | 658 | try |
659 | { | 659 | { |
660 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 660 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 611df58..d725907 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -924,26 +924,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
924 | { | 924 | { |
925 | try | 925 | try |
926 | { | 926 | { |
927 | // DISPLAY ERROR INWORLD | 927 | |
928 | string text = FormatException(e); | 928 | if(e.InnerException != null && e.InnerException is ScriptException) |
929 | 929 | { | |
930 | if (text.Length > 1000) | 930 | string text = e.InnerException.Message + |
931 | text = text.Substring(0, 1000); | 931 | "(script: " + ScriptName + |
932 | Engine.World.SimChat(Utils.StringToBytes(text), | 932 | " event: " + data.EventName + |
933 | ChatTypeEnum.DebugChannel, 2147483647, | 933 | " at " + Part.AbsolutePosition + ")"; |
934 | Part.AbsolutePosition, | 934 | if (text.Length > 1000) |
935 | Part.Name, Part.UUID, false); | 935 | text = text.Substring(0, 1000); |
936 | 936 | Engine.World.SimChat(Utils.StringToBytes(text), | |
937 | 937 | ChatTypeEnum.DebugChannel, 2147483647, | |
938 | m_log.Debug(string.Format( | 938 | Part.AbsolutePosition, |
939 | "[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ", | 939 | Part.Name, Part.UUID, false); |
940 | ScriptName, | 940 | m_log.Debug(string.Format( |
941 | data.EventName, | 941 | "[SCRIPT INSTANCE]: {0} (at event {1}, part {2} {3} at {4} in {5}", |
942 | PrimName, | 942 | e.InnerException.Message, |
943 | Part.UUID, | 943 | data.EventName, |
944 | Part.AbsolutePosition, | 944 | PrimName, |
945 | Part.ParentGroup.Scene.Name), | 945 | Part.UUID, |
946 | e); | 946 | Part.AbsolutePosition, |
947 | Part.ParentGroup.Scene.Name)); | ||
948 | |||
949 | } | ||
950 | else | ||
951 | { | ||
952 | |||
953 | // DISPLAY ERROR INWORLD | ||
954 | string text = FormatException(e); | ||
955 | |||
956 | if (text.Length > 1000) | ||
957 | text = text.Substring(0, 1000); | ||
958 | Engine.World.SimChat(Utils.StringToBytes(text), | ||
959 | ChatTypeEnum.DebugChannel, 2147483647, | ||
960 | Part.AbsolutePosition, | ||
961 | Part.Name, Part.UUID, false); | ||
962 | |||
963 | |||
964 | m_log.Debug(string.Format( | ||
965 | "[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ", | ||
966 | ScriptName, | ||
967 | data.EventName, | ||
968 | PrimName, | ||
969 | Part.UUID, | ||
970 | Part.AbsolutePosition, | ||
971 | Part.ParentGroup.Scene.Name), | ||
972 | e); | ||
973 | } | ||
947 | } | 974 | } |
948 | catch (Exception) | 975 | catch (Exception) |
949 | { | 976 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index c36e7c6..738a814 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -700,6 +700,31 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
700 | } | 700 | } |
701 | } | 701 | } |
702 | 702 | ||
703 | // use LSL_Types.Quaternion to parse and store a vector4 for lightShare | ||
704 | public LSL_Types.Quaternion GetVector4Item(int itemIndex) | ||
705 | { | ||
706 | if (Data[itemIndex] is LSL_Types.Quaternion) | ||
707 | { | ||
708 | LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex]; | ||
709 | return q; | ||
710 | } | ||
711 | else if(Data[itemIndex] is OpenMetaverse.Quaternion) | ||
712 | { | ||
713 | LSL_Types.Quaternion q = new LSL_Types.Quaternion( | ||
714 | (OpenMetaverse.Quaternion)Data[itemIndex]); | ||
715 | q.Normalize(); | ||
716 | return q; | ||
717 | } | ||
718 | else | ||
719 | { | ||
720 | throw new InvalidCastException(string.Format( | ||
721 | "{0} expected but {1} given", | ||
722 | typeof(LSL_Types.Quaternion).Name, | ||
723 | Data[itemIndex] != null ? | ||
724 | Data[itemIndex].GetType().Name : "null")); | ||
725 | } | ||
726 | } | ||
727 | |||
703 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) | 728 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) |
704 | { | 729 | { |
705 | if (Data[itemIndex] is LSL_Types.Quaternion) | 730 | if (Data[itemIndex] is LSL_Types.Quaternion) |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index e12f850..7822df9 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1854,15 +1854,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1854 | return instance; | 1854 | return instance; |
1855 | } | 1855 | } |
1856 | 1856 | ||
1857 | public void SetScriptState(UUID itemID, bool running) | 1857 | public void SetScriptState(UUID itemID, bool running, bool self) |
1858 | { | 1858 | { |
1859 | IScriptInstance instance = GetInstance(itemID); | 1859 | IScriptInstance instance = GetInstance(itemID); |
1860 | if (instance != null) | 1860 | if (instance != null) |
1861 | { | 1861 | { |
1862 | if (running) | 1862 | if (running) |
1863 | instance.Start(); | 1863 | instance.Start(); |
1864 | else | 1864 | else |
1865 | instance.Stop(100); | 1865 | { |
1866 | if(self) | ||
1867 | { | ||
1868 | instance.Running = false; | ||
1869 | throw new EventAbortException(); | ||
1870 | } | ||
1871 | else | ||
1872 | instance.Stop(100); | ||
1873 | } | ||
1866 | } | 1874 | } |
1867 | } | 1875 | } |
1868 | 1876 | ||
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index a9359f3..2e8ffe5 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | |||
@@ -72,11 +72,8 @@ namespace OpenSim.Services.AuthenticationService | |||
72 | { | 72 | { |
73 | realID = UUID.Zero; | 73 | realID = UUID.Zero; |
74 | 74 | ||
75 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null); | 75 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}", principalID); |
76 | AuthenticationData data = m_Database.Get(principalID); | 76 | AuthenticationData data = m_Database.Get(principalID); |
77 | UserAccount user = null; | ||
78 | if (m_UserAccountService != null) | ||
79 | user = m_UserAccountService.GetUserAccount(UUID.Zero, principalID); | ||
80 | 77 | ||
81 | if (data == null || data.Data == null) | 78 | if (data == null || data.Data == null) |
82 | { | 79 | { |
@@ -100,53 +97,7 @@ namespace OpenSim.Services.AuthenticationService | |||
100 | return GetToken(principalID, lifetime); | 97 | return GetToken(principalID, lifetime); |
101 | } | 98 | } |
102 | 99 | ||
103 | if (user == null) | 100 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating FAIL for {0} ", principalID); |
104 | { | ||
105 | m_log.DebugFormat("[PASS AUTH]: No user record for {0}", principalID); | ||
106 | return String.Empty; | ||
107 | } | ||
108 | |||
109 | int impersonateFlag = 1 << 6; | ||
110 | |||
111 | if ((user.UserFlags & impersonateFlag) == 0) | ||
112 | return String.Empty; | ||
113 | |||
114 | m_log.DebugFormat("[PASS AUTH]: Attempting impersonation"); | ||
115 | |||
116 | List<UserAccount> accounts = m_UserAccountService.GetUserAccountsWhere(UUID.Zero, "UserLevel >= 200"); | ||
117 | if (accounts == null || accounts.Count == 0) | ||
118 | return String.Empty; | ||
119 | |||
120 | foreach (UserAccount a in accounts) | ||
121 | { | ||
122 | data = m_Database.Get(a.PrincipalID); | ||
123 | if (data == null || data.Data == null || | ||
124 | !data.Data.ContainsKey("passwordHash") || | ||
125 | !data.Data.ContainsKey("passwordSalt")) | ||
126 | { | ||
127 | continue; | ||
128 | } | ||
129 | |||
130 | // m_log.DebugFormat("[PASS AUTH]: Trying {0}", data.PrincipalID); | ||
131 | |||
132 | hashed = Util.Md5Hash(password + ":" + | ||
133 | data.Data["passwordSalt"].ToString()); | ||
134 | |||
135 | if (data.Data["passwordHash"].ToString() == hashed) | ||
136 | { | ||
137 | m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID); | ||
138 | realID = a.PrincipalID; | ||
139 | return GetToken(principalID, lifetime); | ||
140 | } | ||
141 | // else | ||
142 | // { | ||
143 | // m_log.DebugFormat( | ||
144 | // "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.", | ||
145 | // hashed, data.Data["passwordHash"], data.PrincipalID); | ||
146 | // } | ||
147 | } | ||
148 | |||
149 | m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID); | ||
150 | return String.Empty; | 101 | return String.Empty; |
151 | } | 102 | } |
152 | } | 103 | } |
diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs index 74935f3..b9a6281 100644 --- a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs +++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs | |||
@@ -323,7 +323,7 @@ namespace OpenSim.Services.Connectors | |||
323 | } | 323 | } |
324 | else | 324 | else |
325 | m_log.Error(string.Format( | 325 | m_log.Error(string.Format( |
326 | "[ESTATE CONNECTOR]: WebException for {0} {1} {2} ", | 326 | "[ESTATE CONNECTOR]: WebException for {0} {1} {2} {3}", |
327 | verb, uri, formdata, e)); | 327 | verb, uri, formdata, e)); |
328 | } | 328 | } |
329 | } | 329 | } |
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index d7a144c..b6f5760 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -221,7 +221,7 @@ namespace OpenSim.Tests.Common | |||
221 | throw new System.NotImplementedException (); | 221 | throw new System.NotImplementedException (); |
222 | } | 222 | } |
223 | 223 | ||
224 | public void SetScriptState(UUID itemID, bool state) | 224 | public void SetScriptState(UUID itemID, bool state, bool self) |
225 | { | 225 | { |
226 | throw new System.NotImplementedException (); | 226 | throw new System.NotImplementedException (); |
227 | } | 227 | } |