diff options
author | Melanie | 2013-07-18 10:08:10 +0100 |
---|---|---|
committer | Melanie | 2013-07-18 10:08:10 +0100 |
commit | 7830cc995471120892a24a39e86283774fa07c4c (patch) | |
tree | d3f46b4f3ce95bb8572511c6f12c9f8ca86922c8 /OpenSim/Services | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Document obscure Groups config related to the user level required for creatin... (diff) | |
download | opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.zip opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.tar.gz opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.tar.bz2 opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/Framework/Scenes/ScenePresence.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
OpenSim/Services/HypergridService/UserAgentService.cs
Diffstat (limited to 'OpenSim/Services')
10 files changed, 244 insertions, 168 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 4b502b7..3e06cf0 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -66,6 +66,12 @@ namespace OpenSim.Services.Connectors | |||
66 | 66 | ||
67 | private Thread[] m_fetchThreads; | 67 | private Thread[] m_fetchThreads; |
68 | 68 | ||
69 | public int MaxAssetRequestConcurrency | ||
70 | { | ||
71 | get { return m_maxAssetRequestConcurrency; } | ||
72 | set { m_maxAssetRequestConcurrency = value; } | ||
73 | } | ||
74 | |||
69 | public AssetServicesConnector() | 75 | public AssetServicesConnector() |
70 | { | 76 | { |
71 | } | 77 | } |
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/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 7bb06fb..01163aa 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
65 | public void PostInitialise() { } | 65 | public void PostInitialise() { } |
66 | public void Close() { } | 66 | public void Close() { } |
67 | 67 | ||
68 | public SimianPresenceServiceConnector() { m_activityDetector = new SimianActivityDetector(this); } | 68 | public SimianPresenceServiceConnector() { } |
69 | public string Name { get { return "SimianPresenceServiceConnector"; } } | 69 | public string Name { get { return "SimianPresenceServiceConnector"; } } |
70 | public void AddRegion(Scene scene) | 70 | public void AddRegion(Scene scene) |
71 | { | 71 | { |
@@ -121,6 +121,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
121 | if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) | 121 | if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) |
122 | serviceUrl = serviceUrl + '/'; | 122 | serviceUrl = serviceUrl + '/'; |
123 | m_serverUrl = serviceUrl; | 123 | m_serverUrl = serviceUrl; |
124 | m_activityDetector = new SimianActivityDetector(this); | ||
124 | m_Enabled = true; | 125 | m_Enabled = true; |
125 | } | 126 | } |
126 | } | 127 | } |
@@ -314,11 +315,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
314 | 315 | ||
315 | UUID userID = new UUID(user); | 316 | UUID userID = new UUID(user); |
316 | OSDMap userResponse = GetUserData(userID); | 317 | OSDMap userResponse = GetUserData(userID); |
317 | if (userResponse != null) | ||
318 | return ResponseToGridUserInfo(userResponse); | ||
319 | 318 | ||
320 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID,userResponse["Message"].AsString()); | 319 | if (userResponse == null) |
321 | return null; | 320 | { |
321 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}", userID); | ||
322 | } | ||
323 | |||
324 | // Note that ResponseToGridUserInfo properly checks for and returns a null if passed a null. | ||
325 | return ResponseToGridUserInfo(userResponse); | ||
326 | |||
322 | } | 327 | } |
323 | 328 | ||
324 | #endregion | 329 | #endregion |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index da77719..0e74073 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -272,41 +272,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
272 | return false; | 272 | return false; |
273 | } | 273 | } |
274 | 274 | ||
275 | /// <summary> | ||
276 | /// Not sure what sequence causes this function to be invoked. The only calling | ||
277 | /// path is through the GET method | ||
278 | /// </summary> | ||
279 | public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) | ||
280 | { | ||
281 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: RetrieveAgent start"); | ||
282 | |||
283 | agent = null; | ||
284 | |||
285 | // Eventually, we want to use a caps url instead of the agentID | ||
286 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
287 | |||
288 | try | ||
289 | { | ||
290 | OSDMap result = WebUtil.GetFromService(uri, 10000); | ||
291 | if (result["Success"].AsBoolean()) | ||
292 | { | ||
293 | // OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString()); | ||
294 | OSDMap args = (OSDMap)result["_Result"]; | ||
295 | if (args != null) | ||
296 | { | ||
297 | agent = new CompleteAgentData(); | ||
298 | agent.Unpack(args, null); | ||
299 | return true; | ||
300 | } | ||
301 | } | ||
302 | } | ||
303 | catch (Exception e) | ||
304 | { | ||
305 | m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString()); | ||
306 | } | ||
307 | |||
308 | return false; | ||
309 | } | ||
310 | 275 | ||
311 | /// <summary> | 276 | /// <summary> |
312 | /// </summary> | 277 | /// </summary> |
@@ -405,35 +370,25 @@ namespace OpenSim.Services.Connectors.Simulation | |||
405 | return true; | 370 | return true; |
406 | } | 371 | } |
407 | 372 | ||
408 | private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) | 373 | /// <summary> |
374 | /// </summary> | ||
375 | public bool CloseAgent(GridRegion destination, UUID id, string auth_code) | ||
409 | { | 376 | { |
410 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); | 377 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/?auth=" + auth_code; |
411 | Util.FireAndForget(x => { | 378 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent {0}", uri); |
412 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
413 | 379 | ||
414 | try | 380 | try |
415 | { | 381 | { |
416 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); | 382 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); |
417 | } | 383 | } |
418 | catch (Exception e) | 384 | catch (Exception e) |
419 | { | 385 | { |
420 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); | 386 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); |
421 | } | 387 | } |
422 | }); | ||
423 | 388 | ||
424 | return true; | 389 | return true; |
425 | } | 390 | } |
426 | 391 | ||
427 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
428 | { | ||
429 | return CloseAgent(destination, id, true); | ||
430 | } | ||
431 | |||
432 | public bool CloseAgent(GridRegion destination, UUID id) | ||
433 | { | ||
434 | return CloseAgent(destination, id, false); | ||
435 | } | ||
436 | |||
437 | #endregion Agents | 392 | #endregion Agents |
438 | 393 | ||
439 | #region Objects | 394 | #region Objects |
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/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 410916f..2567c8f 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Services.HypergridService | |||
54 | LogManager.GetLogger( | 54 | LogManager.GetLogger( |
55 | MethodBase.GetCurrentMethod().DeclaringType); | 55 | MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
57 | private string m_HomeURL; | 57 | // private string m_HomeURL; |
58 | private IUserAccountService m_UserAccountService; | 58 | private IUserAccountService m_UserAccountService; |
59 | private IAvatarService m_AvatarService; | 59 | private IAvatarService m_AvatarService; |
60 | 60 | ||
@@ -96,8 +96,8 @@ namespace OpenSim.Services.HypergridService | |||
96 | if (m_AvatarService == null) | 96 | if (m_AvatarService == null) |
97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); | 97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); |
98 | 98 | ||
99 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", | 99 | // m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
100 | new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); | 100 | // new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); |
101 | 101 | ||
102 | // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 102 | // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
103 | } | 103 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index a6b5fc2..b414aca 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | 32 | ||
33 | using OpenSim.Data; | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Services.Connectors.Friends; | 35 | using OpenSim.Services.Connectors.Friends; |
35 | using OpenSim.Services.Connectors.Hypergrid; | 36 | using 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,29 +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 | m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}", | 377 | return false; |
391 | m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress); | ||
392 | 378 | ||
393 | return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || | 379 | TravelingAgentInfo travel = new TravelingAgentInfo(hgt); |
394 | m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed | ||
395 | } | ||
396 | 380 | ||
397 | return false; | 381 | bool result = travel.ClientIPAddress == reportedIP || travel.MyIpAddress == reportedIP; // NATed |
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); | ||
385 | |||
386 | return result; | ||
398 | } | 387 | } |
399 | 388 | ||
400 | public bool VerifyAgent(UUID sessionID, string token) | 389 | public bool VerifyAgent(UUID sessionID, string token) |
401 | { | 390 | { |
402 | if (m_TravelingAgents.ContainsKey(sessionID)) | 391 | HGTravelingData hgt = m_Database.Get(sessionID); |
392 | if (hgt == null) | ||
403 | { | 393 | { |
404 | 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); |
405 | return m_TravelingAgents[sessionID].ServiceToken == token; | 395 | return false; |
406 | } | 396 | } |
407 | 397 | ||
408 | m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID); | 398 | TravelingAgentInfo travel = new TravelingAgentInfo(hgt); |
409 | 399 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, travel.ServiceToken); | |
410 | return false; | 400 | return travel.ServiceToken == token; |
411 | } | 401 | } |
412 | 402 | ||
413 | [Obsolete] | 403 | [Obsolete] |
@@ -470,17 +460,17 @@ namespace OpenSim.Services.HypergridService | |||
470 | } | 460 | } |
471 | } | 461 | } |
472 | 462 | ||
473 | // 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 |
474 | foreach (string user in usersToBeNotified) | 464 | //foreach (string user in usersToBeNotified) |
475 | { | 465 | //{ |
476 | UUID id = new UUID(user); | 466 | // UUID id = new UUID(user); |
477 | if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName) | 467 | // if (m_Database.ContainsKey(id) && m_Database[id].GridExternalName != m_GridName) |
478 | { | 468 | // { |
479 | string url = m_TravelingAgents[id].GridExternalName; | 469 | // string url = m_Database[id].GridExternalName; |
480 | // forward | 470 | // // forward |
481 | 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); |
482 | } | 472 | // } |
483 | } | 473 | //} |
484 | 474 | ||
485 | // and finally, let's send the online friends | 475 | // and finally, let's send the online friends |
486 | if (online) | 476 | if (online) |
@@ -607,16 +597,13 @@ namespace OpenSim.Services.HypergridService | |||
607 | 597 | ||
608 | public string LocateUser(UUID userID) | 598 | public string LocateUser(UUID userID) |
609 | { | 599 | { |
610 | foreach (TravelingAgentInfo t in m_TravelingAgents.Values) | 600 | HGTravelingData[] hgts = m_Database.GetSessions(userID); |
611 | { | 601 | if (hgts == null) |
612 | if (t == null) | 602 | return string.Empty; |
613 | { | 603 | |
614 | m_log.ErrorFormat("[USER AGENT SERVICE]: Oops! Null TravelingAgentInfo. Please report this on mantis"); | 604 | foreach (HGTravelingData t in hgts) |
615 | continue; | 605 | if (t.Data.ContainsKey("GridExternalName") && !m_GridName.Equals(t.Data["GridExternalName"])) |
616 | } | 606 | return t.Data["GridExternalName"]; |
617 | if (t.UserID == userID && !m_GridName.Equals(t.GridExternalName)) | ||
618 | return t.GridExternalName; | ||
619 | } | ||
620 | 607 | ||
621 | return string.Empty; | 608 | return string.Empty; |
622 | } | 609 | } |
@@ -687,17 +674,60 @@ namespace OpenSim.Services.HypergridService | |||
687 | return exception; | 674 | return exception; |
688 | } | 675 | } |
689 | 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 | } | ||
690 | #endregion | 693 | #endregion |
691 | 694 | ||
692 | } | 695 | } |
693 | 696 | ||
694 | class TravelingAgentInfo | 697 | class TravelingAgentInfo |
695 | { | 698 | { |
699 | public UUID SessionID; | ||
696 | public UUID UserID; | 700 | public UUID UserID; |
697 | public string GridExternalName = string.Empty; | 701 | public string GridExternalName = string.Empty; |
698 | public string ServiceToken = string.Empty; | 702 | public string ServiceToken = string.Empty; |
699 | 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 |
700 | 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 | } | ||
701 | } | 731 | } |
702 | 732 | ||
703 | } | 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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Services.Base; | ||
35 | |||
36 | namespace 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 a963b8e..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> |
@@ -90,20 +88,12 @@ namespace OpenSim.Services.Interfaces | |||
90 | bool ReleaseAgent(UUID originRegion, UUID id, string uri); | 88 | bool ReleaseAgent(UUID originRegion, UUID id, string uri); |
91 | 89 | ||
92 | /// <summary> | 90 | /// <summary> |
93 | /// Close child agent. | ||
94 | /// </summary> | ||
95 | /// <param name="regionHandle"></param> | ||
96 | /// <param name="id"></param> | ||
97 | /// <returns></returns> | ||
98 | bool CloseChildAgent(GridRegion destination, UUID id); | ||
99 | |||
100 | /// <summary> | ||
101 | /// Close agent. | 91 | /// Close agent. |
102 | /// </summary> | 92 | /// </summary> |
103 | /// <param name="regionHandle"></param> | 93 | /// <param name="regionHandle"></param> |
104 | /// <param name="id"></param> | 94 | /// <param name="id"></param> |
105 | /// <returns></returns> | 95 | /// <returns></returns> |
106 | bool CloseAgent(GridRegion destination, UUID id); | 96 | bool CloseAgent(GridRegion destination, UUID id, string auth_token); |
107 | 97 | ||
108 | #endregion Agents | 98 | #endregion Agents |
109 | 99 | ||
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index fa9a4a8..b1cdd45 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Services.UserAccountService | |||
156 | 156 | ||
157 | public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) | 157 | public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) |
158 | { | 158 | { |
159 | //m_log.DebugFormat("[Grid User Service]: SetLastPosition for {0}", userID); | 159 | m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID); |
160 | GridUserData d = m_Database.Get(userID); | 160 | GridUserData d = m_Database.Get(userID); |
161 | if (d == null) | 161 | if (d == null) |
162 | { | 162 | { |