aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2009-10-03 11:55:52 -0700
committerDiva Canto2009-10-03 11:55:52 -0700
commitb75b8877981dc1ed07f38f55e3152cf2770911df (patch)
tree95e8440916967b7eb778c25b4789a0501466c7a9 /OpenSim
parentMore streams closed. (diff)
downloadopensim-SC_OLD-b75b8877981dc1ed07f38f55e3152cf2770911df.zip
opensim-SC_OLD-b75b8877981dc1ed07f38f55e3152cf2770911df.tar.gz
opensim-SC_OLD-b75b8877981dc1ed07f38f55e3152cf2770911df.tar.bz2
opensim-SC_OLD-b75b8877981dc1ed07f38f55e3152cf2770911df.tar.xz
Fixed interface between the Messaging server and the grid server.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs71
1 files changed, 29 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)