aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-15 23:28:02 +0100
committerJustin Clark-Casey (justincc)2013-07-15 23:28:02 +0100
commiteb14e5a1756726b1f296591bb1ac385e4b1372d7 (patch)
tree6a7e5e7489785729a2487a0245e0c7e3a9ee99bd
parentAdd request received/handling stats for caps which are served by http poll ha... (diff)
parentRevert "Puts RequestImage (UDP) back to asyn -- CPU spike hunt" (diff)
downloadopensim-SC_OLD-eb14e5a1756726b1f296591bb1ac385e4b1372d7.zip
opensim-SC_OLD-eb14e5a1756726b1f296591bb1ac385e4b1372d7.tar.gz
opensim-SC_OLD-eb14e5a1756726b1f296591bb1ac385e4b1372d7.tar.bz2
opensim-SC_OLD-eb14e5a1756726b1f296591bb1ac385e4b1372d7.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs76
-rw-r--r--OpenSim/Data/IHGTravelingData.cs59
-rw-r--r--OpenSim/Data/MySQL/MySQLHGTravelData.cs80
-rw-r--r--OpenSim/Data/MySQL/Resources/HGTravelStore.migrations18
-rw-r--r--OpenSim/Data/SQLite/Resources/HGTravelStore.migrations18
-rw-r--r--OpenSim/Data/SQLite/SQLiteHGTravelData.cs82
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs3
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs2
-rw-r--r--OpenSim/Framework/Util.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs5
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs24
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs1
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs78
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs42
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs6
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs208
-rw-r--r--OpenSim/Services/HypergridService/UserAgentServiceBase.cs84
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs2
-rw-r--r--bin/OpenSim.ini.example4
30 files changed, 679 insertions, 295 deletions
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
new file mode 100644
index 0000000..10ea8ee
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
@@ -0,0 +1,76 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34using OpenMetaverse;
35
36namespace OpenSim.Capabilities.Handlers
37{
38 public class UploadBakedTextureServerConnector : ServiceConnector
39 {
40 private IAssetService m_AssetService;
41 private string m_ConfigName = "CapsService";
42
43 public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
44 base(config, server, configName)
45 {
46 if (configName != String.Empty)
47 m_ConfigName = configName;
48
49 IConfig serverConfig = config.Configs[m_ConfigName];
50 if (serverConfig == null)
51 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
52
53 string assetService = serverConfig.GetString("AssetService", String.Empty);
54
55 if (assetService == String.Empty)
56 throw new Exception("No AssetService in config file");
57
58 Object[] args = new Object[] { config };
59 m_AssetService =
60 ServerUtils.LoadPlugin<IAssetService>(assetService, args);
61
62 if (m_AssetService == null)
63 throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
64
65 // NEED TO FIX THIS
66 OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
67 server.AddStreamHandler(new RestStreamHandler(
68 "POST",
69 "/CAPS/UploadBakedTexture/",
70 new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
71 "UploadBakedTexture",
72 "Upload Baked Texture Capability"));
73
74 }
75 }
76} \ No newline at end of file
diff --git a/OpenSim/Data/IHGTravelingData.cs b/OpenSim/Data/IHGTravelingData.cs
new file mode 100644
index 0000000..452af7b
--- /dev/null
+++ b/OpenSim/Data/IHGTravelingData.cs
@@ -0,0 +1,59 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Data
34{
35 // This MUST be a ref type!
36 public class HGTravelingData
37 {
38 public UUID SessionID;
39 public UUID UserID;
40 public Dictionary<string, string> Data;
41
42 public HGTravelingData()
43 {
44 Data = new Dictionary<string, string>();
45 }
46 }
47
48 /// <summary>
49 /// An interface for connecting to the user grid datastore
50 /// </summary>
51 public interface IHGTravelingData
52 {
53 HGTravelingData Get(UUID sessionID);
54 HGTravelingData[] GetSessions(UUID userID);
55 bool Store(HGTravelingData data);
56 bool Delete(UUID sessionID);
57 void DeleteOld();
58 }
59} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/MySQLHGTravelData.cs b/OpenSim/Data/MySQL/MySQLHGTravelData.cs
new file mode 100644
index 0000000..e81b880
--- /dev/null
+++ b/OpenSim/Data/MySQL/MySQLHGTravelData.cs
@@ -0,0 +1,80 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Data;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using OpenMetaverse;
35using OpenSim.Framework;
36using MySql.Data.MySqlClient;
37
38namespace OpenSim.Data.MySQL
39{
40 /// <summary>
41 /// A MySQL Interface for user grid data
42 /// </summary>
43 public class MySQLHGTravelData : MySQLGenericTableHandler<HGTravelingData>, IHGTravelingData
44 {
45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 public MySQLHGTravelData(string connectionString, string realm) : base(connectionString, realm, "HGTravelStore") { }
48
49 public HGTravelingData Get(UUID sessionID)
50 {
51 HGTravelingData[] ret = Get("SessionID", sessionID.ToString());
52
53 if (ret.Length == 0)
54 return null;
55
56 return ret[0];
57 }
58
59 public HGTravelingData[] GetSessions(UUID userID)
60 {
61 return base.Get("UserID", userID.ToString());
62 }
63
64 public bool Delete(UUID sessionID)
65 {
66 return Delete("SessionID", sessionID.ToString());
67 }
68
69 public void DeleteOld()
70 {
71 using (MySqlCommand cmd = new MySqlCommand())
72 {
73 cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 DAY", m_Realm);
74
75 ExecuteNonQuery(cmd);
76 }
77
78 }
79 }
80} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations b/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations
new file mode 100644
index 0000000..b4e4422
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations
@@ -0,0 +1,18 @@
1:VERSION 1 # --------------------------
2
3BEGIN;
4
5CREATE TABLE `hg_traveling_data` (
6 `SessionID` VARCHAR(36) NOT NULL,
7 `UserID` VARCHAR(36) NOT NULL,
8 `GridExternalName` VARCHAR(255) NOT NULL DEFAULT '',
9 `ServiceToken` VARCHAR(255) NOT NULL DEFAULT '',
10 `ClientIPAddress` VARCHAR(16) NOT NULL DEFAULT '',
11 `MyIPAddress` VARCHAR(16) NOT NULL DEFAULT '',
12 `TMStamp` timestamp NOT NULL,
13 PRIMARY KEY (`SessionID`),
14 KEY (`UserID`)
15) ENGINE=InnoDB;
16
17COMMIT;
18
diff --git a/OpenSim/Data/SQLite/Resources/HGTravelStore.migrations b/OpenSim/Data/SQLite/Resources/HGTravelStore.migrations
new file mode 100644
index 0000000..2e73caa
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/HGTravelStore.migrations
@@ -0,0 +1,18 @@
1:VERSION 1 # --------------------------
2
3BEGIN;
4
5CREATE TABLE hg_traveling_data (
6 SessionID VARCHAR(36) NOT NULL,
7 UserID VARCHAR(36) NOT NULL,
8 GridExternalName VARCHAR(255) NOT NULL DEFAULT '',
9 ServiceToken VARCHAR(255) NOT NULL DEFAULT '',
10 ClientIPAddress VARCHAR(16) NOT NULL DEFAULT '',
11 MyIPAddress VARCHAR(16) NOT NULL DEFAULT '',
12 TMStamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
13 PRIMARY KEY (`SessionID`),
14 KEY (`UserID`)
15) ENGINE=InnoDB;
16
17COMMIT;
18
diff --git a/OpenSim/Data/SQLite/SQLiteHGTravelData.cs b/OpenSim/Data/SQLite/SQLiteHGTravelData.cs
new file mode 100644
index 0000000..db288b2
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteHGTravelData.cs
@@ -0,0 +1,82 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Data;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using OpenMetaverse;
35using OpenSim.Framework;
36using Mono.Data.Sqlite;
37
38namespace OpenSim.Data.SQLite
39{
40 /// <summary>
41 /// A SQL Interface for user grid data
42 /// </summary>
43 public class SQLiteHGTravelData : SQLiteGenericTableHandler<HGTravelingData>, IHGTravelingData
44 {
45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 public SQLiteHGTravelData(string connectionString, string realm)
48 : base(connectionString, realm, "HGTravelStore") {}
49
50 public HGTravelingData Get(UUID sessionID)
51 {
52 HGTravelingData[] ret = Get("SessionID", sessionID.ToString());
53
54 if (ret.Length == 0)
55 return null;
56
57 return ret[0];
58 }
59
60 public HGTravelingData[] GetSessions(UUID userID)
61 {
62 return base.Get("UserID", userID.ToString());
63 }
64
65 public bool Delete(UUID sessionID)
66 {
67 return Delete("SessionID", sessionID.ToString());
68 }
69
70 public void DeleteOld()
71 {
72 using (SqliteCommand cmd = new SqliteCommand())
73 {
74 cmd.CommandText = String.Format("delete from {0} where TMStamp < datetime('now', '-2 day') ", m_Realm);
75
76 DoQuery(cmd);
77 }
78
79 }
80
81 }
82} \ No newline at end of file
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index dfe60aa..9fc048b 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -171,9 +171,10 @@ namespace OpenSim.Framework
171 /// Soon to be decommissioned 171 /// Soon to be decommissioned
172 /// </summary> 172 /// </summary>
173 /// <param name="cAgent"></param> 173 /// <param name="cAgent"></param>
174 public void CopyFrom(ChildAgentDataUpdate cAgent) 174 public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
175 { 175 {
176 AgentID = new UUID(cAgent.AgentID); 176 AgentID = new UUID(cAgent.AgentID);
177 SessionID = sid;
177 178
178 // next: ??? 179 // next: ???
179 Size = new Vector3(); 180 Size = new Vector3();
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 1dc8053..3f0a031 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Framework.Tests
100 cadu.AVHeight = Size1.Z; 100 cadu.AVHeight = Size1.Z;
101 101
102 AgentPosition position2 = new AgentPosition(); 102 AgentPosition position2 = new AgentPosition();
103 position2.CopyFrom(cadu); 103 position2.CopyFrom(cadu, position1.SessionID);
104 104
105 Assert.IsTrue( 105 Assert.IsTrue(
106 position2.AgentID == position1.AgentID 106 position2.AgentID == position1.AgentID
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index cafe103..8cfc4d4 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2293,7 +2293,7 @@ namespace OpenSim.Framework
2293 { 2293 {
2294 if (m_highQueue.Count > 0) 2294 if (m_highQueue.Count > 0)
2295 res = m_highQueue.Dequeue(); 2295 res = m_highQueue.Dequeue();
2296 else 2296 else if (m_lowQueue.Count > 0)
2297 res = m_lowQueue.Dequeue(); 2297 res = m_lowQueue.Dequeue();
2298 2298
2299 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) 2299 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 86a0298..164adeb 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -347,8 +347,9 @@ namespace OpenSim.Region.ClientStack.Linden
347 347
348 aPollRequest poolreq = m_queue.Dequeue(); 348 aPollRequest poolreq = m_queue.Dequeue();
349 349
350 poolreq.thepoll.Process(poolreq); 350 if (poolreq != null && poolreq.thepoll != null)
351 poolreq.thepoll.Process(poolreq);
351 } 352 }
352 } 353 }
353 } 354 }
354} \ No newline at end of file 355}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 2aab4f9..85270a6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1469,7 +1469,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1469 { 1469 {
1470 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); 1470 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
1471 bool tp = (aCircuit.teleportFlags > 0); 1471 bool tp = (aCircuit.teleportFlags > 0);
1472 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get meshes from 1472 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
1473 if (!tp) 1473 if (!tp)
1474 client.SceneAgent.SendInitialDataToMe(); 1474 client.SceneAgent.SendInitialDataToMe();
1475 } 1475 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 85d26f3..344c8d7 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -817,7 +817,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
817 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", 817 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.",
818 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); 818 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
819 819
820 Fail(sp, finalDestination, logout, "Connection between viewer and destination region could not be established."); 820 Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
821 return; 821 return;
822 } 822 }
823 823
@@ -829,7 +829,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
829 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", 829 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
830 sp.Name, finalDestination.RegionName, sp.Scene.Name); 830 sp.Name, finalDestination.RegionName, sp.Scene.Name);
831 831
832 CleanupFailedInterRegionTeleport(sp, finalDestination); 832 CleanupFailedInterRegionTeleport(sp, currentAgentCircuit.SessionID.ToString(), finalDestination);
833 833
834 return; 834 return;
835 } 835 }
@@ -873,7 +873,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
873 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", 873 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.",
874 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); 874 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
875 875
876 Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); 876 Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Destination region did not signal teleport completion.");
877 877
878 return; 878 return;
879 } 879 }
@@ -927,7 +927,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
927 /// <remarks> 927 /// <remarks>
928 /// <param name='sp'> </param> 928 /// <param name='sp'> </param>
929 /// <param name='finalDestination'></param> 929 /// <param name='finalDestination'></param>
930 protected virtual void CleanupFailedInterRegionTeleport(ScenePresence sp, GridRegion finalDestination) 930 protected virtual void CleanupFailedInterRegionTeleport(ScenePresence sp, string auth_token, GridRegion finalDestination)
931 { 931 {
932 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 932 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
933 933
@@ -938,7 +938,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
938 938
939 // Finally, kill the agent we just created at the destination. 939 // Finally, kill the agent we just created at the destination.
940 // XXX: Possibly this should be done asynchronously. 940 // XXX: Possibly this should be done asynchronously.
941 Scene.SimulationService.CloseAgent(finalDestination, sp.UUID); 941 Scene.SimulationService.CloseAgent(finalDestination, sp.UUID, auth_token);
942 } 942 }
943 943
944 /// <summary> 944 /// <summary>
@@ -948,9 +948,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
948 /// <param name='finalDestination'></param> 948 /// <param name='finalDestination'></param>
949 /// <param name='logout'></param> 949 /// <param name='logout'></param>
950 /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param> 950 /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param>
951 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string reason) 951 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string auth_code, string reason)
952 { 952 {
953 CleanupFailedInterRegionTeleport(sp, finalDestination); 953 CleanupFailedInterRegionTeleport(sp, auth_code, finalDestination);
954 954
955 m_interRegionTeleportFailures.Value++; 955 m_interRegionTeleportFailures.Value++;
956 956
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 759155a..76dbc72 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -207,6 +207,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
207 { 207 {
208 m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); 208 m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
209 m_UAS = scene.RequestModuleInterface<IUserAgentService>(); 209 m_UAS = scene.RequestModuleInterface<IUserAgentService>();
210 if (m_UAS == null)
211 m_UAS = new UserAgentServiceConnector(m_ThisHomeURI);
212
210 } 213 }
211 } 214 }
212 215
@@ -573,12 +576,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
573 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) 576 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
574 { 577 {
575 // local grid user 578 // local grid user
579 m_UAS.LogoutAgent(obj.AgentId, obj.SessionId);
576 return; 580 return;
577 } 581 }
578 582
579 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); 583 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
580 584 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("HomeURI"))
581 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
582 { 585 {
583 string url = aCircuit.ServiceURLs["HomeURI"].ToString(); 586 string url = aCircuit.ServiceURLs["HomeURI"].ToString();
584 IUserAgentService security = new UserAgentServiceConnector(url); 587 IUserAgentService security = new UserAgentServiceConnector(url);
diff --git a/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
index f1eb1ad..fd4d48a 100644
--- a/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
@@ -140,11 +140,13 @@ namespace OpenSim.Region.CoreModules.Framework
140 Watchdog.UpdateThread(); 140 Watchdog.UpdateThread();
141 141
142 GridRegionRequest request = m_RequestQueue.Dequeue(); 142 GridRegionRequest request = m_RequestQueue.Dequeue();
143 GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, request.regionID); 143 if (request != null)
144 144 {
145 if (r != null && r.RegionHandle != 0) 145 GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, request.regionID);
146 request.client.SendRegionHandle(request.regionID, r.RegionHandle);
147 146
147 if (r != null && r.RegionHandle != 0)
148 request.client.SendRegionHandle(request.regionID, r.RegionHandle);
149 }
148 } 150 }
149 } 151 }
150 } 152 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a528093..507329e 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -681,17 +681,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
681 Watchdog.UpdateThread(); 681 Watchdog.UpdateThread();
682 682
683 NameRequest request = m_RequestQueue.Dequeue(); 683 NameRequest request = m_RequestQueue.Dequeue();
684 string[] names; 684 if (request != null)
685 bool foundRealName = TryGetUserNames(request.uuid, out names);
686
687 if (names.Length == 2)
688 { 685 {
689 if (!foundRealName) 686 string[] names;
690 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name); 687 bool foundRealName = TryGetUserNames(request.uuid, out names);
691 688
692 request.client.SendNameReply(request.uuid, names[0], names[1]); 689 if (names.Length == 2)
693 } 690 {
691 if (!foundRealName)
692 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name);
694 693
694 request.client.SendNameReply(request.uuid, names[0], names[1]);
695 }
696 }
695 } 697 }
696 } 698 }
697 699
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 9427961..6d5039b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -250,26 +250,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
250 return true; 250 return true;
251 } 251 }
252 252
253 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
254 {
255 agent = null;
256
257 if (destination == null)
258 return false;
259
260 if (m_scenes.ContainsKey(destination.RegionID))
261 {
262// m_log.DebugFormat(
263// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
264// s.RegionInfo.RegionName, destination.RegionHandle);
265
266 return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
267 }
268
269 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
270 return false;
271 }
272
273 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 253 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
274 { 254 {
275 reason = "Communications failure"; 255 reason = "Communications failure";
@@ -306,7 +286,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
306 return false; 286 return false;
307 } 287 }
308 288
309 public bool CloseAgent(GridRegion destination, UUID id) 289 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
310 { 290 {
311 if (destination == null) 291 if (destination == null)
312 return false; 292 return false;
@@ -317,7 +297,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
317// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 297// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
318// s.RegionInfo.RegionName, destination.RegionHandle); 298// s.RegionInfo.RegionName, destination.RegionHandle);
319 299
320 m_scenes[destination.RegionID].IncomingCloseAgent(id, false); 300 m_scenes[destination.RegionID].IncomingCloseAgent(id, false, auth_token);
321 return true; 301 return true;
322 } 302 }
323 303
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index d120e11..8722b80 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -212,24 +212,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
212 return m_remoteConnector.UpdateAgent(destination, cAgentData); 212 return m_remoteConnector.UpdateAgent(destination, cAgentData);
213 } 213 }
214 214
215 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
216 {
217 agent = null;
218
219 if (destination == null)
220 return false;
221
222 // Try local first
223 if (m_localBackend.RetrieveAgent(destination, id, out agent))
224 return true;
225
226 // else do the remote thing
227 if (!m_localBackend.IsLocalRegion(destination.RegionID))
228 return m_remoteConnector.RetrieveAgent(destination, id, out agent);
229
230 return false;
231 }
232
233 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 215 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
234 { 216 {
235 reason = "Communications failure"; 217 reason = "Communications failure";
@@ -263,18 +245,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
263 } 245 }
264 246
265 247
266 public bool CloseAgent(GridRegion destination, UUID id) 248 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
267 { 249 {
268 if (destination == null) 250 if (destination == null)
269 return false; 251 return false;
270 252
271 // Try local first 253 // Try local first
272 if (m_localBackend.CloseAgent(destination, id)) 254 if (m_localBackend.CloseAgent(destination, id, auth_token))
273 return true; 255 return true;
274 256
275 // else do the remote thing 257 // else do the remote thing
276 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 258 if (!m_localBackend.IsLocalRegion(destination.RegionID))
277 return m_remoteConnector.CloseAgent(destination, id); 259 return m_remoteConnector.CloseAgent(destination, id, auth_token);
278 260
279 return false; 261 return false;
280 } 262 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 54956ee..9cfe869 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3452,7 +3452,7 @@ namespace OpenSim.Region.Framework.Scenes
3452 regions.Remove(RegionInfo.RegionHandle); 3452 regions.Remove(RegionInfo.RegionHandle);
3453 3453
3454 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. 3454 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
3455 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3455 m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions);
3456 } 3456 }
3457 3457
3458 m_eventManager.TriggerClientClosed(agentID, this); 3458 m_eventManager.TriggerClientClosed(agentID, this);
@@ -4202,10 +4202,16 @@ namespace OpenSim.Region.Framework.Scenes
4202 4202
4203 if (childAgentUpdate != null) 4203 if (childAgentUpdate != null)
4204 { 4204 {
4205 if (cAgentData.SessionID != childAgentUpdate.ControllingClient.SessionId)
4206 {
4207 m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", childAgentUpdate.UUID, cAgentData.SessionID);
4208 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
4209 childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID));
4210 }
4211
4205 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4212 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
4206 return true; 4213 return true;
4207 } 4214 }
4208
4209 return false; 4215 return false;
4210 } 4216 }
4211 4217
@@ -4221,20 +4227,24 @@ namespace OpenSim.Region.Framework.Scenes
4221 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4227 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4222 if (childAgentUpdate != null) 4228 if (childAgentUpdate != null)
4223 { 4229 {
4224 // I can't imagine *yet* why we would get an update if the agent is a root agent.. 4230 if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
4225 // however to avoid a race condition crossing borders..
4226 if (childAgentUpdate.IsChildAgent)
4227 { 4231 {
4228 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40); 4232 // I can't imagine *yet* why we would get an update if the agent is a root agent..
4229 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8); 4233 // however to avoid a race condition crossing borders..
4230 uint tRegionX = RegionInfo.RegionLocX; 4234 if (childAgentUpdate.IsChildAgent)
4231 uint tRegionY = RegionInfo.RegionLocY; 4235 {
4232 //Send Data to ScenePresence 4236 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
4233 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); 4237 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
4234 // Not Implemented: 4238 uint tRegionX = RegionInfo.RegionLocX;
4235 //TODO: Do we need to pass the message on to one of our neighbors? 4239 uint tRegionY = RegionInfo.RegionLocY;
4240 //Send Data to ScenePresence
4241 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
4242 // Not Implemented:
4243 //TODO: Do we need to pass the message on to one of our neighbors?
4244 }
4236 } 4245 }
4237 4246 else
4247 m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
4238 return true; 4248 return true;
4239 } 4249 }
4240 4250
@@ -4277,6 +4287,25 @@ namespace OpenSim.Region.Framework.Scenes
4277 4287
4278 return false; 4288 return false;
4279 } 4289 }
4290 /// <summary>
4291 /// Authenticated close (via network)
4292 /// </summary>
4293 /// <param name="agentID"></param>
4294 /// <param name="force"></param>
4295 /// <param name="auth_token"></param>
4296 /// <returns></returns>
4297 public bool IncomingCloseAgent(UUID agentID, bool force, string auth_token)
4298 {
4299 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token);
4300
4301 // Check that the auth_token is valid
4302 AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID);
4303 if (acd != null && acd.SessionID.ToString() == auth_token)
4304 return IncomingCloseAgent(agentID, force);
4305 else
4306 m_log.ErrorFormat("[SCENE]: Request to close agent {0} with invalid authorization token {1}", agentID, auth_token);
4307 return false;
4308 }
4280 4309
4281 /// <summary> 4310 /// <summary>
4282 /// Tell a single agent to disconnect from the region. 4311 /// Tell a single agent to disconnect from the region.
@@ -4289,7 +4318,6 @@ namespace OpenSim.Region.Framework.Scenes
4289 public bool IncomingCloseAgent(UUID agentID, bool force) 4318 public bool IncomingCloseAgent(UUID agentID, bool force)
4290 { 4319 {
4291 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4320 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
4292
4293 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 4321 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
4294 if (presence != null) 4322 if (presence != null)
4295 { 4323 {
@@ -4297,7 +4325,7 @@ namespace OpenSim.Region.Framework.Scenes
4297 return true; 4325 return true;
4298 } 4326 }
4299 4327
4300 // Agent not here 4328 // Agent not here
4301 return false; 4329 return false;
4302 } 4330 }
4303 4331
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 8238e23..77889fa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes
197 /// <summary> 197 /// <summary>
198 /// Closes a child agent on a given region 198 /// Closes a child agent on a given region
199 /// </summary> 199 /// </summary>
200 protected void SendCloseChildAgent(UUID agentID, ulong regionHandle) 200 protected void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token)
201 { 201 {
202 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 202 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
203 203
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes
210 m_log.DebugFormat( 210 m_log.DebugFormat(
211 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); 211 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName);
212 212
213 m_scene.SimulationService.CloseAgent(destination, agentID); 213 m_scene.SimulationService.CloseAgent(destination, agentID, auth_token);
214 } 214 }
215 215
216 /// <summary> 216 /// <summary>
@@ -219,14 +219,14 @@ namespace OpenSim.Region.Framework.Scenes
219 /// </summary> 219 /// </summary>
220 /// <param name="agentID"></param> 220 /// <param name="agentID"></param>
221 /// <param name="regionslst"></param> 221 /// <param name="regionslst"></param>
222 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) 222 public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst)
223 { 223 {
224 foreach (ulong handle in regionslst) 224 foreach (ulong handle in regionslst)
225 { 225 {
226 // We must take a copy here since handle is acts like a reference when used in an iterator. 226 // We must take a copy here since handle is acts like a reference when used in an iterator.
227 // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. 227 // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region.
228 ulong handleCopy = handle; 228 ulong handleCopy = handle;
229 Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy); }); 229 Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); });
230 } 230 }
231 } 231 }
232 232
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 774546c..990ef6e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1010,7 +1010,9 @@ namespace OpenSim.Region.Framework.Scenes
1010 // recorded, which stops the input from being processed. 1010 // recorded, which stops the input from being processed.
1011 MovementFlag = 0; 1011 MovementFlag = 0;
1012 1012
1013 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1013 // DIVA NOTE: I moved TriggerOnMakeRootAgent out of here and into the end of
1014 // CompleteMovement. We don't want modules doing heavy computation before CompleteMovement
1015 // is over.
1014 } 1016 }
1015 1017
1016 public int GetStateSource() 1018 public int GetStateSource()
@@ -1327,10 +1329,15 @@ namespace OpenSim.Region.Framework.Scenes
1327 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1329 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1328 MakeRootAgent(AbsolutePosition, flying); 1330 MakeRootAgent(AbsolutePosition, flying);
1329 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1331 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1332 // Remember in HandleUseCircuitCode, we delayed this to here
1333 // This will also send the initial data to clients when TP to a neighboring region.
1334 // Not ideal, but until we know we're TP-ing from a neighboring region, there's not much we can do
1335 if (m_teleportFlags > 0)
1336 SendInitialDataToMe();
1330 1337
1331// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1338// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1332 1339
1333 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1340 if (!string.IsNullOrEmpty(m_callbackURI))
1334 { 1341 {
1335 // We cannot sleep here since this would hold up the inbound packet processing thread, as 1342 // We cannot sleep here since this would hold up the inbound packet processing thread, as
1336 // CompleteMovement() is executed synchronously. However, it might be better to delay the release 1343 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
@@ -1358,9 +1365,6 @@ namespace OpenSim.Region.Framework.Scenes
1358 // Create child agents in neighbouring regions 1365 // Create child agents in neighbouring regions
1359 if (openChildAgents && !IsChildAgent) 1366 if (openChildAgents && !IsChildAgent)
1360 { 1367 {
1361 // Remember in HandleUseCircuitCode, we delayed this to here
1362 SendInitialDataToMe();
1363
1364 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1368 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1365 if (m_agentTransfer != null) 1369 if (m_agentTransfer != null)
1366 Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); }); 1370 Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); });
@@ -1382,6 +1386,11 @@ namespace OpenSim.Region.Framework.Scenes
1382// m_log.DebugFormat( 1386// m_log.DebugFormat(
1383// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1387// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1384// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1388// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1389
1390 // DIVA NOTE: moved this here from MakeRoot. We don't want modules making heavy
1391 // computations before CompleteMovement is over
1392 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1393
1385 } 1394 }
1386 1395
1387 /// <summary> 1396 /// <summary>
@@ -2689,11 +2698,12 @@ namespace OpenSim.Region.Framework.Scenes
2689 SendOtherAgentsAppearanceToMe(); 2698 SendOtherAgentsAppearanceToMe();
2690 2699
2691 EntityBase[] entities = Scene.Entities.GetEntities(); 2700 EntityBase[] entities = Scene.Entities.GetEntities();
2692 foreach(EntityBase e in entities) 2701 foreach (EntityBase e in entities)
2693 { 2702 {
2694 if (e != null && e is SceneObjectGroup) 2703 if (e != null && e is SceneObjectGroup)
2695 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); 2704 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
2696 } 2705 }
2706
2697 }); 2707 });
2698 } 2708 }
2699 2709
@@ -2917,7 +2927,7 @@ namespace OpenSim.Region.Framework.Scenes
2917 cadu.Velocity = Velocity; 2927 cadu.Velocity = Velocity;
2918 2928
2919 AgentPosition agentpos = new AgentPosition(); 2929 AgentPosition agentpos = new AgentPosition();
2920 agentpos.CopyFrom(cadu); 2930 agentpos.CopyFrom(cadu, ControllingClient.SessionId);
2921 2931
2922 // Let's get this out of the update loop 2932 // Let's get this out of the update loop
2923 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); 2933 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
@@ -3155,7 +3165,11 @@ namespace OpenSim.Region.Framework.Scenes
3155 { 3165 {
3156 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); 3166 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
3157 3167
3158 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); 3168 AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(UUID);
3169 string auth = string.Empty;
3170 if (acd != null)
3171 auth = acd.SessionID.ToString();
3172 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions);
3159 } 3173 }
3160 3174
3161 foreach (ulong handle in byebyeRegions) 3175 foreach (ulong handle in byebyeRegions)
@@ -3252,6 +3266,7 @@ namespace OpenSim.Region.Framework.Scenes
3252 3266
3253 cAgent.AgentID = UUID; 3267 cAgent.AgentID = UUID;
3254 cAgent.RegionID = Scene.RegionInfo.RegionID; 3268 cAgent.RegionID = Scene.RegionInfo.RegionID;
3269 cAgent.SessionID = ControllingClient.SessionId;
3255 3270
3256 cAgent.Position = AbsolutePosition; 3271 cAgent.Position = AbsolutePosition;
3257 cAgent.Velocity = m_velocity; 3272 cAgent.Velocity = m_velocity;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 5a72239..5df9aba 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -112,6 +112,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero); 112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2))); 113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS; 114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
115 moveArgs.SessionID = acd.SessionID;
115 116
116 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs); 117 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
117 118
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 40a34c6..4ac477f 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -27,11 +27,13 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Specialized;
30using System.IO; 31using System.IO;
31using System.IO.Compression; 32using System.IO.Compression;
32using System.Reflection; 33using System.Reflection;
33using System.Net; 34using System.Net;
34using System.Text; 35using System.Text;
36using System.Web;
35 37
36using OpenSim.Server.Base; 38using OpenSim.Server.Base;
37using OpenSim.Server.Handlers.Base; 39using OpenSim.Server.Handlers.Base;
@@ -90,14 +92,13 @@ namespace OpenSim.Server.Handlers.Simulation
90 92
91 // Next, let's parse the verb 93 // Next, let's parse the verb
92 string method = (string)request["http-method"]; 94 string method = (string)request["http-method"];
93 if (method.Equals("GET")) 95 if (method.Equals("DELETE"))
94 { 96 {
95 DoAgentGet(request, responsedata, agentID, regionID); 97 string auth_token = string.Empty;
96 return responsedata; 98 if (request.ContainsKey("auth"))
97 } 99 auth_token = request["auth"].ToString();
98 else if (method.Equals("DELETE")) 100
99 { 101 DoAgentDelete(request, responsedata, agentID, action, regionID, auth_token);
100 DoAgentDelete(request, responsedata, agentID, action, regionID);
101 return responsedata; 102 return responsedata;
102 } 103 }
103 else if (method.Equals("QUERYACCESS")) 104 else if (method.Equals("QUERYACCESS"))
@@ -107,7 +108,7 @@ namespace OpenSim.Server.Handlers.Simulation
107 } 108 }
108 else 109 else
109 { 110 {
110 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message (caller is {1})", method, Util.GetCallerIP(request)); 111 m_log.ErrorFormat("[AGENT HANDLER]: method {0} not supported in agent message {1} (caller is {2})", method, (string)request["uri"], Util.GetCallerIP(request));
111 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; 112 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
112 responsedata["str_response_string"] = "Method not allowed"; 113 responsedata["str_response_string"] = "Method not allowed";
113 114
@@ -156,61 +157,12 @@ namespace OpenSim.Server.Handlers.Simulation
156// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); 157// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
157 } 158 }
158 159
159 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 160 protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID, string auth_token)
160 { 161 {
161 if (m_SimulationService == null) 162 if (string.IsNullOrEmpty(action))
162 { 163 m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE <<< RegionID: {0}; from: {1}; auth_code: {2}", regionID, Util.GetCallerIP(request), auth_token);
163 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
164 responsedata["content_type"] = "application/json";
165 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
166 responsedata["str_response_string"] = string.Empty;
167
168 return;
169 }
170
171 GridRegion destination = new GridRegion();
172 destination.RegionID = regionID;
173
174 IAgentData agent = null;
175 bool result = m_SimulationService.RetrieveAgent(destination, id, out agent);
176 OSDMap map = null;
177 if (result)
178 {
179 if (agent != null) // just to make sure
180 {
181 map = agent.Pack();
182 string strBuffer = "";
183 try
184 {
185 strBuffer = OSDParser.SerializeJsonString(map);
186 }
187 catch (Exception e)
188 {
189 m_log.WarnFormat("[AGENT HANDLER]: Exception thrown on serialization of DoAgentGet: {0}", e.Message);
190 responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
191 // ignore. buffer will be empty, caller should check.
192 }
193
194 responsedata["content_type"] = "application/json";
195 responsedata["int_response_code"] = HttpStatusCode.OK;
196 responsedata["str_response_string"] = strBuffer;
197 }
198 else
199 {
200 responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
201 responsedata["str_response_string"] = "Internal error";
202 }
203 }
204 else 164 else
205 { 165 m_log.DebugFormat("[AGENT HANDLER]: Release {0} to RegionID: {1}", id, regionID);
206 responsedata["int_response_code"] = HttpStatusCode.NotFound;
207 responsedata["str_response_string"] = "Not Found";
208 }
209 }
210
211 protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
212 {
213 m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID);
214 166
215 GridRegion destination = new GridRegion(); 167 GridRegion destination = new GridRegion();
216 destination.RegionID = regionID; 168 destination.RegionID = regionID;
@@ -218,12 +170,12 @@ namespace OpenSim.Server.Handlers.Simulation
218 if (action.Equals("release")) 170 if (action.Equals("release"))
219 ReleaseAgent(regionID, id); 171 ReleaseAgent(regionID, id);
220 else 172 else
221 Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id); }); 173 Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id, auth_token); });
222 174
223 responsedata["int_response_code"] = HttpStatusCode.OK; 175 responsedata["int_response_code"] = HttpStatusCode.OK;
224 responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); 176 responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
225 177
226 m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID); 178 //m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID);
227 } 179 }
228 180
229 protected virtual void ReleaseAgent(UUID regionID, UUID id) 181 protected virtual void ReleaseAgent(UUID regionID, UUID id)
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
index 94bda82..1a62d2f 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
@@ -214,7 +214,7 @@ namespace OpenSim.Services.Connectors
214 214
215 } 215 }
216 else 216 else
217 m_log.DebugFormat("[GRID USER CONNECTOR]: Loggedin received empty reply"); 217 m_log.DebugFormat("[GRID USER CONNECTOR]: Get received empty reply");
218 } 218 }
219 catch (Exception e) 219 catch (Exception e)
220 { 220 {
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index f51c809..aca414b 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -271,41 +271,6 @@ namespace OpenSim.Services.Connectors.Simulation
271 return false; 271 return false;
272 } 272 }
273 273
274 /// <summary>
275 /// Not sure what sequence causes this function to be invoked. The only calling
276 /// path is through the GET method
277 /// </summary>
278 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
279 {
280 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: RetrieveAgent start");
281
282 agent = null;
283
284 // Eventually, we want to use a caps url instead of the agentID
285 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
286
287 try
288 {
289 OSDMap result = WebUtil.GetFromService(uri, 10000);
290 if (result["Success"].AsBoolean())
291 {
292 // OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString());
293 OSDMap args = (OSDMap)result["_Result"];
294 if (args != null)
295 {
296 agent = new CompleteAgentData();
297 agent.Unpack(args, null);
298 return true;
299 }
300 }
301 }
302 catch (Exception e)
303 {
304 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString());
305 }
306
307 return false;
308 }
309 274
310 /// <summary> 275 /// <summary>
311 /// </summary> 276 /// </summary>
@@ -402,11 +367,10 @@ namespace OpenSim.Services.Connectors.Simulation
402 367
403 /// <summary> 368 /// <summary>
404 /// </summary> 369 /// </summary>
405 public bool CloseAgent(GridRegion destination, UUID id) 370 public bool CloseAgent(GridRegion destination, UUID id, string auth_code)
406 { 371 {
407// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); 372 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/?auth=" + auth_code;
408 373 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent {0}", uri);
409 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
410 374
411 try 375 try
412 { 376 {
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 0cf1c14..0a3e70b 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -419,6 +419,12 @@ namespace OpenSim.Services.HypergridService
419 if (!CheckAddress(aCircuit.ServiceSessionID)) 419 if (!CheckAddress(aCircuit.ServiceSessionID))
420 return false; 420 return false;
421 421
422 if (string.IsNullOrEmpty(aCircuit.IPAddress))
423 {
424 m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide a client IP address.");
425 return false;
426 }
427
422 string userURL = string.Empty; 428 string userURL = string.Empty;
423 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 429 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
424 userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 430 userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 733993f..b414aca 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32 32
33using OpenSim.Data;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Services.Connectors.Friends; 35using OpenSim.Services.Connectors.Friends;
35using OpenSim.Services.Connectors.Hypergrid; 36using OpenSim.Services.Connectors.Hypergrid;
@@ -50,14 +51,14 @@ namespace OpenSim.Services.HypergridService
50 /// needs to do it for them. 51 /// needs to do it for them.
51 /// Once we have better clients, this shouldn't be needed. 52 /// Once we have better clients, this shouldn't be needed.
52 /// </summary> 53 /// </summary>
53 public class UserAgentService : IUserAgentService 54 public class UserAgentService : UserAgentServiceBase, IUserAgentService
54 { 55 {
55 private static readonly ILog m_log = 56 private static readonly ILog m_log =
56 LogManager.GetLogger( 57 LogManager.GetLogger(
57 MethodBase.GetCurrentMethod().DeclaringType); 58 MethodBase.GetCurrentMethod().DeclaringType);
58 59
59 // This will need to go into a DB table 60 // This will need to go into a DB table
60 static Dictionary<UUID, TravelingAgentInfo> m_TravelingAgents = new Dictionary<UUID, TravelingAgentInfo>(); 61 //static Dictionary<UUID, TravelingAgentInfo> m_Database = new Dictionary<UUID, TravelingAgentInfo>();
61 62
62 static bool m_Initialized = false; 63 static bool m_Initialized = false;
63 64
@@ -86,6 +87,7 @@ namespace OpenSim.Services.HypergridService
86 } 87 }
87 88
88 public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector) 89 public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector)
90 : base(config)
89 { 91 {
90 // Let's set this always, because we don't know the sequence 92 // Let's set this always, because we don't know the sequence
91 // of instantiations 93 // of instantiations
@@ -146,6 +148,9 @@ namespace OpenSim.Services.HypergridService
146 if (!m_GridName.EndsWith("/")) 148 if (!m_GridName.EndsWith("/"))
147 m_GridName = m_GridName + "/"; 149 m_GridName = m_GridName + "/";
148 150
151 // Finally some cleanup
152 m_Database.DeleteOld();
153
149 } 154 }
150 } 155 }
151 156
@@ -260,7 +265,8 @@ namespace OpenSim.Services.HypergridService
260 265
261 // Generate a new service session 266 // Generate a new service session
262 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); 267 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
263 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 268 TravelingAgentInfo old = null;
269 TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old);
264 270
265 bool success = false; 271 bool success = false;
266 string myExternalIP = string.Empty; 272 string myExternalIP = string.Empty;
@@ -282,23 +288,21 @@ namespace OpenSim.Services.HypergridService
282 m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", 288 m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
283 agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); 289 agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);
284 290
285 // restore the old travel info 291 if (old != null)
286 lock (m_TravelingAgents) 292 StoreTravelInfo(old);
287 { 293 else
288 if (old == null) 294 m_Database.Delete(agentCircuit.SessionID);
289 m_TravelingAgents.Remove(agentCircuit.SessionID);
290 else
291 m_TravelingAgents[agentCircuit.SessionID] = old;
292 }
293 295
294 return false; 296 return false;
295 } 297 }
296 298
299 // Everything is ok
300
301 // Update the perceived IP Address of our grid
297 m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); 302 m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
298 // else set the IP addresses associated with this client 303 travel.MyIpAddress = myExternalIP;
299 if (fromLogin) 304
300 m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = agentCircuit.IPAddress; 305 StoreTravelInfo(travel);
301 m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;
302 306
303 return true; 307 return true;
304 } 308 }
@@ -309,57 +313,39 @@ namespace OpenSim.Services.HypergridService
309 return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, false, out reason); 313 return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, false, out reason);
310 } 314 }
311 315
312 private void SetClientIP(UUID sessionID, string ip) 316 TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing)
313 { 317 {
314 if (m_TravelingAgents.ContainsKey(sessionID)) 318 HGTravelingData hgt = m_Database.Get(agentCircuit.SessionID);
315 { 319 existing = null;
316 m_log.DebugFormat("[USER AGENT SERVICE]: Setting IP {0} for session {1}", ip, sessionID);
317 m_TravelingAgents[sessionID].ClientIPAddress = ip;
318 }
319 }
320 320
321 TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region) 321 if (hgt != null)
322 {
323 TravelingAgentInfo travel = new TravelingAgentInfo();
324 TravelingAgentInfo old = null;
325 lock (m_TravelingAgents)
326 { 322 {
327 if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID)) 323 // Very important! Override whatever this agent comes with.
328 { 324 // UserAgentService always sets the IP for every new agent
329 // Very important! Override whatever this agent comes with. 325 // with the original IP address.
330 // UserAgentService always sets the IP for every new agent 326 existing = new TravelingAgentInfo(hgt);
331 // with the original IP address. 327 agentCircuit.IPAddress = existing.ClientIPAddress;
332 agentCircuit.IPAddress = m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress;
333
334 old = m_TravelingAgents[agentCircuit.SessionID];
335 }
336
337 m_TravelingAgents[agentCircuit.SessionID] = travel;
338 } 328 }
329
330 TravelingAgentInfo travel = new TravelingAgentInfo(existing);
331 travel.SessionID = agentCircuit.SessionID;
339 travel.UserID = agentCircuit.AgentID; 332 travel.UserID = agentCircuit.AgentID;
340 travel.GridExternalName = region.ServerURI; 333 travel.GridExternalName = region.ServerURI;
341 travel.ServiceToken = agentCircuit.ServiceSessionID; 334 travel.ServiceToken = agentCircuit.ServiceSessionID;
342 if (old != null)
343 travel.ClientIPAddress = old.ClientIPAddress;
344 335
345 return old; 336 if (fromLogin)
337 travel.ClientIPAddress = agentCircuit.IPAddress;
338
339 StoreTravelInfo(travel);
340
341 return travel;
346 } 342 }
347 343
348 public void LogoutAgent(UUID userID, UUID sessionID) 344 public void LogoutAgent(UUID userID, UUID sessionID)
349 { 345 {
350 m_log.DebugFormat("[USER AGENT SERVICE]: User {0} logged out", userID); 346 m_log.DebugFormat("[USER AGENT SERVICE]: User {0} logged out", userID);
351 347
352 lock (m_TravelingAgents) 348 m_Database.Delete(sessionID);
353 {
354 List<UUID> travels = new List<UUID>();
355 foreach (KeyValuePair<UUID, TravelingAgentInfo> kvp in m_TravelingAgents)
356 if (kvp.Value == null) // do some clean up
357 travels.Add(kvp.Key);
358 else if (kvp.Value.UserID == userID)
359 travels.Add(kvp.Key);
360 foreach (UUID session in travels)
361 m_TravelingAgents.Remove(session);
362 }
363 349
364 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString()); 350 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
365 if (guinfo != null) 351 if (guinfo != null)
@@ -369,10 +355,11 @@ namespace OpenSim.Services.HypergridService
369 // We need to prevent foreign users with the same UUID as a local user 355 // We need to prevent foreign users with the same UUID as a local user
370 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) 356 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName)
371 { 357 {
372 if (!m_TravelingAgents.ContainsKey(sessionID)) 358 HGTravelingData hgt = m_Database.Get(sessionID);
359 if (hgt == null)
373 return false; 360 return false;
374 361
375 TravelingAgentInfo travel = m_TravelingAgents[sessionID]; 362 TravelingAgentInfo travel = new TravelingAgentInfo(hgt);
376 363
377 return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower(); 364 return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower();
378 } 365 }
@@ -385,31 +372,32 @@ namespace OpenSim.Services.HypergridService
385 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", 372 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.",
386 sessionID, reportedIP); 373 sessionID, reportedIP);
387 374
388 if (m_TravelingAgents.ContainsKey(sessionID)) 375 HGTravelingData hgt = m_Database.Get(sessionID);
389 { 376 if (hgt == null)
390 bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || 377 return false;
391 m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
392 378
393 m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}", 379 TravelingAgentInfo travel = new TravelingAgentInfo(hgt);
394 reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result);
395 380
396 return result; 381 bool result = travel.ClientIPAddress == reportedIP || travel.MyIpAddress == reportedIP; // NATed
397 } 382
383 m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}",
384 reportedIP, travel.ClientIPAddress, travel.MyIpAddress, result);
398 385
399 return false; 386 return result;
400 } 387 }
401 388
402 public bool VerifyAgent(UUID sessionID, string token) 389 public bool VerifyAgent(UUID sessionID, string token)
403 { 390 {
404 if (m_TravelingAgents.ContainsKey(sessionID)) 391 HGTravelingData hgt = m_Database.Get(sessionID);
392 if (hgt == null)
405 { 393 {
406 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, m_TravelingAgents[sessionID].ServiceToken); 394 m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID);
407 return m_TravelingAgents[sessionID].ServiceToken == token; 395 return false;
408 } 396 }
409 397
410 m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID); 398 TravelingAgentInfo travel = new TravelingAgentInfo(hgt);
411 399 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, travel.ServiceToken);
412 return false; 400 return travel.ServiceToken == token;
413 } 401 }
414 402
415 [Obsolete] 403 [Obsolete]
@@ -472,17 +460,17 @@ namespace OpenSim.Services.HypergridService
472 } 460 }
473 } 461 }
474 462
475 // Lastly, let's notify the rest who may be online somewhere else 463 //// Lastly, let's notify the rest who may be online somewhere else
476 foreach (string user in usersToBeNotified) 464 //foreach (string user in usersToBeNotified)
477 { 465 //{
478 UUID id = new UUID(user); 466 // UUID id = new UUID(user);
479 if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName) 467 // if (m_Database.ContainsKey(id) && m_Database[id].GridExternalName != m_GridName)
480 { 468 // {
481 string url = m_TravelingAgents[id].GridExternalName; 469 // string url = m_Database[id].GridExternalName;
482 // forward 470 // // forward
483 m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url); 471 // m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url);
484 } 472 // }
485 } 473 //}
486 474
487 // and finally, let's send the online friends 475 // and finally, let's send the online friends
488 if (online) 476 if (online)
@@ -609,16 +597,13 @@ namespace OpenSim.Services.HypergridService
609 597
610 public string LocateUser(UUID userID) 598 public string LocateUser(UUID userID)
611 { 599 {
612 foreach (TravelingAgentInfo t in m_TravelingAgents.Values) 600 HGTravelingData[] hgts = m_Database.GetSessions(userID);
613 { 601 if (hgts == null)
614 if (t == null) 602 return string.Empty;
615 { 603
616 m_log.ErrorFormat("[USER AGENT SERVICE]: Oops! Null TravelingAgentInfo. Please report this on mantis"); 604 foreach (HGTravelingData t in hgts)
617 continue; 605 if (t.Data.ContainsKey("GridExternalName") && !m_GridName.Equals(t.Data["GridExternalName"]))
618 } 606 return t.Data["GridExternalName"];
619 if (t.UserID == userID && !m_GridName.Equals(t.GridExternalName))
620 return t.GridExternalName;
621 }
622 607
623 return string.Empty; 608 return string.Empty;
624 } 609 }
@@ -689,17 +674,60 @@ namespace OpenSim.Services.HypergridService
689 return exception; 674 return exception;
690 } 675 }
691 676
677 private void StoreTravelInfo(TravelingAgentInfo travel)
678 {
679 if (travel == null)
680 return;
681
682 HGTravelingData hgt = new HGTravelingData();
683 hgt.SessionID = travel.SessionID;
684 hgt.UserID = travel.UserID;
685 hgt.Data = new Dictionary<string, string>();
686 hgt.Data["GridExternalName"] = travel.GridExternalName;
687 hgt.Data["ServiceToken"] = travel.ServiceToken;
688 hgt.Data["ClientIPAddress"] = travel.ClientIPAddress;
689 hgt.Data["MyIPAddress"] = travel.MyIpAddress;
690
691 m_Database.Store(hgt);
692 }
692 #endregion 693 #endregion
693 694
694 } 695 }
695 696
696 class TravelingAgentInfo 697 class TravelingAgentInfo
697 { 698 {
699 public UUID SessionID;
698 public UUID UserID; 700 public UUID UserID;
699 public string GridExternalName = string.Empty; 701 public string GridExternalName = string.Empty;
700 public string ServiceToken = string.Empty; 702 public string ServiceToken = string.Empty;
701 public string ClientIPAddress = string.Empty; // as seen from this user agent service 703 public string ClientIPAddress = string.Empty; // as seen from this user agent service
702 public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper 704 public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper
705
706 public TravelingAgentInfo(HGTravelingData t)
707 {
708 if (t.Data != null)
709 {
710 SessionID = new UUID(t.SessionID);
711 UserID = new UUID(t.UserID);
712 GridExternalName = t.Data["GridExternalName"];
713 ServiceToken = t.Data["ServiceToken"];
714 ClientIPAddress = t.Data["ClientIPAddress"];
715 MyIpAddress = t.Data["MyIPAddress"];
716 }
717 }
718
719 public TravelingAgentInfo(TravelingAgentInfo old)
720 {
721 if (old != null)
722 {
723 SessionID = old.SessionID;
724 UserID = old.UserID;
725 GridExternalName = old.GridExternalName;
726 ServiceToken = old.ServiceToken;
727 ClientIPAddress = old.ClientIPAddress;
728 MyIpAddress = old.MyIpAddress;
729 }
730 }
703 } 731 }
704 732
705} 733}
diff --git a/OpenSim/Services/HypergridService/UserAgentServiceBase.cs b/OpenSim/Services/HypergridService/UserAgentServiceBase.cs
new file mode 100644
index 0000000..a00e5a6
--- /dev/null
+++ b/OpenSim/Services/HypergridService/UserAgentServiceBase.cs
@@ -0,0 +1,84 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Data;
33using OpenSim.Services.Interfaces;
34using OpenSim.Services.Base;
35
36namespace OpenSim.Services.HypergridService
37{
38 public class UserAgentServiceBase : ServiceBase
39 {
40 protected IHGTravelingData m_Database = null;
41
42 public UserAgentServiceBase(IConfigSource config)
43 : base(config)
44 {
45 string dllName = String.Empty;
46 string connString = String.Empty;
47 string realm = "hg_traveling_data";
48
49 //
50 // Try reading the [DatabaseService] section, if it exists
51 //
52 IConfig dbConfig = config.Configs["DatabaseService"];
53 if (dbConfig != null)
54 {
55 if (dllName == String.Empty)
56 dllName = dbConfig.GetString("StorageProvider", String.Empty);
57 if (connString == String.Empty)
58 connString = dbConfig.GetString("ConnectionString", String.Empty);
59 }
60
61 //
62 // [UserAgentService] section overrides [DatabaseService], if it exists
63 //
64 IConfig gridConfig = config.Configs["UserAgentService"];
65 if (gridConfig != null)
66 {
67 dllName = gridConfig.GetString("StorageProvider", dllName);
68 connString = gridConfig.GetString("ConnectionString", connString);
69 realm = gridConfig.GetString("Realm", realm);
70 }
71
72 //
73 // We tried, but this doesn't exist. We can't proceed.
74 //
75 if (dllName.Equals(String.Empty))
76 throw new Exception("No StorageProvider configured");
77
78 m_Database = LoadPlugin<IHGTravelingData>(dllName, new Object[] { connString, realm });
79 if (m_Database == null)
80 throw new Exception("Could not find a storage interface in the given module");
81
82 }
83 }
84}
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index b10a85c..1c82b3e 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -75,8 +75,6 @@ namespace OpenSim.Services.Interfaces
75 /// <returns></returns> 75 /// <returns></returns>
76 bool UpdateAgent(GridRegion destination, AgentPosition data); 76 bool UpdateAgent(GridRegion destination, AgentPosition data);
77 77
78 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
79
80 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); 78 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason);
81 79
82 /// <summary> 80 /// <summary>
@@ -95,7 +93,7 @@ namespace OpenSim.Services.Interfaces
95 /// <param name="regionHandle"></param> 93 /// <param name="regionHandle"></param>
96 /// <param name="id"></param> 94 /// <param name="id"></param>
97 /// <returns></returns> 95 /// <returns></returns>
98 bool CloseAgent(GridRegion destination, UUID id); 96 bool CloseAgent(GridRegion destination, UUID id, string auth_token);
99 97
100 #endregion Agents 98 #endregion Agents
101 99
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index c660501..2fc3f0b 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -584,7 +584,7 @@ namespace OpenSim.Tests.Common.Mock
584 { 584 {
585 AgentCircuitData agentData = new AgentCircuitData(); 585 AgentCircuitData agentData = new AgentCircuitData();
586 agentData.AgentID = AgentId; 586 agentData.AgentID = AgentId;
587 agentData.SessionID = UUID.Zero; 587 agentData.SessionID = SessionId;
588 agentData.SecureSessionID = UUID.Zero; 588 agentData.SecureSessionID = UUID.Zero;
589 agentData.circuitcode = m_circuitCode; 589 agentData.circuitcode = m_circuitCode;
590 agentData.child = false; 590 agentData.child = false;
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 1c53935..4ddefba 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -955,6 +955,10 @@
955 ;; Enables the groups module 955 ;; Enables the groups module
956 ; Enabled = false 956 ; Enabled = false
957 957
958 ;# {LevelGroupCreate} {Enabled:true} {User level for creating groups} {} 0
959 ;; Minimum user level required to create groups
960 ;LevelGroupCreate = 0
961
958 ;# {Module} {Enabled:true} {Groups module to use? (Use GroupsModule to use Flotsam/Simian)} {Default "Groups Module V2"} Default 962 ;# {Module} {Enabled:true} {Groups module to use? (Use GroupsModule to use Flotsam/Simian)} {Default "Groups Module V2"} Default
959 ;; The default module can use a PHP XmlRpc server from the Flotsam project at 963 ;; The default module can use a PHP XmlRpc server from the Flotsam project at
960 ;; http://code.google.com/p/flotsam/ 964 ;; http://code.google.com/p/flotsam/