aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorDiva Canto2009-09-24 15:30:00 -0700
committerDiva Canto2009-09-24 15:30:00 -0700
commit1faaa0a43a851c44af40336336ddbe3a7dbe83af (patch)
treeab1ec0d0238fc64b9538c9ecd6d55c71c665de5b /OpenSim/Services/Connectors
parentAdded test GridClient, which allowed me to remove a few bugs out of the new c... (diff)
downloadopensim-SC_OLD-1faaa0a43a851c44af40336336ddbe3a7dbe83af.zip
opensim-SC_OLD-1faaa0a43a851c44af40336336ddbe3a7dbe83af.tar.gz
opensim-SC_OLD-1faaa0a43a851c44af40336336ddbe3a7dbe83af.tar.bz2
opensim-SC_OLD-1faaa0a43a851c44af40336336ddbe3a7dbe83af.tar.xz
GridServerPostHandler finished. GridClient tests all work. More guards on getting parameters and replies over the wire.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs151
1 files changed, 92 insertions, 59 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index fa197c8..ebb66a7 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -98,15 +98,19 @@ namespace OpenSim.Services.Connectors
98 sendData["METHOD"] = "register"; 98 sendData["METHOD"] = "register";
99 99
100 string reqString = ServerUtils.BuildQueryString(sendData); 100 string reqString = ServerUtils.BuildQueryString(sendData);
101 m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); 101 //m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
102 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 102 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
103 m_ServerURI + "/grid", 103 m_ServerURI + "/grid",
104 reqString); 104 reqString);
105 if (reply != string.Empty)
106 {
107 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
105 108
106 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 109 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
107 110 return true;
108 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 111 }
109 return true; 112 else
113 m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
110 114
111 return false; 115 return false;
112 } 116 }
@@ -123,10 +127,15 @@ namespace OpenSim.Services.Connectors
123 m_ServerURI + "/grid", 127 m_ServerURI + "/grid",
124 ServerUtils.BuildQueryString(sendData)); 128 ServerUtils.BuildQueryString(sendData));
125 129
126 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 130 if (reply != string.Empty)
131 {
132 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
127 133
128 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 134 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
129 return true; 135 return true;
136 }
137 else
138 m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
130 139
131 return false; 140 return false;
132 } 141 }
@@ -151,7 +160,7 @@ namespace OpenSim.Services.Connectors
151 if (replyData != null) 160 if (replyData != null)
152 { 161 {
153 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 162 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
154 m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); 163 //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
155 foreach (object r in rinfosList) 164 foreach (object r in rinfosList)
156 { 165 {
157 if (r is Dictionary<string, object>) 166 if (r is Dictionary<string, object>)
@@ -184,20 +193,26 @@ namespace OpenSim.Services.Connectors
184 m_ServerURI + "/grid", 193 m_ServerURI + "/grid",
185 ServerUtils.BuildQueryString(sendData)); 194 ServerUtils.BuildQueryString(sendData));
186 195
187 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
188
189 GridRegion rinfo = null; 196 GridRegion rinfo = null;
190 if ((replyData != null) && (replyData["result"] != null)) 197
198 if (reply != string.Empty)
191 { 199 {
192 if (replyData["result"] is Dictionary<string, object>) 200 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
193 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); 201
202 if ((replyData != null) && (replyData["result"] != null))
203 {
204 if (replyData["result"] is Dictionary<string, object>)
205 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
206 //else
207 // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
208 // scopeID, regionID);
209 }
194 else 210 else
195 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received invalid response", 211 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
196 scopeID, regionID); 212 scopeID, regionID);
197 } 213 }
198 else 214 else
199 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", 215 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply");
200 scopeID, regionID);
201 216
202 return rinfo; 217 return rinfo;
203 } 218 }
@@ -216,20 +231,25 @@ namespace OpenSim.Services.Connectors
216 m_ServerURI + "/grid", 231 m_ServerURI + "/grid",
217 ServerUtils.BuildQueryString(sendData)); 232 ServerUtils.BuildQueryString(sendData));
218 233
219 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
220
221 GridRegion rinfo = null; 234 GridRegion rinfo = null;
222 if ((replyData != null) && (replyData["result"] != null)) 235 if (reply != string.Empty)
223 { 236 {
224 if (replyData["result"] is Dictionary<string, object>) 237 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
225 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); 238
239 if ((replyData != null) && (replyData["result"] != null))
240 {
241 if (replyData["result"] is Dictionary<string, object>)
242 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
243 else
244 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response",
245 scopeID, x, y);
246 }
226 else 247 else
227 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response", 248 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response",
228 scopeID, x, y); 249 scopeID, x, y);
229 } 250 }
230 else 251 else
231 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", 252 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply");
232 scopeID, x, y);
233 253
234 return rinfo; 254 return rinfo;
235 } 255 }
@@ -247,20 +267,22 @@ namespace OpenSim.Services.Connectors
247 m_ServerURI + "/grid", 267 m_ServerURI + "/grid",
248 ServerUtils.BuildQueryString(sendData)); 268 ServerUtils.BuildQueryString(sendData));
249 269
250 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
251
252 GridRegion rinfo = null; 270 GridRegion rinfo = null;
253 if ((replyData != null) && (replyData["result"] != null)) 271 if (reply != string.Empty)
254 { 272 {
255 if (replyData["result"] is Dictionary<string, object>) 273 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
256 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); 274
275 if ((replyData != null) && (replyData["result"] != null))
276 {
277 if (replyData["result"] is Dictionary<string, object>)
278 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
279 }
257 else 280 else
258 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received invalid response", 281 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response",
259 scopeID, regionName); 282 scopeID, regionName);
260 } 283 }
261 else 284 else
262 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", 285 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply");
263 scopeID, regionName);
264 286
265 return rinfo; 287 return rinfo;
266 } 288 }
@@ -279,27 +301,33 @@ namespace OpenSim.Services.Connectors
279 m_ServerURI + "/grid", 301 m_ServerURI + "/grid",
280 ServerUtils.BuildQueryString(sendData)); 302 ServerUtils.BuildQueryString(sendData));
281 303
282 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
283
284 List<GridRegion> rinfos = new List<GridRegion>(); 304 List<GridRegion> rinfos = new List<GridRegion>();
285 if (replyData != null) 305
306 if (reply != string.Empty)
286 { 307 {
287 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 308 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
288 foreach (object r in rinfosList) 309
310 if (replyData != null)
289 { 311 {
290 if (r is Dictionary<string, object>) 312 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
313 foreach (object r in rinfosList)
291 { 314 {
292 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); 315 if (r is Dictionary<string, object>)
293 rinfos.Add(rinfo); 316 {
317 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
318 rinfos.Add(rinfo);
319 }
320 else
321 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
322 scopeID, name, maxNumber);
294 } 323 }
295 else
296 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
297 scopeID, name, maxNumber);
298 } 324 }
325 else
326 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
327 scopeID, name, maxNumber);
299 } 328 }
300 else 329 else
301 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response", 330 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply");
302 scopeID, name, maxNumber);
303 331
304 return rinfos; 332 return rinfos;
305 } 333 }
@@ -316,31 +344,36 @@ namespace OpenSim.Services.Connectors
316 344
317 sendData["METHOD"] = "get_region_range"; 345 sendData["METHOD"] = "get_region_range";
318 346
347 List<GridRegion> rinfos = new List<GridRegion>();
348
319 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 349 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
320 m_ServerURI + "/grid", 350 m_ServerURI + "/grid",
321 ServerUtils.BuildQueryString(sendData)); 351 ServerUtils.BuildQueryString(sendData));
322 352
323 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 353 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
324 354
325 List<GridRegion> rinfos = new List<GridRegion>(); 355 if (reply != string.Empty)
326 if (replyData != null)
327 { 356 {
328 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 357 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
329 foreach (object r in rinfosList) 358
359 if (replyData != null)
330 { 360 {
331 if (r is Dictionary<string, object>) 361 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
362 foreach (object r in rinfosList)
332 { 363 {
333 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); 364 if (r is Dictionary<string, object>)
334 rinfos.Add(rinfo); 365 {
366 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
367 rinfos.Add(rinfo);
368 }
335 } 369 }
336 else
337 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received invalid response",
338 scopeID, xmin, xmax, ymin, ymax);
339 } 370 }
371 else
372 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response",
373 scopeID, xmin, xmax, ymin, ymax);
340 } 374 }
341 else 375 else
342 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response", 376 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange received null reply");
343 scopeID, xmin, xmax, ymin, ymax);
344 377
345 return rinfos; 378 return rinfos;
346 } 379 }