diff options
Diffstat (limited to 'OpenSim/Grid/UserServer.Modules/UserLoginService.cs')
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 01d5537..7d0e0de 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs | |||
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using Nini.Config; | ||
37 | using OpenSim.Data; | 38 | using OpenSim.Data; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
@@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache; | |||
42 | using OpenSim.Framework.Capabilities; | 43 | using OpenSim.Framework.Capabilities; |
43 | using OpenSim.Framework.Servers; | 44 | using OpenSim.Framework.Servers; |
44 | using OpenSim.Framework.Servers.HttpServer; | 45 | using OpenSim.Framework.Servers.HttpServer; |
46 | using OpenSim.Services.Interfaces; | ||
47 | using OpenSim.Services.Connectors; | ||
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | 49 | ||
46 | namespace OpenSim.Grid.UserServer.Modules | 50 | namespace OpenSim.Grid.UserServer.Modules |
47 | { | 51 | { |
@@ -51,7 +55,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
51 | 55 | ||
52 | /// <summary> | 56 | /// <summary> |
53 | /// Login service used in grid mode. | 57 | /// Login service used in grid mode. |
54 | /// </summary> | 58 | /// </summary> |
55 | public class UserLoginService : LoginService | 59 | public class UserLoginService : LoginService |
56 | { | 60 | { |
57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
63 | public UserConfig m_config; | 67 | public UserConfig m_config; |
64 | private readonly IRegionProfileRouter m_regionProfileService; | 68 | private readonly IRegionProfileRouter m_regionProfileService; |
65 | 69 | ||
70 | private IGridService m_GridService; | ||
71 | |||
66 | protected BaseHttpServer m_httpServer; | 72 | protected BaseHttpServer m_httpServer; |
67 | 73 | ||
68 | public UserLoginService( | 74 | public UserLoginService( |
@@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
76 | m_defaultHomeY = m_config.DefaultY; | 82 | m_defaultHomeY = m_config.DefaultY; |
77 | m_interInventoryService = inventoryService; | 83 | m_interInventoryService = inventoryService; |
78 | m_regionProfileService = regionProfileService; | 84 | m_regionProfileService = regionProfileService; |
85 | |||
86 | m_GridService = new GridServicesConnector(config.GridServerURL.ToString()); | ||
79 | } | 87 | } |
80 | 88 | ||
81 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) | 89 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) |
@@ -203,47 +211,38 @@ namespace OpenSim.Grid.UserServer.Modules | |||
203 | 211 | ||
204 | protected override RegionInfo RequestClosestRegion(string region) | 212 | protected override RegionInfo RequestClosestRegion(string region) |
205 | { | 213 | { |
206 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, | 214 | return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region)); |
207 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | ||
208 | |||
209 | if (profileData != null) | ||
210 | { | ||
211 | return profileData.ToRegionInfo(); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | return null; | ||
216 | } | ||
217 | } | 215 | } |
218 | 216 | ||
219 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) | 217 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) |
220 | { | 218 | { |
221 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, | 219 | uint x = 0, y = 0; |
222 | m_config.GridServerURL, m_config.GridSendKey, | 220 | Utils.LongToUInts(homeRegionHandle, out x, out y); |
223 | m_config.GridRecvKey); | 221 | return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y)); |
224 | if (profileData != null) | ||
225 | { | ||
226 | return profileData.ToRegionInfo(); | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | return null; | ||
231 | } | ||
232 | } | 222 | } |
233 | 223 | ||
234 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) | 224 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) |
235 | { | 225 | { |
236 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, | 226 | return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId)); |
237 | m_config.GridServerURL, m_config.GridSendKey, | 227 | } |
238 | m_config.GridRecvKey); | 228 | |
239 | if (profileData != null) | 229 | private RegionInfo GridRegionToRegionInfo(GridRegion gregion) |
240 | { | 230 | { |
241 | return profileData.ToRegionInfo(); | 231 | if (gregion == null) |
242 | } | ||
243 | else | ||
244 | { | ||
245 | return null; | 232 | return null; |
246 | } | 233 | |
234 | RegionInfo rinfo = new RegionInfo(); | ||
235 | rinfo.ExternalHostName = gregion.ExternalHostName; | ||
236 | rinfo.HttpPort = gregion.HttpPort; | ||
237 | rinfo.InternalEndPoint = gregion.InternalEndPoint; | ||
238 | rinfo.RegionID = gregion.RegionID; | ||
239 | rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize); | ||
240 | rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); | ||
241 | rinfo.RegionName = gregion.RegionName; | ||
242 | rinfo.ScopeID = gregion.ScopeID; | ||
243 | rinfo.ServerURI = gregion.ServerURI; | ||
244 | |||
245 | return rinfo; | ||
247 | } | 246 | } |
248 | 247 | ||
249 | protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) | 248 | protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) |
@@ -280,9 +279,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
280 | //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); | 279 | //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); |
281 | 280 | ||
282 | // Take off trailing / so that the caps path isn't //CAPS/someUUID | 281 | // Take off trailing / so that the caps path isn't //CAPS/someUUID |
283 | if (regionInfo.httpServerURI.EndsWith("/")) | 282 | string uri = regionInfo.httpServerURI.Trim(new char[] { '/' }); |
284 | regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); | 283 | response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath); |
285 | response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); | ||
286 | 284 | ||
287 | 285 | ||
288 | // Notify the target of an incoming user | 286 | // Notify the target of an incoming user |