aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2009-09-25 07:47:58 -0700
committerDiva Canto2009-09-25 07:47:58 -0700
commit295868033f44edeb25230c2d4cf336c454693075 (patch)
tree084ff484b07d20ff12637e459742e49ef1b3e610
parentAdded GridForm.html in Tests/Clients/Grid that shows how to interact with a g... (diff)
downloadopensim-SC-295868033f44edeb25230c2d4cf336c454693075.zip
opensim-SC-295868033f44edeb25230c2d4cf336c454693075.tar.gz
opensim-SC-295868033f44edeb25230c2d4cf336c454693075.tar.bz2
opensim-SC-295868033f44edeb25230c2d4cf336c454693075.tar.xz
Better error handling on the client-side grid connector.
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs152
1 files changed, 108 insertions, 44 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index ebb66a7..748892a 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -99,18 +99,25 @@ namespace OpenSim.Services.Connectors
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 try
103 m_ServerURI + "/grid",
104 reqString);
105 if (reply != string.Empty)
106 { 103 {
107 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 104 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
105 m_ServerURI + "/grid",
106 reqString);
107 if (reply != string.Empty)
108 {
109 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
108 110
109 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 111 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
110 return true; 112 return true;
113 }
114 else
115 m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
116 }
117 catch (Exception e)
118 {
119 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
111 } 120 }
112 else
113 m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
114 121
115 return false; 122 return false;
116 } 123 }
@@ -123,19 +130,26 @@ namespace OpenSim.Services.Connectors
123 130
124 sendData["METHOD"] = "deregister"; 131 sendData["METHOD"] = "deregister";
125 132
126 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 133 try
127 m_ServerURI + "/grid",
128 ServerUtils.BuildQueryString(sendData));
129
130 if (reply != string.Empty)
131 { 134 {
132 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 135 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
136 m_ServerURI + "/grid",
137 ServerUtils.BuildQueryString(sendData));
138
139 if (reply != string.Empty)
140 {
141 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
133 142
134 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 143 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
135 return true; 144 return true;
145 }
146 else
147 m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
148 }
149 catch (Exception e)
150 {
151 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
136 } 152 }
137 else
138 m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
139 153
140 return false; 154 return false;
141 } 155 }
@@ -149,14 +163,24 @@ namespace OpenSim.Services.Connectors
149 163
150 sendData["METHOD"] = "get_neighbours"; 164 sendData["METHOD"] = "get_neighbours";
151 165
166 List<GridRegion> rinfos = new List<GridRegion>();
167
152 string reqString = ServerUtils.BuildQueryString(sendData); 168 string reqString = ServerUtils.BuildQueryString(sendData);
153 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 169 string reply = string.Empty;
154 m_ServerURI + "/grid", 170 try
155 reqString); 171 {
172 reply = SynchronousRestFormsRequester.MakeRequest("POST",
173 m_ServerURI + "/grid",
174 reqString);
175 }
176 catch (Exception e)
177 {
178 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
179 return rinfos;
180 }
156 181
157 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 182 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
158 183
159 List<GridRegion> rinfos = new List<GridRegion>();
160 if (replyData != null) 184 if (replyData != null)
161 { 185 {
162 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 186 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
@@ -189,9 +213,18 @@ namespace OpenSim.Services.Connectors
189 213
190 sendData["METHOD"] = "get_region_by_uuid"; 214 sendData["METHOD"] = "get_region_by_uuid";
191 215
192 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 216 string reply = string.Empty;
193 m_ServerURI + "/grid", 217 try
194 ServerUtils.BuildQueryString(sendData)); 218 {
219 reply = SynchronousRestFormsRequester.MakeRequest("POST",
220 m_ServerURI + "/grid",
221 ServerUtils.BuildQueryString(sendData));
222 }
223 catch (Exception e)
224 {
225 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
226 return null;
227 }
195 228
196 GridRegion rinfo = null; 229 GridRegion rinfo = null;
197 230
@@ -226,10 +259,18 @@ namespace OpenSim.Services.Connectors
226 sendData["Y"] = y.ToString(); 259 sendData["Y"] = y.ToString();
227 260
228 sendData["METHOD"] = "get_region_by_position"; 261 sendData["METHOD"] = "get_region_by_position";
229 262 string reply = string.Empty;
230 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 263 try
231 m_ServerURI + "/grid", 264 {
232 ServerUtils.BuildQueryString(sendData)); 265 reply = SynchronousRestFormsRequester.MakeRequest("POST",
266 m_ServerURI + "/grid",
267 ServerUtils.BuildQueryString(sendData));
268 }
269 catch (Exception e)
270 {
271 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
272 return null;
273 }
233 274
234 GridRegion rinfo = null; 275 GridRegion rinfo = null;
235 if (reply != string.Empty) 276 if (reply != string.Empty)
@@ -262,10 +303,18 @@ namespace OpenSim.Services.Connectors
262 sendData["NAME"] = regionName; 303 sendData["NAME"] = regionName;
263 304
264 sendData["METHOD"] = "get_region_by_name"; 305 sendData["METHOD"] = "get_region_by_name";
265 306 string reply = string.Empty;
266 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 307 try
267 m_ServerURI + "/grid", 308 {
268 ServerUtils.BuildQueryString(sendData)); 309 reply = SynchronousRestFormsRequester.MakeRequest("POST",
310 m_ServerURI + "/grid",
311 ServerUtils.BuildQueryString(sendData));
312 }
313 catch (Exception e)
314 {
315 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
316 return null;
317 }
269 318
270 GridRegion rinfo = null; 319 GridRegion rinfo = null;
271 if (reply != string.Empty) 320 if (reply != string.Empty)
@@ -296,12 +345,19 @@ namespace OpenSim.Services.Connectors
296 sendData["MAX"] = maxNumber.ToString(); 345 sendData["MAX"] = maxNumber.ToString();
297 346
298 sendData["METHOD"] = "get_regions_by_name"; 347 sendData["METHOD"] = "get_regions_by_name";
299
300 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
301 m_ServerURI + "/grid",
302 ServerUtils.BuildQueryString(sendData));
303
304 List<GridRegion> rinfos = new List<GridRegion>(); 348 List<GridRegion> rinfos = new List<GridRegion>();
349 string reply = string.Empty;
350 try
351 {
352 reply = SynchronousRestFormsRequester.MakeRequest("POST",
353 m_ServerURI + "/grid",
354 ServerUtils.BuildQueryString(sendData));
355 }
356 catch (Exception e)
357 {
358 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
359 return rinfos;
360 }
305 361
306 if (reply != string.Empty) 362 if (reply != string.Empty)
307 { 363 {
@@ -345,12 +401,20 @@ namespace OpenSim.Services.Connectors
345 sendData["METHOD"] = "get_region_range"; 401 sendData["METHOD"] = "get_region_range";
346 402
347 List<GridRegion> rinfos = new List<GridRegion>(); 403 List<GridRegion> rinfos = new List<GridRegion>();
404 string reply = string.Empty;
405 try
406 {
407 reply = SynchronousRestFormsRequester.MakeRequest("POST",
408 m_ServerURI + "/grid",
409 ServerUtils.BuildQueryString(sendData));
348 410
349 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 411 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
350 m_ServerURI + "/grid", 412 }
351 ServerUtils.BuildQueryString(sendData)); 413 catch (Exception e)
352 414 {
353 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); 415 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
416 return rinfos;
417 }
354 418
355 if (reply != string.Empty) 419 if (reply != string.Empty)
356 { 420 {