aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-01-13 18:30:33 -0800
committerDiva Canto2010-01-13 18:30:33 -0800
commit283ff593b127bea95f276b430a3e6bf43b9a1625 (patch)
tree2ddcd442c96fa4052169a35c638fda193ddc5cbf /OpenSim
parentMake region flag specs work for regions whose names contain spaces. Uses unde... (diff)
downloadopensim-SC_OLD-283ff593b127bea95f276b430a3e6bf43b9a1625.zip
opensim-SC_OLD-283ff593b127bea95f276b430a3e6bf43b9a1625.tar.gz
opensim-SC_OLD-283ff593b127bea95f276b430a3e6bf43b9a1625.tar.bz2
opensim-SC_OLD-283ff593b127bea95f276b430a3e6bf43b9a1625.tar.xz
Make use of Fallback regions when the desired start region is having problems.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs59
1 files changed, 43 insertions, 16 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 269bb46..b0e36f1 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -108,7 +108,9 @@ namespace OpenSim.Services.LLLoginService
108 108
109 try 109 try
110 { 110 {
111 //
111 // Get the account and check that it exists 112 // Get the account and check that it exists
113 //
112 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); 114 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
113 if (account == null) 115 if (account == null)
114 { 116 {
@@ -122,7 +124,9 @@ namespace OpenSim.Services.LLLoginService
122 return LLFailedLoginResponse.LoginBlockedProblem; 124 return LLFailedLoginResponse.LoginBlockedProblem;
123 } 125 }
124 126
127 //
125 // Authenticate this user 128 // Authenticate this user
129 //
126 if (!passwd.StartsWith("$1$")) 130 if (!passwd.StartsWith("$1$"))
127 passwd = "$1$" + Util.Md5Hash(passwd); 131 passwd = "$1$" + Util.Md5Hash(passwd);
128 passwd = passwd.Remove(0, 3); //remove $1$ 132 passwd = passwd.Remove(0, 3); //remove $1$
@@ -134,7 +138,9 @@ namespace OpenSim.Services.LLLoginService
134 return LLFailedLoginResponse.UserProblem; 138 return LLFailedLoginResponse.UserProblem;
135 } 139 }
136 140
141 //
137 // Get the user's inventory 142 // Get the user's inventory
143 //
138 if (m_RequireInventory && m_InventoryService == null) 144 if (m_RequireInventory && m_InventoryService == null)
139 { 145 {
140 m_log.WarnFormat("[LLOGIN SERVICE]: Login failed, reason: inventory service not set up"); 146 m_log.WarnFormat("[LLOGIN SERVICE]: Login failed, reason: inventory service not set up");
@@ -147,9 +153,9 @@ namespace OpenSim.Services.LLLoginService
147 return LLFailedLoginResponse.InventoryProblem; 153 return LLFailedLoginResponse.InventoryProblem;
148 } 154 }
149 155
156 //
150 // Login the presence 157 // Login the presence
151 // We may want to check for user already logged in, to 158 //
152 // stay compatible with what people expect...
153 PresenceInfo presence = null; 159 PresenceInfo presence = null;
154 GridRegion home = null; 160 GridRegion home = null;
155 if (m_PresenceService != null) 161 if (m_PresenceService != null)
@@ -171,7 +177,9 @@ namespace OpenSim.Services.LLLoginService
171 } 177 }
172 } 178 }
173 179
180 //
174 // Find the destination region/grid 181 // Find the destination region/grid
182 //
175 string where = string.Empty; 183 string where = string.Empty;
176 Vector3 position = Vector3.Zero; 184 Vector3 position = Vector3.Zero;
177 Vector3 lookAt = Vector3.Zero; 185 Vector3 lookAt = Vector3.Zero;
@@ -183,14 +191,18 @@ namespace OpenSim.Services.LLLoginService
183 return LLFailedLoginResponse.GridProblem; 191 return LLFailedLoginResponse.GridProblem;
184 } 192 }
185 193
194 //
186 // Get the avatar 195 // Get the avatar
196 //
187 AvatarData avatar = null; 197 AvatarData avatar = null;
188 if (m_AvatarService != null) 198 if (m_AvatarService != null)
189 { 199 {
190 avatar = m_AvatarService.GetAvatar(account.PrincipalID); 200 avatar = m_AvatarService.GetAvatar(account.PrincipalID);
191 } 201 }
192 202
203 //
193 // Instantiate/get the simulation interface and launch an agent at the destination 204 // Instantiate/get the simulation interface and launch an agent at the destination
205 //
194 ISimulationService simConnector = null; 206 ISimulationService simConnector = null;
195 string reason = string.Empty; 207 string reason = string.Empty;
196 uint circuitCode = 0; 208 uint circuitCode = 0;
@@ -210,14 +222,36 @@ namespace OpenSim.Services.LLLoginService
210 } 222 }
211 if (aCircuit == null) 223 if (aCircuit == null)
212 { 224 {
213 m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); 225 // Try the fallback regions
214 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason); 226 List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
215 return LLFailedLoginResponse.AuthorizationProblem; 227 if (fallbacks != null)
228 {
229 foreach (GridRegion r in fallbacks)
230 {
231 aCircuit = LaunchAgent(simConnector, r, account, avatar, session, secureSession, circuitCode, position, out reason);
232 if (aCircuit != null)
233 {
234 where = "safe";
235 destination = r;
236 break;
237 }
238 }
239 }
240
241 if (aCircuit == null)
242 {
243 // we tried...
244 m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt);
245 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason);
246 return LLFailedLoginResponse.AuthorizationProblem;
247 }
216 } 248 }
217 249
218 // TODO: Get Friends list... 250 // TODO: Get Friends list...
219 251
252 //
220 // Finally, fill out the response and return it 253 // Finally, fill out the response and return it
254 //
221 LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, m_LibraryService, 255 LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, m_LibraryService,
222 where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP); 256 where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP);
223 257
@@ -239,12 +273,13 @@ namespace OpenSim.Services.LLLoginService
239 where = "home"; 273 where = "home";
240 position = new Vector3(128, 128, 0); 274 position = new Vector3(128, 128, 0);
241 lookAt = new Vector3(0, 1, 0); 275 lookAt = new Vector3(0, 1, 0);
276
277 if (m_GridService == null)
278 return null;
279
242 if (startLocation.Equals("home")) 280 if (startLocation.Equals("home"))
243 { 281 {
244 // logging into home region 282 // logging into home region
245 if (m_PresenceService == null || m_GridService == null)
246 return null;
247
248 if (pinfo == null) 283 if (pinfo == null)
249 return null; 284 return null;
250 285
@@ -271,8 +306,6 @@ namespace OpenSim.Services.LLLoginService
271 { 306 {
272 // logging into last visited region 307 // logging into last visited region
273 where = "last"; 308 where = "last";
274 if (m_PresenceService == null || m_GridService == null)
275 return null;
276 309
277 if (pinfo == null) 310 if (pinfo == null)
278 return null; 311 return null;
@@ -320,8 +353,6 @@ namespace OpenSim.Services.LLLoginService
320 { 353 {
321 if (!regionName.Contains("@")) 354 if (!regionName.Contains("@"))
322 { 355 {
323 if (m_GridService == null)
324 return null;
325 356
326 List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); 357 List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1);
327 if ((regions == null) || (regions != null && regions.Count == 0)) 358 if ((regions == null) || (regions != null && regions.Count == 0))
@@ -363,13 +394,9 @@ namespace OpenSim.Services.LLLoginService
363 region.RegionName = regionName; 394 region.RegionName = regionName;
364 return region; 395 return region;
365 } 396 }
366
367 } 397 }
368 else 398 else
369 { 399 {
370 if (m_PresenceService == null || m_GridService == null)
371 return null;
372
373 List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); 400 List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID);
374 if (defaults != null && defaults.Count > 0) 401 if (defaults != null && defaults.Count > 0)
375 { 402 {