diff options
author | Diva Canto | 2012-09-25 20:03:49 -0700 |
---|---|---|
committer | Diva Canto | 2012-09-25 20:03:49 -0700 |
commit | ae58cf42242433c786162b53a2724962f4a8380b (patch) | |
tree | b6011d3ea34e838138a63279ec5bf270c464d04d /OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs | |
parent | Oops, that should be inside the curly bracket. (diff) | |
download | opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.zip opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.gz opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.bz2 opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.xz |
TOS module. WARNING: migration in GridUser table.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs index badb552..04acf67 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs | |||
@@ -44,6 +44,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private const int KEEPTIME = 30; // 30 secs | ||
48 | private ExpiringCache<string, GridUserInfo> m_Infos = new ExpiringCache<string, GridUserInfo>(); | ||
49 | |||
47 | #region ISharedRegionModule | 50 | #region ISharedRegionModule |
48 | 51 | ||
49 | private bool m_Enabled = false; | 52 | private bool m_Enabled = false; |
@@ -128,23 +131,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
128 | 131 | ||
129 | public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat) | 132 | public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat) |
130 | { | 133 | { |
134 | if (m_Infos.Contains(userID)) | ||
135 | m_Infos.Remove(userID); | ||
136 | |||
131 | return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat); | 137 | return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat); |
132 | } | 138 | } |
133 | 139 | ||
134 | 140 | ||
135 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | 141 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) |
136 | { | 142 | { |
137 | return m_RemoteConnector.SetHome(userID, regionID, position, lookAt); | 143 | if (m_RemoteConnector.SetHome(userID, regionID, position, lookAt)) |
144 | { | ||
145 | // Update the cache too | ||
146 | GridUserInfo info = null; | ||
147 | if (m_Infos.TryGetValue(userID, out info)) | ||
148 | { | ||
149 | info.HomeRegionID = regionID; | ||
150 | info.HomePosition = position; | ||
151 | info.HomeLookAt = lookAt; | ||
152 | } | ||
153 | return true; | ||
154 | } | ||
155 | |||
156 | return false; | ||
138 | } | 157 | } |
139 | 158 | ||
140 | public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | 159 | public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) |
141 | { | 160 | { |
142 | return m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt); | 161 | if (m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt)) |
162 | { | ||
163 | // Update the cache too | ||
164 | GridUserInfo info = null; | ||
165 | if (m_Infos.TryGetValue(userID, out info)) | ||
166 | { | ||
167 | info.LastRegionID = regionID; | ||
168 | info.LastPosition = position; | ||
169 | info.LastLookAt = lookAt; | ||
170 | } | ||
171 | return true; | ||
172 | } | ||
173 | |||
174 | return false; | ||
143 | } | 175 | } |
144 | 176 | ||
145 | public GridUserInfo GetGridUserInfo(string userID) | 177 | public GridUserInfo GetGridUserInfo(string userID) |
146 | { | 178 | { |
147 | return m_RemoteConnector.GetGridUserInfo(userID); | 179 | GridUserInfo info = null; |
180 | if (m_Infos.TryGetValue(userID, out info)) | ||
181 | return info; | ||
182 | |||
183 | info = m_RemoteConnector.GetGridUserInfo(userID); | ||
184 | |||
185 | m_Infos.AddOrUpdate(userID, info, KEEPTIME); | ||
186 | |||
187 | return info; | ||
148 | } | 188 | } |
149 | 189 | ||
150 | public GridUserInfo[] GetGridUserInfo(string[] userID) | 190 | public GridUserInfo[] GetGridUserInfo(string[] userID) |