Improve the error messages returned if the HelloNeighbour call fails.
This is the message a region sends to its neighbours when it comes upiar_mods
parent
c4e4a29478
commit
b89c48b1be
|
@ -87,12 +87,26 @@ namespace OpenSim.Services.Connectors
|
||||||
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
|
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
string uri = region.ServerURI + "region/" + thisRegion.RegionID + "/";
|
string uri = region.ServerURI + "region/" + thisRegion.RegionID + "/";
|
||||||
//m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
|
// m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
|
||||||
|
|
||||||
WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
|
WebRequest helloNeighbourRequest;
|
||||||
HelloNeighbourRequest.Method = "POST";
|
|
||||||
HelloNeighbourRequest.ContentType = "application/json";
|
try
|
||||||
HelloNeighbourRequest.Timeout = 10000;
|
{
|
||||||
|
helloNeighbourRequest = WebRequest.Create(uri);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[NEIGHBOUR SERVICE CONNCTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}",
|
||||||
|
uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
helloNeighbourRequest.Method = "POST";
|
||||||
|
helloNeighbourRequest.ContentType = "application/json";
|
||||||
|
helloNeighbourRequest.Timeout = 10000;
|
||||||
|
|
||||||
// Fill it in
|
// Fill it in
|
||||||
OSDMap args = null;
|
OSDMap args = null;
|
||||||
|
@ -102,38 +116,48 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message);
|
m_log.WarnFormat(
|
||||||
|
"[NEIGHBOUR SERVICE CONNCTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}",
|
||||||
|
thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the regionhandle of the destination region
|
// Add the regionhandle of the destination region
|
||||||
args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString());
|
args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString());
|
||||||
|
|
||||||
string strBuffer = "";
|
string strBuffer = "";
|
||||||
byte[] buffer = new byte[1];
|
byte[] buffer = new byte[1];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
strBuffer = OSDParser.SerializeJsonString(args);
|
strBuffer = OSDParser.SerializeJsonString(args);
|
||||||
UTF8Encoding str = new UTF8Encoding();
|
UTF8Encoding str = new UTF8Encoding();
|
||||||
buffer = str.GetBytes(strBuffer);
|
buffer = str.GetBytes(strBuffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message);
|
m_log.WarnFormat(
|
||||||
|
"[NEIGHBOUR SERVICE CONNCTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}",
|
||||||
|
thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream os = null;
|
Stream os = null;
|
||||||
try
|
try
|
||||||
{ // send the Post
|
{ // send the Post
|
||||||
HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
|
helloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
|
||||||
os = HelloNeighbourRequest.GetRequestStream();
|
os = helloNeighbourRequest.GetRequestStream();
|
||||||
os.Write(buffer, 0, strBuffer.Length); //Send it
|
os.Write(buffer, 0, strBuffer.Length); //Send it
|
||||||
//m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
|
//m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REST COMMS]: Unable to send HelloNeighbour to {0}: {1}", region.RegionName, ex.Message);
|
m_log.WarnFormat(
|
||||||
|
"[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}",
|
||||||
|
thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -148,10 +172,12 @@ namespace OpenSim.Services.Connectors
|
||||||
StreamReader sr = null;
|
StreamReader sr = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WebResponse webResponse = HelloNeighbourRequest.GetResponse();
|
WebResponse webResponse = helloNeighbourRequest.GetResponse();
|
||||||
if (webResponse == null)
|
if (webResponse == null)
|
||||||
{
|
{
|
||||||
m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post");
|
m_log.DebugFormat(
|
||||||
|
"[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}",
|
||||||
|
thisRegion.RegionName, region.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
sr = new StreamReader(webResponse.GetResponseStream());
|
sr = new StreamReader(webResponse.GetResponseStream());
|
||||||
|
@ -160,9 +186,12 @@ namespace OpenSim.Services.Connectors
|
||||||
//m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
|
//m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message);
|
m_log.WarnFormat(
|
||||||
|
"[NEIGHBOUR SERVICE CONNCTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}",
|
||||||
|
region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -172,8 +201,6 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue