aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
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/Region/Communications
parentGuard LLRezObject against NaN (diff)
downloadopensim-SC-5fb7b485b211bbf19f4531a051b78dde92da4ba3.zip
opensim-SC-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.gz
opensim-SC-5fb7b485b211bbf19f4531a051b78dde92da4ba3.tar.bz2
opensim-SC-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/Region/Communications')
-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
5 files changed, 68 insertions, 34 deletions
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