aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs71
-rw-r--r--prebuild.xml3
2 files changed, 32 insertions, 42 deletions
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
index 5651a17..dedf876 100644
--- a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
@@ -39,6 +39,10 @@ using OpenSim.Data;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Grid.Framework; 40using OpenSim.Grid.Framework;
41using Timer = System.Timers.Timer; 41using Timer = System.Timers.Timer;
42using OpenSim.Services.Interfaces;
43using OpenSim.Services.Connectors;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
42 46
43namespace OpenSim.Grid.MessagingServer.Modules 47namespace OpenSim.Grid.MessagingServer.Modules
44{ 48{
@@ -52,6 +56,8 @@ namespace OpenSim.Grid.MessagingServer.Modules
52 56
53 private IGridServiceCore m_messageCore; 57 private IGridServiceCore m_messageCore;
54 58
59 private IGridService m_GridService;
60
55 // a dictionary of all current regions this server knows about 61 // a dictionary of all current regions this server knows about
56 private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>(); 62 private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>();
57 63
@@ -59,6 +65,8 @@ namespace OpenSim.Grid.MessagingServer.Modules
59 { 65 {
60 m_cfg = config; 66 m_cfg = config;
61 m_messageCore = messageCore; 67 m_messageCore = messageCore;
68
69 m_GridService = new GridServicesConnector(m_cfg.GridServerURL);
62 } 70 }
63 71
64 public void Initialise() 72 public void Initialise()
@@ -134,51 +142,30 @@ namespace OpenSim.Grid.MessagingServer.Modules
134 /// <returns></returns> 142 /// <returns></returns>
135 public RegionProfileData RequestRegionInfo(ulong regionHandle) 143 public RegionProfileData RequestRegionInfo(ulong regionHandle)
136 { 144 {
137 RegionProfileData regionProfile = null; 145 uint x = 0, y = 0;
138 try 146 Utils.LongToUInts(regionHandle, out x, out y);
139 { 147 GridRegion region = m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
140 Hashtable requestData = new Hashtable();
141 requestData["region_handle"] = regionHandle.ToString();
142 requestData["authkey"] = m_cfg.GridSendKey;
143
144 ArrayList SendParams = new ArrayList();
145 SendParams.Add(requestData);
146 148
147 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 149 if (region != null)
150 return GridRegionToRegionProfile(region);
148 151
149 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); 152 else
150 153 return null;
151 Hashtable responseData = (Hashtable)GridResp.Value; 154 }
152
153 if (responseData.ContainsKey("error"))
154 {
155 m_log.Error("[GRID]: error received from grid server" + responseData["error"]);
156 return null;
157 }
158
159 uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
160 uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
161 string internalIpStr = (string)responseData["sim_ip"];
162
163 regionProfile = new RegionProfileData();
164 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
165 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
166 regionProfile.regionHandle = Utils.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
167 regionProfile.regionLocX = regX;
168 regionProfile.regionLocY = regY;
169
170 regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
171 regionProfile.UUID = new UUID((string)responseData["region_UUID"]);
172 regionProfile.regionName = (string)responseData["region_name"];
173 }
174 catch (WebException)
175 {
176 m_log.Error("[GRID]: " +
177 "Region lookup failed for: " + regionHandle.ToString() +
178 " - Is the GridServer down?");
179 }
180 155
181 return regionProfile; 156 private RegionProfileData GridRegionToRegionProfile(GridRegion region)
157 {
158 RegionProfileData rprofile = new RegionProfileData();
159 rprofile.httpPort = region.HttpPort;
160 rprofile.httpServerURI = region.ServerURI;
161 rprofile.regionLocX = (uint)(region.RegionLocX / Constants.RegionSize);
162 rprofile.regionLocY = (uint)(region.RegionLocY / Constants.RegionSize);
163 rprofile.RegionName = region.RegionName;
164 rprofile.ServerHttpPort = region.HttpPort;
165 rprofile.ServerIP = region.ExternalHostName;
166 rprofile.ServerPort = (uint)region.ExternalEndPoint.Port;
167 rprofile.Uuid = region.RegionID;
168 return rprofile;
182 } 169 }
183 170
184 public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient) 171 public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient)
diff --git a/prebuild.xml b/prebuild.xml
index 22ff3d7..ccc79de 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -980,10 +980,13 @@
980 <Reference name="OpenSim.Framework.Servers"/> 980 <Reference name="OpenSim.Framework.Servers"/>
981 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 981 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
982 <Reference name="OpenSim.Grid.Framework"/> 982 <Reference name="OpenSim.Grid.Framework"/>
983 <Reference name="OpenSim.Services.Interfaces"/>
984 <Reference name="OpenSim.Services.Connectors"/>
983 <Reference name="OpenMetaverseTypes.dll"/> 985 <Reference name="OpenMetaverseTypes.dll"/>
984 <Reference name="OpenMetaverse.dll"/> 986 <Reference name="OpenMetaverse.dll"/>
985 <Reference name="XMLRPC.dll"/> 987 <Reference name="XMLRPC.dll"/>
986 <Reference name="log4net.dll"/> 988 <Reference name="log4net.dll"/>
989 <Reference name="Nini.dll"/>
987 990
988 <Files> 991 <Files>
989 <Match pattern="*.cs" recurse="true"/> 992 <Match pattern="*.cs" recurse="true"/>