Never call Environment.Exit() from a library, This terminates the process on an estate lookup that fails if the estate doesnt exist, Do a null exit to signal no available data and let the caller decide how to handle it.
Some checks are pending
CodeQL / Analyze (push) Waiting to run
dotnet package / build (8.0.x) (push) Waiting to run
dotnet package / build (9.0.x) (push) Waiting to run

This commit is contained in:
Mike Dickson 2024-09-19 19:39:37 -04:00
parent 0e0953667c
commit d978ab12b4
2 changed files with 14 additions and 5 deletions

View file

@ -39,7 +39,7 @@ namespace OpenSim
{
public const string VersionNumber = "0.9.3";
public const string AssemblyVersionNumber = "0.9.3";
public const string Release = "8999";
public const string Release = "9026";
public static string Version
{

View file

@ -195,17 +195,24 @@ namespace OpenSim.Services.Connectors
// /estates/estate/?region=uuid&create=[t|f]
string uri = m_ServerURI + string.Format("/estates/estate/?region={0}&create={1}", regionID, create);
//MakeRequest is bugged as its using the older deprecated WebRequest. A call to the estate
// service here will return a 404 if the estate doesnt exist which is correct but the code
// assumes thats a fatal error. BTW We should never ever call Enviroinment.Exit from a supporting
// module or a library like this. So its gonna go.
reply = MakeRequest("GET", uri, string.Empty);
if(reply == null)
if (reply is null)
{
// this is a fatal error
m_log.DebugFormat("[ESTATE CONNECTOR] connection to remote estates service failed");
m_log.DebugFormat("[ESTATE CONNECTOR] simulator needs to terminate");
Environment.Exit(-1);
//m_log.DebugFormat("[ESTATE CONNECTOR] simulator needs to terminate");
//Environment.Exit(-1);
return null;
}
if (String.IsNullOrEmpty(reply))
{
return null;
}
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -216,7 +223,9 @@ namespace OpenSim.Services.Connectors
return es;
}
else
{
m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings(regionID) from {0} received null or zero response", uri);
}
return null;
}