From 9bc94c502a8e30b0d727f15d0e4b4bb22d163d6c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 27 Apr 2012 11:05:40 -0700 Subject: [PATCH] MapImageService: changed the event at which the map tiles are uploaded, because they were being uploaded before the region was registered with the grid --- .../MapImage/MapImageServiceModule.cs | 15 ++++++++++++--- .../Server/Handlers/Map/MapAddServerConnector.cs | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 6d3ace92a2..322a9f8c86 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs @@ -146,9 +146,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage lock (m_scenes) m_scenes[scene.RegionInfo.RegionID] = scene; - scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); + scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; } + /// /// /// @@ -163,9 +164,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage #endregion ISharedRegionModule - void EventManager_OnPrimsLoaded(Scene s) + void OnLoginsEnabled(string regionName) { - UploadMapTile(s); + Scene scene = null; + foreach (Scene s in m_scenes.Values) + if (s.RegionInfo.RegionName == regionName) + { + scene = s; + break; + } + if (scene != null) + UploadMapTile(scene); } diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 8ba188d834..4a619698bc 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -129,10 +129,10 @@ namespace OpenSim.Server.Handlers.MapImage if (m_GridService != null) { + System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); if (r != null) { - System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) { m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address); @@ -143,7 +143,7 @@ namespace OpenSim.Server.Handlers.MapImage else { m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", - httpRequest.RemoteIPEndPoint.Address, x, y); + ipAddr, x, y); return FailureResult("Region not found at given coordinates"); } }