aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorKitto Flora2011-01-20 06:52:10 +0000
committerKitto Flora2011-01-20 06:52:10 +0000
commitb92673c1c97b2c0f5d76be7d5093b7611483c5a0 (patch)
tree71632ad1bb4d79fb401316b723b6439682ea6f45 /OpenSim
parentFix drift of static prim. (diff)
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-b92673c1c97b2c0f5d76be7d5093b7611483c5a0.zip
opensim-SC_OLD-b92673c1c97b2c0f5d76be7d5093b7611483c5a0.tar.gz
opensim-SC_OLD-b92673c1c97b2c0f5d76be7d5093b7611483c5a0.tar.bz2
opensim-SC_OLD-b92673c1c97b2c0f5d76be7d5093b7611483c5a0.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs2
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs28
-rw-r--r--OpenSim/Framework/Util.cs27
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs47
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs204
-rw-r--r--OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs16
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs17
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs17
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs4
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs27
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/Simulation/EstateDataService.cs6
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationDataService.cs6
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs6
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs2
-rw-r--r--OpenSim/Services/HypergridService/UserAccountCache.cs7
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs2
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
30 files changed, 331 insertions, 178 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 2dca3eb..9d70acb 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -867,7 +867,7 @@ namespace OpenSim.Data.MySQL
867 dbcon.Open(); 867 dbcon.Open();
868 868
869 using (MySqlCommand sqlCmd = new MySqlCommand( 869 using (MySqlCommand sqlCmd = new MySqlCommand(
870 "SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1", dbcon)) 870 "SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags & 1", dbcon))
871 { 871 {
872 sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString()); 872 sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
873 sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); 873 sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index 3c73095..287c4dd 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL
130 { 130 {
131 using (MySqlCommand cmd = new MySqlCommand()) 131 using (MySqlCommand cmd = new MySqlCommand())
132 { 132 {
133 cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm); 133 cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
134 134
135 cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); 135 cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
136 cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); 136 cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 20b9cf1..9a38f23 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -708,7 +708,12 @@ namespace OpenSim.Framework
708 return _lightColorR; 708 return _lightColorR;
709 } 709 }
710 set { 710 set {
711 _lightColorR = value; 711 if (value < 0)
712 _lightColorR = 0;
713 else if (value > 1.0f)
714 _lightColorR = 1.0f;
715 else
716 _lightColorR = value;
712 } 717 }
713 } 718 }
714 719
@@ -717,7 +722,12 @@ namespace OpenSim.Framework
717 return _lightColorG; 722 return _lightColorG;
718 } 723 }
719 set { 724 set {
720 _lightColorG = value; 725 if (value < 0)
726 _lightColorG = 0;
727 else if (value > 1.0f)
728 _lightColorG = 1.0f;
729 else
730 _lightColorG = value;
721 } 731 }
722 } 732 }
723 733
@@ -726,7 +736,12 @@ namespace OpenSim.Framework
726 return _lightColorB; 736 return _lightColorB;
727 } 737 }
728 set { 738 set {
729 _lightColorB = value; 739 if (value < 0)
740 _lightColorB = 0;
741 else if (value > 1.0f)
742 _lightColorB = 1.0f;
743 else
744 _lightColorB = value;
730 } 745 }
731 } 746 }
732 747
@@ -735,7 +750,12 @@ namespace OpenSim.Framework
735 return _lightColorA; 750 return _lightColorA;
736 } 751 }
737 set { 752 set {
738 _lightColorA = value; 753 if (value < 0)
754 _lightColorA = 0;
755 else if (value > 1.0f)
756 _lightColorA = 1.0f;
757 else
758 _lightColorA = value;
739 } 759 }
740 } 760 }
741 761
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 877b0c2..cef756c 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -46,7 +46,7 @@ using System.Threading;
46using log4net; 46using log4net;
47using Nini.Config; 47using Nini.Config;
48using Nwc.XmlRpc; 48using Nwc.XmlRpc;
49using BclExtras; 49// using BclExtras;
50using OpenMetaverse; 50using OpenMetaverse;
51using OpenMetaverse.StructuredData; 51using OpenMetaverse.StructuredData;
52using Amib.Threading; 52using Amib.Threading;
@@ -1375,8 +1375,29 @@ namespace OpenSim.Framework
1375 /// <summary> 1375 /// <summary>
1376 /// Created to work around a limitation in Mono with nested delegates 1376 /// Created to work around a limitation in Mono with nested delegates
1377 /// </summary> 1377 /// </summary>
1378 private class FireAndForgetWrapper 1378 private sealed class FireAndForgetWrapper
1379 { 1379 {
1380 private static volatile FireAndForgetWrapper instance;
1381 private static object syncRoot = new Object();
1382
1383 public static FireAndForgetWrapper Instance {
1384 get {
1385
1386 if (instance == null)
1387 {
1388 lock (syncRoot)
1389 {
1390 if (instance == null)
1391 {
1392 instance = new FireAndForgetWrapper();
1393 }
1394 }
1395 }
1396
1397 return instance;
1398 }
1399 }
1400
1380 public void FireAndForget(System.Threading.WaitCallback callback) 1401 public void FireAndForget(System.Threading.WaitCallback callback)
1381 { 1402 {
1382 callback.BeginInvoke(null, EndFireAndForget, callback); 1403 callback.BeginInvoke(null, EndFireAndForget, callback);
@@ -1445,7 +1466,7 @@ namespace OpenSim.Framework
1445 ThreadPool.QueueUserWorkItem(callback, obj); 1466 ThreadPool.QueueUserWorkItem(callback, obj);
1446 break; 1467 break;
1447 case FireAndForgetMethod.BeginInvoke: 1468 case FireAndForgetMethod.BeginInvoke:
1448 FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>(); 1469 FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
1449 wrapper.FireAndForget(callback, obj); 1470 wrapper.FireAndForget(callback, obj);
1450 break; 1471 break;
1451 case FireAndForgetMethod.SmartThreadPool: 1472 case FireAndForgetMethod.SmartThreadPool:
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e416d05..eb5c0f5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3493,9 +3493,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3493 ani.AnimationList[i].AnimSequenceID = seqs[i]; 3493 ani.AnimationList[i].AnimSequenceID = seqs[i];
3494 3494
3495 ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock(); 3495 ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock();
3496 ani.AnimationSourceList[i].ObjectID = objectIDs[i]; 3496 if (objectIDs[i].Equals(sourceAgentId))
3497 if (objectIDs[i] == UUID.Zero) 3497 ani.AnimationSourceList[i].ObjectID = UUID.Zero;
3498 ani.AnimationSourceList[i].ObjectID = sourceAgentId; 3498 else
3499 ani.AnimationSourceList[i].ObjectID = objectIDs[i];
3499 } 3500 }
3500 ani.Header.Reliable = false; 3501 ani.Header.Reliable = false;
3501 OutPacket(ani, ThrottleOutPacketType.Task); 3502 OutPacket(ani, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 6985449..f969bc3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -585,8 +585,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
585 585
586 // Stats tracking 586 // Stats tracking
587 Interlocked.Increment(ref udpClient.PacketsSent); 587 Interlocked.Increment(ref udpClient.PacketsSent);
588 if (isReliable)
589 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
590 588
591 // Put the UDP payload on the wire 589 // Put the UDP payload on the wire
592 AsyncBeginSend(buffer); 590 AsyncBeginSend(buffer);
@@ -859,9 +857,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
859 // Acknowledge the UseCircuitCode packet 857 // Acknowledge the UseCircuitCode packet
860 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 858 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
861 859
862 m_log.DebugFormat( 860// m_log.DebugFormat(
863 "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 861// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
864 buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 862// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
865 } 863 }
866 864
867 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber) 865 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 4cb4aee..9d40688 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Threading;
31using OpenMetaverse; 32using OpenMetaverse;
32 33
33namespace OpenSim.Region.ClientStack.LindenUDP 34namespace OpenSim.Region.ClientStack.LindenUDP
@@ -77,6 +78,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
77 public void Add(OutgoingPacket packet) 78 public void Add(OutgoingPacket packet)
78 { 79 {
79 m_pendingAdds.Enqueue(packet); 80 m_pendingAdds.Enqueue(packet);
81 Interlocked.Add(ref packet.Client.UnackedBytes, packet.Buffer.DataLength);
80 } 82 }
81 83
82 /// <summary> 84 /// <summary>
@@ -139,46 +141,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
139 private void ProcessQueues() 141 private void ProcessQueues()
140 { 142 {
141 // Process all the pending adds 143 // Process all the pending adds
142
143 OutgoingPacket pendingAdd; 144 OutgoingPacket pendingAdd;
144 if (m_pendingAdds != null) 145 while (m_pendingAdds.TryDequeue(out pendingAdd))
145 { 146 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
146 while (m_pendingAdds.TryDequeue(out pendingAdd))
147 {
148 if (pendingAdd != null && m_packets != null)
149 {
150 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
151 }
152 }
153 }
154 147
155 // Process all the pending removes, including updating statistics and round-trip times 148 // Process all the pending removes, including updating statistics and round-trip times
156 PendingAck pendingRemove; 149 PendingAck pendingRemove;
157 OutgoingPacket ackedPacket; 150 OutgoingPacket ackedPacket;
158 if (m_pendingRemoves != null) 151 while (m_pendingRemoves.TryDequeue(out pendingRemove))
159 { 152 {
160 while (m_pendingRemoves.TryDequeue(out pendingRemove)) 153 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
161 { 154 {
162 if (m_pendingRemoves != null && m_packets != null) 155 m_packets.Remove(pendingRemove.SequenceNumber);
156
157 // Update stats
158 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
159
160 if (!pendingRemove.FromResend)
163 { 161 {
164 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 162 // Calculate the round-trip time for this packet and its ACK
165 { 163 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
166 m_packets.Remove(pendingRemove.SequenceNumber); 164 if (rtt > 0)
167 165 ackedPacket.Client.UpdateRoundTrip(rtt);
168 // Update stats
169 System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
170
171 if (!pendingRemove.FromResend)
172 {
173 // Calculate the round-trip time for this packet and its ACK
174 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
175 if (rtt > 0)
176 ackedPacket.Client.UpdateRoundTrip(rtt);
177 }
178 }
179 } 166 }
180 } 167 }
181 } 168 }
182 } 169 }
183 } 170 }
184} 171} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
index 36aaab3..8347e35 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
102 { 102 {
103 UUID capID = UUID.Random(); 103 UUID capID = UUID.Random();
104 104
105 m_log.Info("[GETMESH]: /CAPS/" + capID); 105// m_log.Info("[GETMESH]: /CAPS/" + capID);
106 caps.RegisterHandler("GetMesh", 106 caps.RegisterHandler("GetMesh",
107 new RestHTTPHandler("GET", "/CAPS/" + capID, 107 new RestHTTPHandler("GET", "/CAPS/" + capID,
108 delegate(Hashtable m_dhttpMethod) 108 delegate(Hashtable m_dhttpMethod)
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index 1f60e36..6fb8b46 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
105 { 105 {
106 UUID capID = UUID.Random(); 106 UUID capID = UUID.Random();
107 107
108 m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 108// m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
109 caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 109 caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
110 } 110 }
111 111
@@ -171,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
171 /// <returns>False for "caller try another codec"; true otherwise</returns> 171 /// <returns>False for "caller try another codec"; true otherwise</returns>
172 private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format) 172 private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format)
173 { 173 {
174 m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format); 174// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
175 AssetBase texture; 175 AssetBase texture;
176 176
177 string fullID = textureID.ToString(); 177 string fullID = textureID.ToString();
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index 7303fe7..7df2beb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
69 item = invService.GetItem(item); 69 item = invService.GetItem(item);
70 if (item != null) 70 if (item != null)
71 { 71 {
72 item.Flags = 1; 72 item.Flags |= 1;
73 invService.UpdateItem(item); 73 invService.UpdateItem(item);
74 } 74 }
75 else 75 else
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
85 item = invService.GetItem(item); 85 item = invService.GetItem(item);
86 if (item != null) 86 if (item != null)
87 { 87 {
88 item.Flags = 0; 88 item.Flags &= ~(uint)1;
89 invService.UpdateItem(item); 89 invService.UpdateItem(item);
90 } 90 }
91 else 91 else
@@ -93,4 +93,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
93 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); 93 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
94 } 94 }
95 } 95 }
96} \ No newline at end of file 96}
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 5ec64d5..a83b3df 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -31,16 +31,40 @@ using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using System;
35using System.Reflection;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Reflection;
39using System.IO;
40using System.Web;
41using System.Xml;
42using log4net;
43using Mono.Addins;
44using OpenMetaverse.Messages.Linden;
45using OpenMetaverse.StructuredData;
46using OpenSim.Framework.Capabilities;
47using OpenSim.Framework.Servers;
48using OpenSim.Framework.Servers.HttpServer;
49using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSDArray = OpenMetaverse.StructuredData.OSDArray;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
34 52
35namespace OpenSim.Region.CoreModules.Avatar.Gods 53namespace OpenSim.Region.CoreModules.Avatar.Gods
36{ 54{
37 public class GodsModule : IRegionModule, IGodsModule 55 public class GodsModule : IRegionModule, IGodsModule
38 { 56 {
57 private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59
39 /// <summary>Special UUID for actions that apply to all agents</summary> 60 /// <summary>Special UUID for actions that apply to all agents</summary>
40 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); 61 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
41 62
42 protected Scene m_scene; 63 protected Scene m_scene;
43 protected IDialogModule m_dialogModule; 64 protected IDialogModule m_dialogModule;
65
66 protected Dictionary<UUID, string> m_capsDict =
67 new Dictionary<UUID, string>();
44 68
45 public void Initialise(Scene scene, IConfigSource source) 69 public void Initialise(Scene scene, IConfigSource source)
46 { 70 {
@@ -48,6 +72,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
48 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); 72 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
49 m_scene.RegisterModuleInterface<IGodsModule>(this); 73 m_scene.RegisterModuleInterface<IGodsModule>(this);
50 m_scene.EventManager.OnNewClient += SubscribeToClientEvents; 74 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
75 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
76 m_scene.EventManager.OnClientClosed += OnClientClosed;
77 scene.EventManager.OnIncomingInstantMessage +=
78 OnIncomingInstantMessage;
51 } 79 }
52 80
53 public void PostInitialise() {} 81 public void PostInitialise() {}
@@ -67,6 +95,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
67 client.OnRequestGodlikePowers -= RequestGodlikePowers; 95 client.OnRequestGodlikePowers -= RequestGodlikePowers;
68 } 96 }
69 97
98 private void OnClientClosed(UUID agentID, Scene scene)
99 {
100 m_capsDict.Remove(agentID);
101 }
102
103 private void OnRegisterCaps(UUID agentID, Caps caps)
104 {
105 string uri = "/CAPS/" + UUID.Random();
106 m_capsDict[agentID] = uri;
107
108 caps.RegisterHandler("UntrustedSimulatorMessage",
109 new RestStreamHandler("POST", uri,
110 HandleUntrustedSimulatorMessage));
111 }
112
113 private string HandleUntrustedSimulatorMessage(string request,
114 string path, string param, OSHttpRequest httpRequest,
115 OSHttpResponse httpResponse)
116 {
117 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
118
119 string message = osd["message"].AsString();
120
121 if (message == "GodKickUser")
122 {
123 OSDMap body = (OSDMap)osd["body"];
124 OSDArray userInfo = (OSDArray)body["UserInfo"];
125 OSDMap userData = (OSDMap)userInfo[0];
126
127 UUID agentID = userData["AgentID"].AsUUID();
128 UUID godID = userData["GodID"].AsUUID();
129 UUID godSessionID = userData["GodSessionID"].AsUUID();
130 uint kickFlags = userData["KickFlags"].AsUInteger();
131 string reason = userData["Reason"].AsString();
132
133 ScenePresence god = m_scene.GetScenePresence(godID);
134 if (god == null || god.ControllingClient.SessionId != godSessionID)
135 return String.Empty;
136
137 KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason));
138 }
139 else
140 {
141 m_log.ErrorFormat("[GOD]: Unhandled UntrustedSimulatorMessage: {0}", message);
142 }
143 return String.Empty;
144 }
145
70 public void RequestGodlikePowers( 146 public void RequestGodlikePowers(
71 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) 147 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
72 { 148 {
@@ -115,71 +191,85 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
115 /// <param name="reason">The message to send to the user after it's been turned into a field</param> 191 /// <param name="reason">The message to send to the user after it's been turned into a field</param>
116 public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) 192 public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason)
117 { 193 {
118 UUID kickUserID = ALL_AGENTS; 194 if (!m_scene.Permissions.IsGod(godID))
119 195 return;
196
120 ScenePresence sp = m_scene.GetScenePresence(agentID); 197 ScenePresence sp = m_scene.GetScenePresence(agentID);
121 198
122 if (sp != null || agentID == kickUserID) 199 if (sp == null && agentID != ALL_AGENTS)
123 { 200 {
124 if (m_scene.Permissions.IsGod(godID)) 201 IMessageTransferModule transferModule =
202 m_scene.RequestModuleInterface<IMessageTransferModule>();
203 if (transferModule != null)
125 { 204 {
126 if (kickflags == 0) 205 m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
127 { 206 transferModule.SendInstantMessage(new GridInstantMessage(
128 if (agentID == kickUserID) 207 m_scene, godID, "God", agentID, (byte)250, false,
129 { 208 Utils.BytesToString(reason), UUID.Zero, true,
130 string reasonStr = Utils.BytesToString(reason); 209 new Vector3(), new byte[] {(byte)kickflags}),
131 210 delegate(bool success) {} );
132 m_scene.ForEachClient( 211 }
133 delegate(IClientAPI controller) 212 return;
134 { 213 }
135 if (controller.AgentId != godID)
136 controller.Kick(reasonStr);
137 }
138 );
139
140 // This is a bit crude. It seems the client will be null before it actually stops the thread
141 // The thread will kill itself eventually :/
142 // Is there another way to make sure *all* clients get this 'inter region' message?
143 m_scene.ForEachScenePresence(
144 delegate(ScenePresence p)
145 {
146 if (p.UUID != godID && !p.IsChildAgent)
147 {
148 // Possibly this should really be p.Close() though that method doesn't send a close
149 // to the client
150 p.ControllingClient.Close();
151 }
152 }
153 );
154 }
155 else
156 {
157 m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent);
158 214
159 sp.ControllingClient.Kick(Utils.BytesToString(reason)); 215 switch (kickflags)
160 sp.ControllingClient.Close(); 216 {
161 } 217 case 0:
162 } 218 if (sp != null)
163 219 {
164 if (kickflags == 1) 220 KickPresence(sp, Utils.BytesToString(reason));
165 {
166 sp.AllowMovement = false;
167 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
168 m_dialogModule.SendAlertToUser(godID, "User Frozen");
169 }
170
171 if (kickflags == 2)
172 {
173 sp.AllowMovement = true;
174 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
175 m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
176 }
177 } 221 }
178 else 222 else if (agentID == ALL_AGENTS)
179 { 223 {
180 m_dialogModule.SendAlertToUser(godID, "Kick request denied"); 224 m_scene.ForEachScenePresence(
225 delegate(ScenePresence p)
226 {
227 if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))
228 KickPresence(p, Utils.BytesToString(reason));
229 }
230 );
181 } 231 }
232 break;
233 case 1:
234 if (sp != null)
235 {
236 sp.AllowMovement = false;
237 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
238 m_dialogModule.SendAlertToUser(godID, "User Frozen");
239 }
240 break;
241 case 2:
242 if (sp != null)
243 {
244 sp.AllowMovement = true;
245 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
246 m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
247 }
248 break;
249 default:
250 break;
251 }
252 }
253
254 private void KickPresence(ScenePresence sp, string reason)
255 {
256 if (sp.IsChildAgent)
257 return;
258 sp.ControllingClient.Kick(reason);
259 sp.Scene.IncomingCloseAgent(sp.UUID);
260 }
261
262 private void OnIncomingInstantMessage(GridInstantMessage msg)
263 {
264 if (msg.dialog == (uint)250) // Nonlocal kick
265 {
266 UUID agentID = new UUID(msg.toAgentID);
267 string reason = msg.message;
268 UUID godID = new UUID(msg.fromAgentID);
269 uint kickMode = (uint)msg.binaryBucket[0];
270
271 KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason));
182 } 272 }
183 } 273 }
184 } 274 }
185} \ No newline at end of file 275}
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
index c011776..008233b 100644
--- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
63 { 63 {
64 UUID capuuid = UUID.Random(); 64 UUID capuuid = UUID.Random();
65 65
66 m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); 66// m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/");
67 67
68 caps.RegisterHandler("ObjectAdd", 68 caps.RegisterHandler("ObjectAdd",
69 new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/", 69 new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/",
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f9d28b9..e0f36a2 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -641,7 +641,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
641 lock (m_openRequests) 641 lock (m_openRequests)
642 m_openRequests.Add(requestID, mrs); 642 m_openRequests.Add(requestID, mrs);
643 643
644 WebRequest mapitemsrequest = WebRequest.Create(httpserver); 644 WebRequest mapitemsrequest = null;
645 try
646 {
647 mapitemsrequest = WebRequest.Create(httpserver);
648 }
649 catch (Exception e)
650 {
651 m_log.DebugFormat("[WORLD MAP]: Access to {0} failed with {1}", httpserver, e);
652 return new OSDMap();
653 }
654
645 mapitemsrequest.Method = "POST"; 655 mapitemsrequest.Method = "POST";
646 mapitemsrequest.ContentType = "application/xml+llsd"; 656 mapitemsrequest.ContentType = "application/xml+llsd";
647 OSDMap RAMap = new OSDMap(); 657 OSDMap RAMap = new OSDMap();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e1fedf4..48beb9c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Framework.Scenes
49 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); 49 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
50 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); 50 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
51 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); 51 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
52 public delegate bool ViewObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
52 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene); 53 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
53 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); 54 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
54 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); 55 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene);
@@ -116,6 +117,7 @@ namespace OpenSim.Region.Framework.Scenes
116 public event DuplicateObjectHandler OnDuplicateObject; 117 public event DuplicateObjectHandler OnDuplicateObject;
117 public event EditObjectHandler OnEditObject; 118 public event EditObjectHandler OnEditObject;
118 public event EditObjectInventoryHandler OnEditObjectInventory; 119 public event EditObjectInventoryHandler OnEditObjectInventory;
120 public event ViewObjectInventoryHandler OnViewObjectInventory;
119 public event MoveObjectHandler OnMoveObject; 121 public event MoveObjectHandler OnMoveObject;
120 public event ObjectEntryHandler OnObjectEntry; 122 public event ObjectEntryHandler OnObjectEntry;
121 public event ReturnObjectsHandler OnReturnObjects; 123 public event ReturnObjectsHandler OnReturnObjects;
@@ -401,6 +403,21 @@ namespace OpenSim.Region.Framework.Scenes
401 return true; 403 return true;
402 } 404 }
403 405
406 public bool CanViewObjectInventory(UUID objectID, UUID editorID)
407 {
408 ViewObjectInventoryHandler handler = OnViewObjectInventory;
409 if (handler != null)
410 {
411 Delegate[] list = handler.GetInvocationList();
412 foreach (ViewObjectInventoryHandler h in list)
413 {
414 if (h(objectID, editorID, m_scene) == false)
415 return false;
416 }
417 }
418 return true;
419 }
420
404 #endregion 421 #endregion
405 422
406 #region MOVE OBJECT 423 #region MOVE OBJECT
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 066e504..a4f630a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Region.Framework.Scenes
151 private int m_update_events = 1; 151 private int m_update_events = 1;
152 private int m_update_backup = 200; 152 private int m_update_backup = 200;
153 private int m_update_terrain = 50; 153 private int m_update_terrain = 50;
154// private int m_update_land = 1; 154 private int m_update_land = 10;
155 private int m_update_coarse_locations = 50; 155 private int m_update_coarse_locations = 50;
156 156
157 private int frameMS; 157 private int frameMS;
@@ -1330,12 +1330,12 @@ namespace OpenSim.Region.Framework.Scenes
1330 terrainMS = Util.EnvironmentTickCountSubtract(terMS); 1330 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1331 } 1331 }
1332 1332
1333 //if (m_frame % m_update_land == 0) 1333 if (m_frame % m_update_land == 0)
1334 //{ 1334 {
1335 // int ldMS = Util.EnvironmentTickCount(); 1335 int ldMS = Util.EnvironmentTickCount();
1336 // UpdateLand(); 1336 UpdateLand();
1337 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 1337 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1338 //} 1338 }
1339 1339
1340 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); 1340 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1341 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1341 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 8761284..2ee8c07 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -881,7 +881,6 @@ namespace OpenSim.Region.Framework.Scenes
881 { 881 {
882 item.ParentID = m_part.UUID; 882 item.ParentID = m_part.UUID;
883 item.ParentPartID = m_part.UUID; 883 item.ParentPartID = m_part.UUID;
884 item.Flags = m_items[item.ItemID].Flags;
885 884
886 // If group permissions have been set on, check that the groupID is up to date in case it has 885 // If group permissions have been set on, check that the groupID is up to date in case it has
887 // changed since permissions were last set. 886 // changed since permissions were last set.
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 927f78d..6a3983f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1054,10 +1054,6 @@ namespace OpenSim.Region.Framework.Scenes
1054 //else 1054 //else
1055 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 1055 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
1056 1056
1057 // On the next prim update, all objects will be sent
1058 //
1059 m_sceneViewer.Reset();
1060
1061 m_isChildAgent = false; 1057 m_isChildAgent = false;
1062 1058
1063 // send the animations of the other presences to me 1059 // send the animations of the other presences to me
@@ -1241,7 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes
1241 /// </summary> 1237 /// </summary>
1242 public void CompleteMovement(IClientAPI client) 1238 public void CompleteMovement(IClientAPI client)
1243 { 1239 {
1244 DateTime startTime = DateTime.Now; 1240// DateTime startTime = DateTime.Now;
1245 1241
1246 m_log.DebugFormat( 1242 m_log.DebugFormat(
1247 "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1243 "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
@@ -1294,9 +1290,9 @@ namespace OpenSim.Region.Framework.Scenes
1294 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1290 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1295 } 1291 }
1296 1292
1297 m_log.DebugFormat( 1293// m_log.DebugFormat(
1298 "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1294// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1299 client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1295// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1300 } 1296 }
1301 1297
1302 /// <summary> 1298 /// <summary>
@@ -3311,10 +3307,6 @@ namespace OpenSim.Region.Framework.Scenes
3311 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 3307 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
3312 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 3308 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
3313 3309
3314 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
3315 if (m_scene.m_seeIntoRegionFromNeighbor)
3316 m_sceneViewer.Reset();
3317
3318 //cAgentData.AVHeight; 3310 //cAgentData.AVHeight;
3319 m_rootRegionHandle = cAgentData.RegionHandle; 3311 m_rootRegionHandle = cAgentData.RegionHandle;
3320 //m_velocity = cAgentData.Velocity; 3312 //m_velocity = cAgentData.Velocity;
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index a5ec4f2..968c1e6 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -215,13 +215,22 @@ namespace OpenSim.Server.Handlers.Hypergrid
215 215
216 // We're behind a proxy 216 // We're behind a proxy
217 Hashtable headers = (Hashtable)request["headers"]; 217 Hashtable headers = (Hashtable)request["headers"];
218 if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) 218 string xff = "X-Forwarded-For";
219 if (headers.ContainsKey(xff.ToLower()))
220 xff = xff.ToLower();
221
222 if (!headers.ContainsKey(xff) || headers[xff] == null)
219 { 223 {
220 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); 224 m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
221 if (ep != null) 225 return Util.GetCallerIP(request);
222 return ep.Address.ToString();
223 } 226 }
224 227
228 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
229
230 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
231 if (ep != null)
232 return ep.Address.ToString();
233
225 // Oops 234 // Oops
226 return Util.GetCallerIP(request); 235 return Util.GetCallerIP(request);
227 } 236 }
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 8aa410b..6d01f80 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -205,13 +205,22 @@ namespace OpenSim.Server.Handlers.Simulation
205 205
206 // We're behind a proxy 206 // We're behind a proxy
207 Hashtable headers = (Hashtable)request["headers"]; 207 Hashtable headers = (Hashtable)request["headers"];
208 if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) 208 string xff = "X-Forwarded-For";
209 if (headers.ContainsKey(xff.ToLower()))
210 xff = xff.ToLower();
211
212 if (!headers.ContainsKey(xff) || headers[xff] == null)
209 { 213 {
210 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); 214 m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
211 if (ep != null) 215 return Util.GetCallerIP(request);
212 return ep.Address.ToString();
213 } 216 }
214 217
218 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
219
220 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
221 if (ep != null)
222 return ep.Address.ToString();
223
215 // Oops 224 // Oops
216 return Util.GetCallerIP(request); 225 return Util.GetCallerIP(request);
217 } 226 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index daf94fe..feea196 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
58 MethodBase.GetCurrentMethod().DeclaringType); 58 MethodBase.GetCurrentMethod().DeclaringType);
59 59
60 private string m_ServerURI = String.Empty; 60 private string m_ServerURI = String.Empty;
61 private bool m_Enabled = false; 61// private bool m_Enabled = false;
62 62
63 public SimianGridServiceConnector() { } 63 public SimianGridServiceConnector() { }
64 public SimianGridServiceConnector(string serverURI) 64 public SimianGridServiceConnector(string serverURI)
@@ -95,7 +95,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
95 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 95 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
96 serviceUrl = serviceUrl + '/'; 96 serviceUrl = serviceUrl + '/';
97 m_ServerURI = serviceUrl; 97 m_ServerURI = serviceUrl;
98 m_Enabled = true; 98// m_Enabled = true;
99 } 99 }
100 100
101 #region IGridService 101 #region IGridService
@@ -186,7 +186,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
186 } 186 }
187 } 187 }
188 188
189 m_log.Debug("[SIMIAN GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID); 189// m_log.Debug("[SIMIAN GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID);
190 return regions; 190 return regions;
191 } 191 }
192 192
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 61f3fbe..39df1f5 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -757,7 +757,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
757 } 757 }
758 } 758 }
759 759
760 m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invFolders.Count + " folders from SimianGrid response"); 760// m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invFolders.Count + " folders from SimianGrid response");
761 return invFolders; 761 return invFolders;
762 } 762 }
763 763
@@ -824,7 +824,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
824 } 824 }
825 } 825 }
826 826
827 m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invItems.Count + " items from SimianGrid response"); 827// m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invItems.Count + " items from SimianGrid response");
828 return invItems; 828 return invItems;
829 } 829 }
830 830
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 8141420..678f738 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
158 158
159 public bool LogoutAgent(UUID sessionID) 159 public bool LogoutAgent(UUID sessionID)
160 { 160 {
161 m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); 161// m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
162 162
163 NameValueCollection requestArgs = new NameValueCollection 163 NameValueCollection requestArgs = new NameValueCollection
164 { 164 {
@@ -177,7 +177,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
177 177
178 public bool LogoutRegionAgents(UUID regionID) 178 public bool LogoutRegionAgents(UUID regionID)
179 { 179 {
180 m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); 180// m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID);
181 181
182 NameValueCollection requestArgs = new NameValueCollection 182 NameValueCollection requestArgs = new NameValueCollection
183 { 183 {
@@ -202,7 +202,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
202 202
203 public PresenceInfo GetAgent(UUID sessionID) 203 public PresenceInfo GetAgent(UUID sessionID)
204 { 204 {
205 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID); 205// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID);
206 206
207 NameValueCollection requestArgs = new NameValueCollection 207 NameValueCollection requestArgs = new NameValueCollection
208 { 208 {
@@ -262,7 +262,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
262 262
263 public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) 263 public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
264 { 264 {
265 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID); 265// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);
266 266
267 // Remove the session to mark this user offline 267 // Remove the session to mark this user offline
268 if (!LogoutAgent(sessionID)) 268 if (!LogoutAgent(sessionID))
@@ -287,7 +287,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
287 287
288 public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) 288 public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
289 { 289 {
290 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID); 290// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
291 291
292 NameValueCollection requestArgs = new NameValueCollection 292 NameValueCollection requestArgs = new NameValueCollection
293 { 293 {
@@ -312,10 +312,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
312 312
313 public GridUserInfo GetGridUserInfo(string user) 313 public GridUserInfo GetGridUserInfo(string user)
314 { 314 {
315 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user); 315// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
316 316
317 UUID userID = new UUID(user); 317 UUID userID = new UUID(user);
318 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); 318// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
319 319
320 NameValueCollection requestArgs = new NameValueCollection 320 NameValueCollection requestArgs = new NameValueCollection
321 { 321 {
@@ -338,7 +338,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
338 338
339 private OSDMap GetUserData(UUID userID) 339 private OSDMap GetUserData(UUID userID)
340 { 340 {
341 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); 341// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
342 342
343 NameValueCollection requestArgs = new NameValueCollection 343 NameValueCollection requestArgs = new NameValueCollection
344 { 344 {
@@ -362,7 +362,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
362 OSDMap userResponse = GetUserData(userID); 362 OSDMap userResponse = GetUserData(userID);
363 if (userResponse != null) 363 if (userResponse != null)
364 { 364 {
365 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID); 365// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID);
366 366
367 NameValueCollection requestArgs = new NameValueCollection 367 NameValueCollection requestArgs = new NameValueCollection
368 { 368 {
@@ -377,10 +377,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
377 if (presence != null) 377 if (presence != null)
378 presences.Add(presence); 378 presences.Add(presence);
379 } 379 }
380 else 380// else
381 { 381// {
382 m_log.Debug("[SIMIAN PRESENCE CONNECTOR]: No session returned for " + userID + ": " + response["Message"].AsString()); 382// m_log.Debug("[SIMIAN PRESENCE CONNECTOR]: No session returned for " + userID + ": " + response["Message"].AsString());
383 } 383// }
384 } 384 }
385 385
386 return presences; 386 return presences;
@@ -424,7 +424,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
424 { 424 {
425 if (userResponse != null && userResponse["User"] is OSDMap) 425 if (userResponse != null && userResponse["User"] is OSDMap)
426 { 426 {
427
428 GridUserInfo info = new GridUserInfo(); 427 GridUserInfo info = new GridUserInfo();
429 428
430 info.Online = true; 429 info.Online = true;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 394c2b7..801b424 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -157,7 +157,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
157 { 157 {
158 List<UserAccount> accounts = new List<UserAccount>(); 158 List<UserAccount> accounts = new List<UserAccount>();
159 159
160 m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query); 160// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query);
161 161
162 NameValueCollection requestArgs = new NameValueCollection 162 NameValueCollection requestArgs = new NameValueCollection
163 { 163 {
@@ -198,7 +198,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
198 198
199 public bool StoreUserAccount(UserAccount data) 199 public bool StoreUserAccount(UserAccount data)
200 { 200 {
201 m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 201// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
202 202
203 NameValueCollection requestArgs = new NameValueCollection 203 NameValueCollection requestArgs = new NameValueCollection
204 { 204 {
@@ -255,7 +255,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
255 private UserAccount GetUser(NameValueCollection requestArgs) 255 private UserAccount GetUser(NameValueCollection requestArgs)
256 { 256 {
257 string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)"; 257 string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)";
258 m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); 258// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
259 259
260 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 260 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
261 if (response["Success"].AsBoolean()) 261 if (response["Success"].AsBoolean())
@@ -330,4 +330,4 @@ namespace OpenSim.Services.Connectors.SimianGrid
330 } 330 }
331 } 331 }
332 } 332 }
333} 333} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
index 8a8b46d..b6df5a2 100644
--- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
+++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
@@ -43,9 +43,9 @@ namespace OpenSim.Services.Connectors
43{ 43{
44 public class EstateDataService : ServiceBase, IEstateDataService 44 public class EstateDataService : ServiceBase, IEstateDataService
45 { 45 {
46 private static readonly ILog m_log = 46// private static readonly ILog m_log =
47 LogManager.GetLogger( 47// LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 48// MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 protected IEstateDataStore m_database; 50 protected IEstateDataStore m_database;
51 51
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
index 0df9380..ccef50b 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
@@ -43,9 +43,9 @@ namespace OpenSim.Services.Connectors
43{ 43{
44 public class SimulationDataService : ServiceBase, ISimulationDataService 44 public class SimulationDataService : ServiceBase, ISimulationDataService
45 { 45 {
46 private static readonly ILog m_log = 46// private static readonly ILog m_log =
47 LogManager.GetLogger( 47// LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 48// MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 protected ISimulationDataStore m_database; 50 protected ISimulationDataStore m_database;
51 51
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index fbfc2dd..039d9e5 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -237,7 +237,7 @@ namespace OpenSim.Services.Connectors.Simulation
237 237
238 try 238 try
239 { 239 {
240 OSDMap result = WebUtil.ServiceOSDRequest(uri,null,"DELETE",10000); 240 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000);
241 } 241 }
242 catch (Exception e) 242 catch (Exception e)
243 { 243 {
@@ -255,7 +255,7 @@ namespace OpenSim.Services.Connectors.Simulation
255 255
256 try 256 try
257 { 257 {
258 OSDMap result = WebUtil.ServiceOSDRequest(uri,null,"DELETE",10000); 258 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000);
259 } 259 }
260 catch (Exception e) 260 catch (Exception e)
261 { 261 {
@@ -311,7 +311,7 @@ namespace OpenSim.Services.Connectors.Simulation
311 args["destination_name"] = OSD.FromString(destination.RegionName); 311 args["destination_name"] = OSD.FromString(destination.RegionName);
312 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 312 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
313 313
314 OSDMap result = WebUtil.PostToService(uri,args); 314 WebUtil.PostToService(uri, args);
315 } 315 }
316 catch (Exception e) 316 catch (Exception e)
317 { 317 {
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index bbddd87..b66bfed 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -303,7 +303,7 @@ namespace OpenSim.Services.HypergridService
303 return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID); 303 return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
304 else 304 else
305 { 305 {
306 Object[] args = new Object[] { userURL }; 306// Object[] args = new Object[] { userURL };
307 IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); 307 IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
308 if (userAgentService != null) 308 if (userAgentService != null)
309 { 309 {
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs
index c431060..e0a3e61 100644
--- a/OpenSim/Services/HypergridService/UserAccountCache.cs
+++ b/OpenSim/Services/HypergridService/UserAccountCache.cs
@@ -13,9 +13,10 @@ namespace OpenSim.Services.HypergridService
13 { 13 {
14 private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! 14 private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours!
15 15
16 private static readonly ILog m_log = 16// private static readonly ILog m_log =
17 LogManager.GetLogger( 17// LogManager.GetLogger(
18 MethodBase.GetCurrentMethod().DeclaringType); 18// MethodBase.GetCurrentMethod().DeclaringType);
19
19 private ExpiringCache<UUID, UserAccount> m_UUIDCache; 20 private ExpiringCache<UUID, UserAccount> m_UUIDCache;
20 21
21 private IUserAccountService m_UserAccountService; 22 private IUserAccountService m_UserAccountService;
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index e98cc22..2ffcaf7 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -667,7 +667,7 @@ namespace OpenSim.Services.LLLoginService
667 protected virtual ArrayList GetInventoryLibrary(ILibraryService library) 667 protected virtual ArrayList GetInventoryLibrary(ILibraryService library)
668 { 668 {
669 Dictionary<UUID, InventoryFolderImpl> rootFolders = library.GetAllFolders(); 669 Dictionary<UUID, InventoryFolderImpl> rootFolders = library.GetAllFolders();
670 m_log.DebugFormat("[LLOGIN]: Library has {0} folders", rootFolders.Count); 670// m_log.DebugFormat("[LLOGIN]: Library has {0} folders", rootFolders.Count);
671 //Dictionary<UUID, InventoryFolderImpl> rootFolders = new Dictionary<UUID,InventoryFolderImpl>(); 671 //Dictionary<UUID, InventoryFolderImpl> rootFolders = new Dictionary<UUID,InventoryFolderImpl>();
672 ArrayList folderHashes = new ArrayList(); 672 ArrayList folderHashes = new ArrayList();
673 673
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 93e4a8f..6c4dc4d 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -289,7 +289,7 @@ namespace OpenSim.Services.LLLoginService
289 289
290 // Get active gestures 290 // Get active gestures
291 List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(account.PrincipalID); 291 List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(account.PrincipalID);
292 m_log.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count); 292// m_log.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count);
293 293
294 // 294 //
295 // Login the presence 295 // Login the presence