Skip to content

Commit

Permalink
Never call Environment.Exit() from a library, This terminates the pro…
Browse files Browse the repository at this point in the history
…cess 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.
  • Loading branch information
mdickson committed Sep 19, 2024
1 parent 0e09536 commit d978ab1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion OpenSim/Framework/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class VersionInfo
{
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
{
Expand Down
17 changes: 13 additions & 4 deletions OpenSim/Services/Connectors/Estate/EstateDataConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,24 @@ public EstateSettings LoadEstateSettings(UUID regionID, bool create)
// /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);

Expand All @@ -216,7 +223,9 @@ public EstateSettings LoadEstateSettings(UUID regionID, bool create)
return es;
}
else
{
m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings(regionID) from {0} received null or zero response", uri);
}

return null;
}
Expand Down

0 comments on commit d978ab1

Please sign in to comment.