Better error handling on the client-side grid connector.
parent
b2772b3a2d
commit
295868033f
|
@ -99,6 +99,8 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||||
//m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
|
//m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
|
||||||
|
try
|
||||||
|
{
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
reqString);
|
reqString);
|
||||||
|
@ -111,6 +113,11 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
|
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +130,8 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
sendData["METHOD"] = "deregister";
|
sendData["METHOD"] = "deregister";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
ServerUtils.BuildQueryString(sendData));
|
ServerUtils.BuildQueryString(sendData));
|
||||||
|
@ -136,6 +145,11 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
|
m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -149,14 +163,24 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
sendData["METHOD"] = "get_neighbours";
|
sendData["METHOD"] = "get_neighbours";
|
||||||
|
|
||||||
|
List<GridRegion> rinfos = new List<GridRegion>();
|
||||||
|
|
||||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
string reply = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
reqString);
|
reqString);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
return rinfos;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||||
|
|
||||||
List<GridRegion> rinfos = new List<GridRegion>();
|
|
||||||
if (replyData != null)
|
if (replyData != null)
|
||||||
{
|
{
|
||||||
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
|
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
|
||||||
|
@ -189,9 +213,18 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
sendData["METHOD"] = "get_region_by_uuid";
|
sendData["METHOD"] = "get_region_by_uuid";
|
||||||
|
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
string reply = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
ServerUtils.BuildQueryString(sendData));
|
ServerUtils.BuildQueryString(sendData));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
GridRegion rinfo = null;
|
GridRegion rinfo = null;
|
||||||
|
|
||||||
|
@ -226,10 +259,18 @@ namespace OpenSim.Services.Connectors
|
||||||
sendData["Y"] = y.ToString();
|
sendData["Y"] = y.ToString();
|
||||||
|
|
||||||
sendData["METHOD"] = "get_region_by_position";
|
sendData["METHOD"] = "get_region_by_position";
|
||||||
|
string reply = string.Empty;
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
ServerUtils.BuildQueryString(sendData));
|
ServerUtils.BuildQueryString(sendData));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
GridRegion rinfo = null;
|
GridRegion rinfo = null;
|
||||||
if (reply != string.Empty)
|
if (reply != string.Empty)
|
||||||
|
@ -262,10 +303,18 @@ namespace OpenSim.Services.Connectors
|
||||||
sendData["NAME"] = regionName;
|
sendData["NAME"] = regionName;
|
||||||
|
|
||||||
sendData["METHOD"] = "get_region_by_name";
|
sendData["METHOD"] = "get_region_by_name";
|
||||||
|
string reply = string.Empty;
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
ServerUtils.BuildQueryString(sendData));
|
ServerUtils.BuildQueryString(sendData));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
GridRegion rinfo = null;
|
GridRegion rinfo = null;
|
||||||
if (reply != string.Empty)
|
if (reply != string.Empty)
|
||||||
|
@ -296,12 +345,19 @@ namespace OpenSim.Services.Connectors
|
||||||
sendData["MAX"] = maxNumber.ToString();
|
sendData["MAX"] = maxNumber.ToString();
|
||||||
|
|
||||||
sendData["METHOD"] = "get_regions_by_name";
|
sendData["METHOD"] = "get_regions_by_name";
|
||||||
|
List<GridRegion> rinfos = new List<GridRegion>();
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
string reply = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
ServerUtils.BuildQueryString(sendData));
|
ServerUtils.BuildQueryString(sendData));
|
||||||
|
}
|
||||||
List<GridRegion> rinfos = new List<GridRegion>();
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
return rinfos;
|
||||||
|
}
|
||||||
|
|
||||||
if (reply != string.Empty)
|
if (reply != string.Empty)
|
||||||
{
|
{
|
||||||
|
@ -345,12 +401,20 @@ namespace OpenSim.Services.Connectors
|
||||||
sendData["METHOD"] = "get_region_range";
|
sendData["METHOD"] = "get_region_range";
|
||||||
|
|
||||||
List<GridRegion> rinfos = new List<GridRegion>();
|
List<GridRegion> rinfos = new List<GridRegion>();
|
||||||
|
string reply = string.Empty;
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
m_ServerURI + "/grid",
|
m_ServerURI + "/grid",
|
||||||
ServerUtils.BuildQueryString(sendData));
|
ServerUtils.BuildQueryString(sendData));
|
||||||
|
|
||||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||||
|
return rinfos;
|
||||||
|
}
|
||||||
|
|
||||||
if (reply != string.Empty)
|
if (reply != string.Empty)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue