aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-08-01 18:49:48 +0000
committerJustin Clarke Casey2008-08-01 18:49:48 +0000
commit43b2ff1d112174c36bb18caf353945afc6390840 (patch)
tree2da70a8856c417dcfb66f75fb38a4bde2b73c57f
parent* minor: eliminate some unused variables in InventoryFolderImpl (diff)
downloadopensim-SC_OLD-43b2ff1d112174c36bb18caf353945afc6390840.zip
opensim-SC_OLD-43b2ff1d112174c36bb18caf353945afc6390840.tar.gz
opensim-SC_OLD-43b2ff1d112174c36bb18caf353945afc6390840.tar.bz2
opensim-SC_OLD-43b2ff1d112174c36bb18caf353945afc6390840.tar.xz
* Drop cached inventory from the local region when a user crosses out into a remote region
* May resolves inventory problems that occur when the user moves between two regions` * e.g. if the user moves to a second region, adds an inventory item, moves back to the original region then tries to manipulate that item * Not yet implemented for teleport
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs17
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs12
-rw-r--r--OpenSim/Framework/RegionInfo.cs42
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs39
7 files changed, 83 insertions, 38 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 025b934..d85eda0 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Framework.Communications.Cache
75 private readonly IList<IInventoryRequest> m_pendingRequests = new List<IInventoryRequest>(); 75 private readonly IList<IInventoryRequest> m_pendingRequests = new List<IInventoryRequest>();
76 76
77 /// <summary> 77 /// <summary>
78 /// The root folder of this user's inventory. Returns null if the inventory has not yet been received. 78 /// The root folder of this user's inventory. Returns null if the root folder has not yet been received.
79 /// </summary> 79 /// </summary>
80 public InventoryFolderImpl RootFolder { get { return m_rootFolder; } } 80 public InventoryFolderImpl RootFolder { get { return m_rootFolder; } }
81 private InventoryFolderImpl m_rootFolder; 81 private InventoryFolderImpl m_rootFolder;
@@ -183,6 +183,21 @@ namespace OpenSim.Framework.Communications.Cache
183 } 183 }
184 } 184 }
185 } 185 }
186
187 /// <summary>
188 /// Drop all cached inventory.
189 /// </summary>
190 public void DropInventory()
191 {
192 // Make sure there aren't pending requests around when we do this
193 // FIXME: There is still a race condition where an inventory operation can be requested (since these aren't being locked).
194 // Will have to extend locking to exclude this very soon.
195 lock (m_pendingRequests)
196 {
197 m_hasReceivedInventory = false;
198 m_rootFolder = null;
199 }
200 }
186 201
187 /// <summary> 202 /// <summary>
188 /// Callback invoked when the inventory is received from an async request to the inventory service 203 /// Callback invoked when the inventory is received from an async request to the inventory service
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index ac52535..5045c97 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -118,21 +118,19 @@ namespace OpenSim.Framework.Communications.Cache
118 /// </summary> 118 /// </summary>
119 /// <param name="userID"></param> 119 /// <param name="userID"></param>
120 /// <returns>true if the user was successfully removed, false otherwise</returns> 120 /// <returns>true if the user was successfully removed, false otherwise</returns>
121 public bool RemoveUser(LLUUID userID) 121 public bool RemoveUser(LLUUID userId)
122 { 122 {
123 lock (m_userProfiles) 123 lock (m_userProfiles)
124 { 124 {
125 if (m_userProfiles.ContainsKey(userID)) 125 if (m_userProfiles.ContainsKey(userId))
126 { 126 {
127 m_userProfiles.Remove(userID); 127 m_log.DebugFormat("[USER CACHE]: Removing user {0}", userId);
128 m_userProfiles.Remove(userId);
128 return true; 129 return true;
129 } 130 }
130 else
131 {
132 m_log.ErrorFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userID);
133 }
134 } 131 }
135 132
133 m_log.ErrorFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userId);
136 return false; 134 return false;
137 } 135 }
138 136
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index ee64bf2..1d9d9ec 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -41,20 +41,34 @@ namespace OpenSim.Framework
41 // private static readonly log4net.ILog m_log 41 // private static readonly log4net.ILog m_log
42 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 42 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 protected bool Allow_Alternate_Ports; 44 /// <summary>
45 public bool m_allow_alternate_ports;
46 protected string m_externalHostName;
47
48 /// <value>
49 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 45 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
50 /// </value> 46 /// </summary>
47 public uint HttpPort
48 {
49 get { return m_httpPort; }
50 set { m_httpPort = value; }
51 }
51 protected uint m_httpPort; 52 protected uint m_httpPort;
53
54 /// <summary>
55 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
56 /// </summary>
57 public string ServerURI
58 {
59 get { return m_serverURI; }
60 set { m_serverURI = value; }
61 }
62 protected string m_serverURI;
52 63
64 protected bool Allow_Alternate_Ports;
65 public bool m_allow_alternate_ports;
66 protected string m_externalHostName;
67
53 protected IPEndPoint m_internalEndPoint; 68 protected IPEndPoint m_internalEndPoint;
54 protected uint? m_regionLocX; 69 protected uint? m_regionLocX;
55 protected uint? m_regionLocY; 70 protected uint? m_regionLocY;
56 protected uint m_remotingPort; 71 protected uint m_remotingPort;
57 protected string m_serverURI;
58 public LLUUID RegionID = LLUUID.Zero; 72 public LLUUID RegionID = LLUUID.Zero;
59 public string RemotingAddress; 73 public string RemotingAddress;
60 74
@@ -101,18 +115,6 @@ namespace OpenSim.Framework
101 set { m_remotingPort = value; } 115 set { m_remotingPort = value; }
102 } 116 }
103 117
104 public uint HttpPort
105 {
106 get { return m_httpPort; }
107 set { m_httpPort = value; }
108 }
109
110 public string ServerURI
111 {
112 get { return m_serverURI; }
113 set { m_serverURI = value; }
114 }
115
116 /// <value> 118 /// <value>
117 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. 119 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
118 /// 120 ///
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index f8b4ccb..eba49e4 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -195,7 +195,7 @@ namespace OpenSim.Framework.Servers
195 string path = request.RawUrl; 195 string path = request.RawUrl;
196 string handlerKey = GetHandlerKey(request.HttpMethod, path); 196 string handlerKey = GetHandlerKey(request.HttpMethod, path);
197 197
198 // m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 198 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
199 199
200 if (TryGetStreamHandler(handlerKey, out requestHandler)) 200 if (TryGetStreamHandler(handlerKey, out requestHandler))
201 { 201 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index c4078c9..f81248b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1976,7 +1976,7 @@ namespace OpenSim.Region.Environment.Scenes
1976 #region Add/Remove Avatar Methods 1976 #region Add/Remove Avatar Methods
1977 1977
1978 /// <summary> 1978 /// <summary>
1979 /// 1979 /// Register the new client with the scene
1980 /// </summary> 1980 /// </summary>
1981 /// <param name="client"></param 1981 /// <param name="client"></param
1982 /// <param name="child"></param> 1982 /// <param name="child"></param>
@@ -1991,7 +1991,7 @@ namespace OpenSim.Region.Environment.Scenes
1991 1991
1992 if (m_restorePresences.ContainsKey(client.AgentId)) 1992 if (m_restorePresences.ContainsKey(client.AgentId))
1993 { 1993 {
1994 m_log.Info("[REGION]: Restore Scene Presence"); 1994 m_log.Info("[REGION]: Restoring Scene Presence");
1995 1995
1996 presence = m_restorePresences[client.AgentId]; 1996 presence = m_restorePresences[client.AgentId];
1997 m_restorePresences.Remove(client.AgentId); 1997 m_restorePresences.Remove(client.AgentId);
@@ -2015,9 +2015,8 @@ namespace OpenSim.Region.Environment.Scenes
2015 } 2015 }
2016 else 2016 else
2017 { 2017 {
2018 m_log.Info("[REGION]: Add New Scene Presence"); 2018 m_log.Info("[REGION]: Adding New Scene Presence");
2019 2019
2020 //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2021 CommsManager.UserProfileCacheService.AddNewUser(client); 2020 CommsManager.UserProfileCacheService.AddNewUser(client);
2022 2021
2023 CreateAndAddScenePresence(client, child); 2022 CreateAndAddScenePresence(client, child);
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index b9bf42b..b35e60f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -557,8 +557,10 @@ namespace OpenSim.Region.Environment.Scenes
557 LLVector3 lookAt, uint flags) 557 LLVector3 lookAt, uint flags)
558 { 558 {
559 bool destRegionUp = false; 559 bool destRegionUp = false;
560
560 if (regionHandle == m_regionInfo.RegionHandle) 561 if (regionHandle == m_regionInfo.RegionHandle)
561 { 562 {
563 // Teleport within the same region
562 avatar.ControllingClient.SendTeleportLocationStart(); 564 avatar.ControllingClient.SendTeleportLocationStart();
563 avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags); 565 avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags);
564 avatar.Teleport(position); 566 avatar.Teleport(position);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 221da0e..bb3d953 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -35,6 +35,7 @@ using libsecondlife;
35using libsecondlife.Packets; 35using libsecondlife.Packets;
36using log4net; 36using log4net;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache;
38using OpenSim.Region.Environment.Types; 39using OpenSim.Region.Environment.Types;
39using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
40 41
@@ -646,7 +647,7 @@ namespace OpenSim.Region.Environment.Scenes
646 /// when an agent departs this region for a neighbor, this gets called. 647 /// when an agent departs this region for a neighbor, this gets called.
647 /// 648 ///
648 /// It doesn't get called for a teleport. Reason being, an agent that 649 /// It doesn't get called for a teleport. Reason being, an agent that
649 /// teleports out may not be anywhere near this region 650 /// teleports out may not end up anywhere near this region
650 /// </summary> 651 /// </summary>
651 public void MakeChildAgent() 652 public void MakeChildAgent()
652 { 653 {
@@ -1877,6 +1878,7 @@ namespace OpenSim.Region.Environment.Scenes
1877 { 1878 {
1878 if (IsChildAgent) 1879 if (IsChildAgent)
1879 return; 1880 return;
1881
1880 LLVector3 pos2 = AbsolutePosition; 1882 LLVector3 pos2 = AbsolutePosition;
1881 LLVector3 vel = Velocity; 1883 LLVector3 vel = Velocity;
1882 1884
@@ -1947,10 +1949,30 @@ namespace OpenSim.Region.Environment.Scenes
1947 // in case both scenes are being hosted on the same region server. Messy 1949 // in case both scenes are being hosted on the same region server. Messy
1948 m_scene.RemoveCapsHandler(UUID); 1950 m_scene.RemoveCapsHandler(UUID);
1949 newpos = newpos + (vel); 1951 newpos = newpos + (vel);
1950 bool res = 1952
1953 bool crossingToRemoteRegion = neighbourRegion.ExternalHostName != m_scene.RegionInfo.ExternalHostName;
1954 if (crossingToRemoteRegion)
1955 {
1956 m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID);
1957 }
1958 else
1959 {
1960 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(UUID);
1961
1962 if (userInfo != null)
1963 {
1964 userInfo.DropInventory();
1965 }
1966 else
1967 {
1968 m_log.WarnFormat("[SCENE PRESENCE]: No cached user info found for {0} {1} on leaving region", Name, UUID);
1969 }
1970 }
1971
1972 bool crossingSuccessful =
1951 m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, 1973 m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos,
1952 m_physicsActor.Flying); 1974 m_physicsActor.Flying);
1953 if (res) 1975 if (crossingSuccessful)
1954 { 1976 {
1955 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); 1977 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
1956 1978
@@ -1965,12 +1987,19 @@ namespace OpenSim.Region.Environment.Scenes
1965 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, 1987 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
1966 capsPath); 1988 capsPath);
1967 MakeChildAgent(); 1989 MakeChildAgent();
1968 CrossAttachmentsIntoNewRegion(neighbourHandle); 1990 CrossAttachmentsIntoNewRegion(neighbourHandle);
1991
1969 m_scene.SendKillObject(m_localId); 1992 m_scene.SendKillObject(m_localId);
1970 m_scene.NotifyMyCoarseLocationChange(); 1993 m_scene.NotifyMyCoarseLocationChange();
1971 } 1994 }
1972 else 1995 else
1973 { 1996 {
1997 // Restore the user structures that we needed to delete before asking the receiving region to complete the crossing
1998 if (crossingToRemoteRegion)
1999 m_scene.CommsManager.UserProfileCacheService.AddNewUser(m_controllingClient);
2000
2001 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(UUID);
2002
1974 m_scene.AddCapsHandler(UUID); 2003 m_scene.AddCapsHandler(UUID);
1975 } 2004 }
1976 } 2005 }