aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-19 17:41:21 +0000
committerJustin Clarke Casey2008-09-19 17:41:21 +0000
commit5fb7b485b211bbf19f4531a051b78dde92da4ba3 (patch)
tree655778d09beb953613b1db282dcf4cc640d90697 /OpenSim
parentGuard LLRezObject against NaN (diff)
downloadopensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.zip
opensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.gz
opensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.bz2
opensim-SC_OLD-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.xz
* Only allow logins on standalone when the sim has completed it's initial startup (script startup doesn't count here)
* There was a small window where region logins were allowed before modules were loaded - avatars logins that hit this window could have caused bad things to happen. * A similar change will follow for grid mode sometime soon
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs22
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs9
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs7
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs38
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs2
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs4
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs13
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs64
-rw-r--r--OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs6
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs6
13 files changed, 121 insertions, 71 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 3675053..cf6a74d 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -51,12 +51,20 @@ namespace OpenSim.Framework.Communications.Cache
51 /// </summary> 51 /// </summary>
52 private readonly Dictionary<UUID, CachedUserInfo> m_userProfiles = new Dictionary<UUID, CachedUserInfo>(); 52 private readonly Dictionary<UUID, CachedUserInfo> m_userProfiles = new Dictionary<UUID, CachedUserInfo>();
53 53
54 public readonly LibraryRootFolder libraryRoot = new LibraryRootFolder(); 54 /// <summary>
55 /// The root library folder.
56 /// </summary>
57 public readonly LibraryRootFolder LibraryRoot;
55 58
56 // Methods 59 /// <summary>
57 public UserProfileCacheService(CommunicationsManager commsManager) 60 /// Constructor
61 /// </summary>
62 /// <param name="commsManager"></param>
63 /// <param name="libraryRootFolder"></param>
64 public UserProfileCacheService(CommunicationsManager commsManager, LibraryRootFolder libraryRootFolder)
58 { 65 {
59 m_commsManager = commsManager; 66 m_commsManager = commsManager;
67 LibraryRoot = libraryRootFolder;
60 } 68 }
61 69
62 /// <summary> 70 /// <summary>
@@ -293,10 +301,10 @@ namespace OpenSim.Framework.Communications.Cache
293 // FIXME MAYBE: We're not handling sortOrder! 301 // FIXME MAYBE: We're not handling sortOrder!
294 302
295 InventoryFolderImpl fold = null; 303 InventoryFolderImpl fold = null;
296 if ((fold = libraryRoot.FindFolder(folderID)) != null) 304 if ((fold = LibraryRoot.FindFolder(folderID)) != null)
297 { 305 {
298 remoteClient.SendInventoryFolderDetails( 306 remoteClient.SendInventoryFolderDetails(
299 libraryRoot.Owner, folderID, fold.RequestListOfItems(), 307 LibraryRoot.Owner, folderID, fold.RequestListOfItems(),
300 fold.RequestListOfFolders(), fetchFolders, fetchItems); 308 fold.RequestListOfFolders(), fetchFolders, fetchItems);
301 309
302 return; 310 return;
@@ -337,7 +345,7 @@ namespace OpenSim.Framework.Communications.Cache
337 // FIXME MAYBE: We're not handling sortOrder! 345 // FIXME MAYBE: We're not handling sortOrder!
338 346
339 InventoryFolderImpl fold; 347 InventoryFolderImpl fold;
340 if ((fold = libraryRoot.FindFolder(folderID)) != null) 348 if ((fold = LibraryRoot.FindFolder(folderID)) != null)
341 { 349 {
342 return fold.RequestListOfItems(); 350 return fold.RequestListOfItems();
343 } 351 }
@@ -428,7 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
428 436
429 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) 437 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
430 { 438 {
431 if (ownerID == libraryRoot.Owner) 439 if (ownerID == LibraryRoot.Owner)
432 { 440 {
433 //Console.WriteLine("request info for library item"); 441 //Console.WriteLine("request info for library item");
434 442
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 5bed282..198bd83 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -112,11 +112,11 @@ namespace OpenSim.Framework.Communications
112 /// <param name="assetCache"></param> 112 /// <param name="assetCache"></param>
113 /// <param name="dumpAssetsToFile"></param> 113 /// <param name="dumpAssetsToFile"></param>
114 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, 114 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
115 bool dumpAssetsToFile) 115 bool dumpAssetsToFile, LibraryRootFolder libraryRootFolder)
116 { 116 {
117 m_networkServersInfo = serversInfo; 117 m_networkServersInfo = serversInfo;
118 m_assetCache = assetCache; 118 m_assetCache = assetCache;
119 m_userProfileCacheService = new UserProfileCacheService(this); 119 m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder);
120 // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); 120 // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
121 } 121 }
122 122
@@ -356,7 +356,7 @@ namespace OpenSim.Framework.Communications
356 356
357 public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) 357 public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
358 { 358 {
359 if (uuid == m_userProfileCacheService.libraryRoot.Owner) 359 if (uuid == m_userProfileCacheService.LibraryRoot.Owner)
360 { 360 {
361 remote_client.SendNameReply(uuid, "Mr", "OpenSim"); 361 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
362 } 362 }
@@ -376,7 +376,6 @@ namespace OpenSim.Framework.Communications
376 string[] returnstring = new string[0]; 376 string[] returnstring = new string[0];
377 bool doLookup = false; 377 bool doLookup = false;
378 378
379
380 lock (m_nameRequestCache) 379 lock (m_nameRequestCache)
381 { 380 {
382 if (m_nameRequestCache.ContainsKey(uuid)) 381 if (m_nameRequestCache.ContainsKey(uuid))
@@ -405,8 +404,8 @@ namespace OpenSim.Framework.Communications
405 } 404 }
406 } 405 }
407 } 406 }
407
408 return returnstring; 408 return returnstring;
409
410 } 409 }
411 410
412 public bool UUIDNameCachedTest(UUID uuid) 411 public bool UUIDNameCachedTest(UUID uuid)
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index 6c5d2e2..f6a2885 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -33,6 +33,11 @@ namespace OpenSim.Framework.Communications
33 public interface IGridServices 33 public interface IGridServices
34 { 34 {
35 string gdebugRegionName { get; set; } 35 string gdebugRegionName { get; set; }
36
37 /// <summary>
38 /// If true, then regions will accept logins from the user service. If false, then they will not.
39 /// </summary>
40 bool RegionLoginsEnabled { get; set; }
36 41
37 /// <summary> 42 /// <summary>
38 /// Register a region with the grid service. 43 /// Register a region with the grid service.
@@ -42,7 +47,7 @@ namespace OpenSim.Framework.Communications
42 /// <exception cref="System.Exception">Thrown if region registration failed</exception> 47 /// <exception cref="System.Exception">Thrown if region registration failed</exception>
43 RegionCommsListener RegisterRegion(RegionInfo regionInfos); 48 RegionCommsListener RegisterRegion(RegionInfo regionInfos);
44 49
45 bool DeregisterRegion(RegionInfo regionInfo); 50 bool DeregisterRegion(RegionInfo regionInfo);
46 51
47 /// <summary> 52 /// <summary>
48 /// Get information about the regions neighbouring the given co-ordinates. 53 /// Get information about the regions neighbouring the given co-ordinates.
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index f4c43ef..8d27a23 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -239,8 +239,8 @@ namespace OpenSim.Framework.Communications
239 catch (Exception e) 239 catch (Exception e)
240 { 240 {
241 m_log.ErrorFormat( 241 m_log.ErrorFormat(
242 "[LOGIN END]: XMLRPC Error retrieving inventory skeleton of agent {0}, {1} - {2}", 242 "[LOGIN END]: Error retrieving inventory skeleton of agent {0} - {1}",
243 agentID, e.GetType(), e.Message); 243 agentID, e);
244 244
245 return logResponse.CreateLoginInventoryFailedResponse(); 245 return logResponse.CreateLoginInventoryFailedResponse();
246 } 246 }
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index e5cf07a..d4fa314 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -84,7 +84,6 @@ namespace OpenSim
84 public bool m_gridLocalAsset; 84 public bool m_gridLocalAsset;
85 public bool m_see_into_region_from_neighbor; 85 public bool m_see_into_region_from_neighbor;
86 86
87 protected LocalLoginService m_loginService;
88 protected GridInfoService m_gridInfoService; 87 protected GridInfoService m_gridInfoService;
89 88
90 protected string m_storageDll; 89 protected string m_storageDll;
@@ -368,6 +367,8 @@ namespace OpenSim
368 base.Startup(); 367 base.Startup();
369 368
370 m_stats = StatsManager.StartCollectingSimExtraStats(); 369 m_stats = StatsManager.StartCollectingSimExtraStats();
370
371 LibraryRootFolder libraryRootFolder = new LibraryRootFolder();
371 372
372 // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false) 373 // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false)
373 if (m_sandbox) 374 if (m_sandbox)
@@ -378,28 +379,28 @@ namespace OpenSim
378 LocalUserServices userService = 379 LocalUserServices userService =
379 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, 380 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
380 m_networkServersInfo.DefaultHomeLocY, inventoryService); 381 m_networkServersInfo.DefaultHomeLocY, inventoryService);
381 userService.AddPlugin(m_standaloneUserPlugin, m_standaloneUserSource); 382 userService.AddPlugin(m_standaloneUserPlugin, m_standaloneUserSource);
382 383
383 LocalBackEndServices backendService = new LocalBackEndServices(); 384 LocalBackEndServices backendService = new LocalBackEndServices();
384 385
385 CommunicationsLocal localComms = 386 LocalLoginService loginService =
386 new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, 387 new LocalLoginService(
387 inventoryService, backendService, backendService, m_dumpAssetsToFile); 388 userService, m_standaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo,
388 m_commsManager = localComms; 389 m_standaloneAuthenticate, libraryRootFolder);
389 390
390 m_loginService = 391 m_commsManager
391 new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, 392 = new CommunicationsLocal(
392 m_standaloneAuthenticate); 393 m_networkServersInfo, m_httpServer, m_assetCache, userService, userService,
393 m_loginService.OnLoginToRegion += backendService.AddNewSession; 394 inventoryService, backendService, backendService, libraryRootFolder, m_dumpAssetsToFile);
394 395
395 // set up XMLRPC handler for client's initial login request message 396 // set up XMLRPC handler for client's initial login request message
396 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); 397 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
397 398
398 // provides the web form login 399 // provides the web form login
399 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); 400 m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin);
400 401
401 // Provides the LLSD login 402 // Provides the LLSD login
402 m_httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod); 403 m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod);
403 404
404 // provide grid info 405 // provide grid info
405 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); 406 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini")));
@@ -410,7 +411,9 @@ namespace OpenSim
410 else 411 else
411 { 412 {
412 // We are in grid mode 413 // We are in grid mode
413 m_commsManager = new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache); 414 m_commsManager
415 = new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache, libraryRootFolder);
416
414 m_httpServer.AddStreamHandler(new SimStatusHandler()); 417 m_httpServer.AddStreamHandler(new SimStatusHandler());
415 } 418 }
416 419
@@ -421,6 +424,9 @@ namespace OpenSim
421 m_moduleLoader = new ModuleLoader(m_config.Source); 424 m_moduleLoader = new ModuleLoader(m_config.Source);
422 425
423 LoadPlugins(); 426 LoadPlugins();
427
428 // Only enable logins to the regions once we have completely finished starting up
429 m_commsManager.GridService.RegionLoginsEnabled = true;
424 } 430 }
425 431
426 protected override void Initialize() 432 protected override void Initialize()
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3b5e798..a55ce1c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4884,7 +4884,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4884 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID); 4884 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
4885 if (assetRequestItem == null) 4885 if (assetRequestItem == null)
4886 { 4886 {
4887 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID); 4887 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
4888 if (assetRequestItem == null) 4888 if (assetRequestItem == null)
4889 return; 4889 return;
4890 } 4890 }
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 469c084..4c6d51f 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -87,9 +87,7 @@ namespace OpenSim.Region.ClientStack
87 m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); 87 m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
88 } 88 }
89 89
90
91 m_log.Info("[REGION]: Starting HTTP server"); 90 m_log.Info("[REGION]: Starting HTTP server");
92
93 m_httpServer.Start(); 91 m_httpServer.Start();
94 } 92 }
95 93
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index c79979c..71c44e5 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -42,8 +42,8 @@ namespace OpenSim.Region.Communications.Local
42 IUserServiceAdmin userServiceAdmin, 42 IUserServiceAdmin userServiceAdmin,
43 LocalInventoryService inventoryService, 43 LocalInventoryService inventoryService,
44 IInterRegionCommunications interRegionService, 44 IInterRegionCommunications interRegionService,
45 IGridServices gridService, bool dumpAssetsToFile) 45 IGridServices gridService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile)
46 : base(serversInfo, httpServer, assetCache, dumpAssetsToFile) 46 : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
47 { 47 {
48 AddInventoryService(inventoryService); 48 AddInventoryService(inventoryService);
49 m_defaultInventoryHost = inventoryService.Host; 49 m_defaultInventoryHost = inventoryService.Host;
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index aabddc6..a861ceb 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Communications.Local
39 public class LocalBackEndServices : IGridServices, IInterRegionCommunications 39 public class LocalBackEndServices : IGridServices, IInterRegionCommunications
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>(); 43 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
44 44
45 protected Dictionary<ulong, RegionCommsListener> m_regionListeners = 45 protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
@@ -50,6 +50,13 @@ namespace OpenSim.Region.Communications.Local
50 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); 50 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
51 51
52 public string _gdebugRegionName = String.Empty; 52 public string _gdebugRegionName = String.Empty;
53
54 public bool RegionLoginsEnabled
55 {
56 get { return m_regionLoginsEnabled; }
57 set { m_regionLoginsEnabled = value; }
58 }
59 private bool m_regionLoginsEnabled;
53 60
54 public bool CheckRegion(string address, uint port) 61 public bool CheckRegion(string address, uint port)
55 { 62 {
@@ -70,10 +77,6 @@ namespace OpenSim.Region.Communications.Local
70 set { _rdebugRegionName = value; } 77 set { _rdebugRegionName = value; }
71 } 78 }
72 79
73 public LocalBackEndServices()
74 {
75 }
76
77 /// <summary> 80 /// <summary>
78 /// Register a region method with the BackEnd Services. 81 /// Register a region method with the BackEnd Services.
79 /// </summary> 82 /// </summary>
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 41093c1..ded2d56 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -34,6 +34,7 @@ using OpenMetaverse;
34using log4net; 34using log4net;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Communications.Cache;
37 38
38namespace OpenSim.Region.Communications.Local 39namespace OpenSim.Region.Communications.Local
39{ 40{
@@ -43,27 +44,41 @@ namespace OpenSim.Region.Communications.Local
43 { 44 {
44 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 46
46 protected CommunicationsLocal m_Parent;
47
48 protected NetworkServersInfo serversInfo; 47 protected NetworkServersInfo serversInfo;
49 protected uint defaultHomeX; 48 protected uint defaultHomeX;
50 protected uint defaultHomeY; 49 protected uint defaultHomeY;
51 protected bool authUsers = false; 50 protected bool authUsers = false;
51
52 /// <summary>
53 /// Used by the login service to make requests to the inventory service.
54 /// </summary>
55 protected IInterServiceInventoryServices m_interServiceInventoryService;
56
57 /// <summary>
58 /// Used to make requests to the local regions.
59 /// </summary>
60 protected IGridServices m_gridService;
52 61
53 public event LoginToRegionEvent OnLoginToRegion; 62 public event LoginToRegionEvent OnLoginToRegion;
54 63
55 protected LoginToRegionEvent handlerLoginToRegion = null; // OnLoginToRegion; 64 protected LoginToRegionEvent handlerLoginToRegion = null; // OnLoginToRegion;
56 65
57 public LocalLoginService(UserManagerBase userManager, string welcomeMess, 66 public LocalLoginService(
58 CommunicationsLocal parent, NetworkServersInfo serversInfo, 67 UserManagerBase userManager, string welcomeMess,
59 bool authenticate) 68 IInterServiceInventoryServices interServiceInventoryService, LocalBackEndServices gridService,
60 : base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess) 69 NetworkServersInfo serversInfo,
70 bool authenticate, LibraryRootFolder libraryRootFolder)
71 : base(userManager, libraryRootFolder, welcomeMess)
61 { 72 {
62 m_Parent = parent;
63 this.serversInfo = serversInfo; 73 this.serversInfo = serversInfo;
64 defaultHomeX = this.serversInfo.DefaultHomeLocX; 74 defaultHomeX = this.serversInfo.DefaultHomeLocX;
65 defaultHomeY = this.serversInfo.DefaultHomeLocY; 75 defaultHomeY = this.serversInfo.DefaultHomeLocY;
66 authUsers = authenticate; 76 authUsers = authenticate;
77
78 m_interServiceInventoryService = interServiceInventoryService;
79 m_gridService = gridService;
80
81 OnLoginToRegion += gridService.AddNewSession;
67 } 82 }
68 83
69 public override UserProfileData GetTheUser(string firstname, string lastname) 84 public override UserProfileData GetTheUser(string firstname, string lastname)
@@ -84,7 +99,7 @@ namespace OpenSim.Region.Communications.Local
84 profile = m_userManager.GetUserProfile(firstname, lastname); 99 profile = m_userManager.GetUserProfile(firstname, lastname);
85 if (profile != null) 100 if (profile != null)
86 { 101 {
87 m_Parent.InterServiceInventoryService.CreateNewUserInventory(profile.ID); 102 m_interServiceInventoryService.CreateNewUserInventory(profile.ID);
88 } 103 }
89 104
90 return profile; 105 return profile;
@@ -129,11 +144,12 @@ namespace OpenSim.Region.Communications.Local
129 { 144 {
130 // HomeLocation 145 // HomeLocation
131 RegionInfo homeInfo = null; 146 RegionInfo homeInfo = null;
147
132 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 148 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
133 if (theUser.HomeRegionID != UUID.Zero) 149 if (theUser.HomeRegionID != UUID.Zero)
134 homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegionID); 150 homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegionID);
135 else 151 else
136 homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion); 152 homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegion);
137 if (homeInfo != null) 153 if (homeInfo != null)
138 { 154 {
139 response.Home = 155 response.Home =
@@ -172,7 +188,7 @@ namespace OpenSim.Region.Communications.Local
172 } 188 }
173 else if (startLocationRequest == "last") 189 else if (startLocationRequest == "last")
174 { 190 {
175 regionInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.CurrentAgent.Region); 191 regionInfo = m_gridService.RequestNeighbourInfo(theUser.CurrentAgent.Region);
176 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; 192 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
177 } 193 }
178 else 194 else
@@ -186,7 +202,7 @@ namespace OpenSim.Region.Communications.Local
186 else 202 else
187 { 203 {
188 string region = uriMatch.Groups["region"].ToString(); 204 string region = uriMatch.Groups["region"].ToString();
189 regionInfo = m_Parent.GridService.RequestClosestRegion(region); 205 regionInfo = m_gridService.RequestClosestRegion(region);
190 if (regionInfo == null) 206 if (regionInfo == null)
191 { 207 {
192 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); 208 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@@ -208,7 +224,7 @@ namespace OpenSim.Region.Communications.Local
208 } 224 }
209 225
210 // StartLocation not available, send him to a nearby region instead 226 // StartLocation not available, send him to a nearby region instead
211 // regionInfo = m_Parent.GridService.RequestClosestRegion(""); 227 // regionInfo = m_gridService.RequestClosestRegion("");
212 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName); 228 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
213 229
214 // Send him to default region instead 230 // Send him to default region instead
@@ -222,7 +238,7 @@ namespace OpenSim.Region.Communications.Local
222 } 238 }
223 239
224 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); 240 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
225 regionInfo = m_Parent.GridService.RequestNeighbourInfo(defaultHandle); 241 regionInfo = m_gridService.RequestNeighbourInfo(defaultHandle);
226 242
227 // Customise the response 243 // Customise the response
228 //response.Home = 244 //response.Home =
@@ -274,24 +290,26 @@ namespace OpenSim.Region.Communications.Local
274 loginParams.StartPos = user.CurrentAgent.Position; 290 loginParams.StartPos = user.CurrentAgent.Position;
275 loginParams.CapsPath = capsPath; 291 loginParams.CapsPath = capsPath;
276 292
277 handlerLoginToRegion = OnLoginToRegion; 293 if (m_gridService.RegionLoginsEnabled)
278 if (handlerLoginToRegion == null) 294 {
279 return false; 295 handlerLoginToRegion = OnLoginToRegion;
280 296 handlerLoginToRegion(user.CurrentAgent.Handle, loginParams);
281 handlerLoginToRegion(user.CurrentAgent.Handle, loginParams); 297 return true;
282 return true; 298 }
299
300 return false;
283 } 301 }
284 302
285 // See LoginService 303 // See LoginService
286 protected override InventoryData GetInventorySkeleton(UUID userID) 304 protected override InventoryData GetInventorySkeleton(UUID userID)
287 { 305 {
288 List<InventoryFolderBase> folders = m_Parent.InterServiceInventoryService.GetInventorySkeleton(userID); 306 List<InventoryFolderBase> folders = m_interServiceInventoryService.GetInventorySkeleton(userID);
289 307
290 // If we have user auth but no inventory folders for some reason, create a new set of folders. 308 // If we have user auth but no inventory folders for some reason, create a new set of folders.
291 if (null == folders || 0 == folders.Count) 309 if (null == folders || 0 == folders.Count)
292 { 310 {
293 m_Parent.InterServiceInventoryService.CreateNewUserInventory(userID); 311 m_interServiceInventoryService.CreateNewUserInventory(userID);
294 folders = m_Parent.InterServiceInventoryService.GetInventorySkeleton(userID); 312 folders = m_interServiceInventoryService.GetInventorySkeleton(userID);
295 } 313 }
296 314
297 UUID rootID = UUID.Zero; 315 UUID rootID = UUID.Zero;
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index 1926e79..d76f076 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -34,8 +34,10 @@ namespace OpenSim.Region.Communications.OGS1
34{ 34{
35 public class CommunicationsOGS1 : CommunicationsManager 35 public class CommunicationsOGS1 : CommunicationsManager
36 { 36 {
37 public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) 37 public CommunicationsOGS1(
38 : base(serversInfo, httpServer, assetCache, false) 38 NetworkServersInfo serversInfo, BaseHttpServer httpServer,
39 AssetCache assetCache, LibraryRootFolder libraryRootFolder)
40 : base(serversInfo, httpServer, assetCache, false, libraryRootFolder)
39 { 41 {
40 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); 42 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
41 m_gridService = gridInterComms; 43 m_gridService = gridInterComms;
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 3bd57cd..2e91157 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -51,15 +51,16 @@ namespace OpenSim.Region.Communications.OGS1
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 // FIXME: LocalBackEndServices should to be refactored into a separate common parent class rather than
55 // encapsulated.
54 private LocalBackEndServices m_localBackend = new LocalBackEndServices(); 56 private LocalBackEndServices m_localBackend = new LocalBackEndServices();
57
55 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); 58 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
56 // private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>(); 59 // private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>();
57 private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>(); 60 private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>();
58 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); 61 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
59 private List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>(); 62 private List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>();
60 63
61
62
63 public BaseHttpServer httpListener; 64 public BaseHttpServer httpListener;
64 public NetworkServersInfo serversInfo; 65 public NetworkServersInfo serversInfo;
65 public BaseHttpServer httpServer; 66 public BaseHttpServer httpServer;
@@ -79,6 +80,16 @@ namespace OpenSim.Region.Communications.OGS1
79 get { return _rdebugRegionName; } 80 get { return _rdebugRegionName; }
80 set { _rdebugRegionName = value; } 81 set { _rdebugRegionName = value; }
81 } 82 }
83
84 /// <summary>
85 /// Doesn't have any effect yet!
86 /// </summary>
87 public bool RegionLoginsEnabled
88 {
89 get { return m_regionLoginsEnabled; }
90 set { m_regionLoginsEnabled = value; }
91 }
92 private bool m_regionLoginsEnabled;
82 93
83 /// <summary> 94 /// <summary>
84 /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers 95 /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 36f86eb..5d55075 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -500,7 +500,7 @@ namespace OpenSim.Region.Environment.Scenes
500 "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", 500 "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
501 remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); 501 remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
502 502
503 InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(oldItemID); 503 InventoryItemBase item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(oldItemID);
504 504
505 if (item == null) 505 if (item == null)
506 { 506 {
@@ -1207,7 +1207,7 @@ namespace OpenSim.Region.Environment.Scenes
1207 // XXX clumsy, possibly should be one call 1207 // XXX clumsy, possibly should be one call
1208 if (null == item) 1208 if (null == item)
1209 { 1209 {
1210 item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID); 1210 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1211 } 1211 }
1212 1212
1213 if (item != null) 1213 if (item != null)
@@ -1272,7 +1272,7 @@ namespace OpenSim.Region.Environment.Scenes
1272 // XXX clumsy, possibly should be one call 1272 // XXX clumsy, possibly should be one call
1273 if (null == item) 1273 if (null == item)
1274 { 1274 {
1275 item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID); 1275 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1276 } 1276 }
1277 1277
1278 if (item != null) 1278 if (item != null)