diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index cc56078..9e74148 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
50 | public class OGS1GridServices : IGridServices, IInterRegionCommunications | 50 | public class OGS1GridServices : IGridServices, IInterRegionCommunications |
51 | { | 51 | { |
52 | private LocalBackEndServices m_localBackend = new LocalBackEndServices(); | 52 | private LocalBackEndServices m_localBackend = new LocalBackEndServices(); |
53 | private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); | ||
53 | 54 | ||
54 | public BaseHttpServer httpListener; | 55 | public BaseHttpServer httpListener; |
55 | public NetworkServersInfo serversInfo; | 56 | public NetworkServersInfo serversInfo; |
@@ -89,7 +90,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
89 | GridParams["sim_name"] = regionInfo.RegionName; | 90 | GridParams["sim_name"] = regionInfo.RegionName; |
90 | GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); | 91 | GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); |
91 | GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString(); | 92 | GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString(); |
92 | GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated(); | 93 | GridParams["map-image-id"] = regionInfo.EstateSettings.terrainImageID.ToStringHyphenated(); |
93 | 94 | ||
94 | // Package into an XMLRPC Request | 95 | // Package into an XMLRPC Request |
95 | ArrayList SendParams = new ArrayList(); | 96 | ArrayList SendParams = new ArrayList(); |
@@ -152,6 +153,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
152 | return neighbours; | 153 | return neighbours; |
153 | } | 154 | } |
154 | 155 | ||
156 | |||
155 | /// <summary> | 157 | /// <summary> |
156 | /// | 158 | /// |
157 | /// </summary> | 159 | /// </summary> |
@@ -166,37 +168,45 @@ namespace OpenSim.Region.Communications.OGS1 | |||
166 | return regionInfo; | 168 | return regionInfo; |
167 | } | 169 | } |
168 | 170 | ||
169 | Hashtable requestData = new Hashtable(); | 171 | if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) |
170 | requestData["region_handle"] = regionHandle.ToString(); | ||
171 | requestData["authkey"] = this.serversInfo.GridSendKey; | ||
172 | ArrayList SendParams = new ArrayList(); | ||
173 | SendParams.Add(requestData); | ||
174 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
175 | XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); | ||
176 | |||
177 | Hashtable responseData = (Hashtable)GridResp.Value; | ||
178 | |||
179 | if (responseData.ContainsKey("error")) | ||
180 | { | 172 | { |
181 | Console.WriteLine("error received from grid server" + responseData["error"]); | ||
182 | return null; | ||
183 | } | 173 | } |
174 | else | ||
175 | { | ||
176 | Hashtable requestData = new Hashtable(); | ||
177 | requestData["region_handle"] = regionHandle.ToString(); | ||
178 | requestData["authkey"] = this.serversInfo.GridSendKey; | ||
179 | ArrayList SendParams = new ArrayList(); | ||
180 | SendParams.Add(requestData); | ||
181 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
182 | XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); | ||
184 | 183 | ||
185 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); | 184 | Hashtable responseData = (Hashtable) GridResp.Value; |
186 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); | ||
187 | string internalIpStr = (string)responseData["sim_ip"]; | ||
188 | uint port = Convert.ToUInt32(responseData["sim_port"]); | ||
189 | string externalUri = (string)responseData["sim_uri"]; | ||
190 | 185 | ||
191 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); | 186 | if (responseData.ContainsKey("error")) |
192 | string neighbourExternalUri = externalUri; | 187 | { |
193 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); | 188 | Console.WriteLine("error received from grid server" + responseData["error"]); |
189 | return null; | ||
190 | } | ||
191 | |||
192 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
193 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
194 | string internalIpStr = (string) responseData["sim_ip"]; | ||
195 | uint port = Convert.ToUInt32(responseData["sim_port"]); | ||
196 | string externalUri = (string) responseData["sim_uri"]; | ||
194 | 197 | ||
195 | regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 198 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); |
196 | regionInfo.RemotingAddress = internalIpStr; | 199 | string neighbourExternalUri = externalUri; |
200 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); | ||
197 | 201 | ||
198 | regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); | 202 | regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); |
199 | regionInfo.RegionName = (string)responseData["region_name"]; | 203 | regionInfo.RemotingAddress = internalIpStr; |
204 | |||
205 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); | ||
206 | regionInfo.RegionName = (string) responseData["region_name"]; | ||
207 | |||
208 | m_remoteRegionInfoCache.Add( regionHandle, regionInfo ); | ||
209 | } | ||
200 | 210 | ||
201 | return regionInfo; | 211 | return regionInfo; |
202 | } | 212 | } |