diff options
author | Diva Canto | 2009-09-26 07:48:21 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-26 07:48:21 -0700 |
commit | 5757afe7665543e8b3ed4a322a7d6e095dafcdb3 (patch) | |
tree | bed3c7ab11459e84baa5a0fbd98dde4a81fd5e16 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | More small changes to FlotsamAssetCache as per mcortez' request. (diff) | |
download | opensim-SC-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.zip opensim-SC-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.tar.gz opensim-SC-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.tar.bz2 opensim-SC-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.tar.xz |
First pass at the heart surgery for grid services. Compiles and runs minimally. A few bugs to catch now.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 114 |
1 files changed, 62 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d8478a2..8990f29 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -49,6 +49,7 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
49 | using OpenSim.Region.Physics.Manager; | 49 | using OpenSim.Region.Physics.Manager; |
50 | using Timer=System.Timers.Timer; | 50 | using Timer=System.Timers.Timer; |
51 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 51 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
52 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
52 | 53 | ||
53 | namespace OpenSim.Region.Framework.Scenes | 54 | namespace OpenSim.Region.Framework.Scenes |
54 | { | 55 | { |
@@ -193,6 +194,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
193 | } | 194 | } |
194 | } | 195 | } |
195 | 196 | ||
197 | protected IGridService m_GridService = null; | ||
198 | |||
199 | public IGridService GridService | ||
200 | { | ||
201 | get | ||
202 | { | ||
203 | if (m_GridService == null) | ||
204 | { | ||
205 | m_GridService = RequestModuleInterface<IGridService>(); | ||
206 | |||
207 | if (m_GridService == null) | ||
208 | { | ||
209 | throw new Exception("No IGridService available. This could happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. Please also check that you have the correct version of your inventory service dll. Sometimes old versions of this dll will still exist. Do a clean checkout and re-create the opensim.ini from the opensim.ini.example."); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | return m_GridService; | ||
214 | } | ||
215 | } | ||
216 | |||
196 | protected IXMLRPC m_xmlrpcModule; | 217 | protected IXMLRPC m_xmlrpcModule; |
197 | protected IWorldComm m_worldCommModule; | 218 | protected IWorldComm m_worldCommModule; |
198 | protected IAvatarFactory m_AvatarFactory; | 219 | protected IAvatarFactory m_AvatarFactory; |
@@ -1336,24 +1357,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
1336 | RegisterCommsEvents(); | 1357 | RegisterCommsEvents(); |
1337 | 1358 | ||
1338 | // These two 'commands' *must be* next to each other or sim rebooting fails. | 1359 | // These two 'commands' *must be* next to each other or sim rebooting fails. |
1339 | m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); | 1360 | //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); |
1361 | |||
1362 | GridRegion region = new GridRegion(RegionInfo); | ||
1363 | bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region); | ||
1364 | if (!success) | ||
1365 | throw new Exception("Can't register with grid"); | ||
1366 | |||
1367 | m_sceneGridService.SetScene(this); | ||
1340 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1368 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); |
1341 | 1369 | ||
1342 | Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings(); | 1370 | //Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings(); |
1343 | 1371 | ||
1344 | if (dGridSettings.ContainsKey("allow_forceful_banlines")) | 1372 | //if (dGridSettings.ContainsKey("allow_forceful_banlines")) |
1345 | { | 1373 | //{ |
1346 | if (dGridSettings["allow_forceful_banlines"] != "TRUE") | 1374 | // if (dGridSettings["allow_forceful_banlines"] != "TRUE") |
1347 | { | 1375 | // { |
1348 | m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); | 1376 | // m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); |
1349 | EventManager.TriggerSetAllowForcefulBan(false); | 1377 | // EventManager.TriggerSetAllowForcefulBan(false); |
1350 | } | 1378 | // } |
1351 | else | 1379 | // else |
1352 | { | 1380 | // { |
1353 | m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); | 1381 | // m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); |
1354 | EventManager.TriggerSetAllowForcefulBan(true); | 1382 | // EventManager.TriggerSetAllowForcefulBan(true); |
1355 | } | 1383 | // } |
1356 | } | 1384 | //} |
1357 | } | 1385 | } |
1358 | 1386 | ||
1359 | /// <summary> | 1387 | /// <summary> |
@@ -2717,10 +2745,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2717 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); | 2745 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); |
2718 | if (UserProfile != null) | 2746 | if (UserProfile != null) |
2719 | { | 2747 | { |
2720 | RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegionID); | 2748 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); |
2721 | if (regionInfo == null) | 2749 | if (regionInfo == null) |
2722 | { | 2750 | { |
2723 | regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); | 2751 | uint x = 0, y = 0; |
2752 | Utils.LongToUInts(UserProfile.HomeRegion, out x, out y); | ||
2753 | regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
2724 | if (regionInfo != null) // home region can be away temporarily, too | 2754 | if (regionInfo != null) // home region can be away temporarily, too |
2725 | { | 2755 | { |
2726 | UserProfile.HomeRegionID = regionInfo.RegionID; | 2756 | UserProfile.HomeRegionID = regionInfo.RegionID; |
@@ -3111,7 +3141,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3111 | if (m_interregionCommsIn != null) | 3141 | if (m_interregionCommsIn != null) |
3112 | m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3142 | m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
3113 | 3143 | ||
3144 | // this does nothing; should be removed | ||
3114 | m_sceneGridService.Close(); | 3145 | m_sceneGridService.Close(); |
3146 | |||
3147 | if (!GridService.DeregisterRegion(m_regInfo.RegionID)) | ||
3148 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); | ||
3115 | } | 3149 | } |
3116 | 3150 | ||
3117 | /// <summary> | 3151 | /// <summary> |
@@ -3557,30 +3591,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3557 | } | 3591 | } |
3558 | 3592 | ||
3559 | /// <summary> | 3593 | /// <summary> |
3560 | /// Requests information about this region from gridcomms | ||
3561 | /// </summary> | ||
3562 | /// <param name="regionHandle"></param> | ||
3563 | /// <returns></returns> | ||
3564 | public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) | ||
3565 | { | ||
3566 | return m_sceneGridService.RequestNeighbouringRegionInfo(regionHandle); | ||
3567 | } | ||
3568 | |||
3569 | /// <summary> | ||
3570 | /// Requests textures for map from minimum region to maximum region in world cordinates | ||
3571 | /// </summary> | ||
3572 | /// <param name="remoteClient"></param> | ||
3573 | /// <param name="minX"></param> | ||
3574 | /// <param name="minY"></param> | ||
3575 | /// <param name="maxX"></param> | ||
3576 | /// <param name="maxY"></param> | ||
3577 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) | ||
3578 | { | ||
3579 | m_log.DebugFormat("[MAPBLOCK]: {0}-{1}, {2}-{3}", minX, minY, maxX, maxY); | ||
3580 | m_sceneGridService.RequestMapBlocks(remoteClient, minX, minY, maxX, maxY); | ||
3581 | } | ||
3582 | |||
3583 | /// <summary> | ||
3584 | /// Tries to teleport agent to other region. | 3594 | /// Tries to teleport agent to other region. |
3585 | /// </summary> | 3595 | /// </summary> |
3586 | /// <param name="remoteClient"></param> | 3596 | /// <param name="remoteClient"></param> |
@@ -3591,7 +3601,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3591 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 3601 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
3592 | Vector3 lookat, uint teleportFlags) | 3602 | Vector3 lookat, uint teleportFlags) |
3593 | { | 3603 | { |
3594 | RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName); | 3604 | GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); |
3595 | if (regionInfo == null) | 3605 | if (regionInfo == null) |
3596 | { | 3606 | { |
3597 | // can't find the region: Tell viewer and abort | 3607 | // can't find the region: Tell viewer and abort |
@@ -3680,7 +3690,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3680 | /// <param name="position"></param> | 3690 | /// <param name="position"></param> |
3681 | public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position) | 3691 | public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position) |
3682 | { | 3692 | { |
3683 | RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID); | 3693 | GridRegion info = GridService.GetRegionByUUID(UUID.Zero, regionID); |
3684 | 3694 | ||
3685 | if (info == null) | 3695 | if (info == null) |
3686 | { | 3696 | { |
@@ -3864,10 +3874,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3864 | return LandChannel.GetLandObject((int)x, (int)y).landData; | 3874 | return LandChannel.GetLandObject((int)x, (int)y).landData; |
3865 | } | 3875 | } |
3866 | 3876 | ||
3867 | public RegionInfo RequestClosestRegion(string name) | ||
3868 | { | ||
3869 | return m_sceneGridService.RequestClosestRegion(name); | ||
3870 | } | ||
3871 | 3877 | ||
3872 | #endregion | 3878 | #endregion |
3873 | 3879 | ||
@@ -4178,14 +4184,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4178 | 4184 | ||
4179 | public void RegionHandleRequest(IClientAPI client, UUID regionID) | 4185 | public void RegionHandleRequest(IClientAPI client, UUID regionID) |
4180 | { | 4186 | { |
4181 | RegionInfo info; | 4187 | ulong handle = 0; |
4182 | if (regionID == RegionInfo.RegionID) | 4188 | if (regionID == RegionInfo.RegionID) |
4183 | info = RegionInfo; | 4189 | handle = RegionInfo.RegionHandle; |
4184 | else | 4190 | else |
4185 | info = CommsManager.GridService.RequestNeighbourInfo(regionID); | 4191 | { |
4192 | GridRegion r = GridService.GetRegionByUUID(UUID.Zero, regionID); | ||
4193 | if (r != null) | ||
4194 | handle = r.RegionHandle; | ||
4195 | } | ||
4186 | 4196 | ||
4187 | if (info != null) | 4197 | if (handle != 0) |
4188 | client.SendRegionHandle(regionID, info.RegionHandle); | 4198 | client.SendRegionHandle(regionID, handle); |
4189 | } | 4199 | } |
4190 | 4200 | ||
4191 | public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) | 4201 | public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) |