In remote QueryAccess, also receive the actual status (true|false) instead of always true no matter what the callee actually returned.

This was due to two things
1) SimulationServiceConnector.QueryAccess was always looking to the outer result["success"].
But if a "_Result" map is returned (which is certainly the case right now), then the true success is _Result["success"], result["success"] is always true no matter what
2) If QueryAccess was false at the destination, then AgentHandlers.DoQueryAccess() was never putting this in the result.
The default action of SerializeJsonString() is not to put false booleans in the JSON!!!, so this has to be explicitly set.
0.7.4.1
Justin Clark-Casey (justincc) 2012-05-25 01:41:00 +01:00
parent 93ff27053a
commit 7cceab1295
2 changed files with 9 additions and 2 deletions

View File

@ -144,13 +144,16 @@ namespace OpenSim.Server.Handlers.Simulation
responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["int_response_code"] = HttpStatusCode.OK;
OSDMap resp = new OSDMap(2); OSDMap resp = new OSDMap(3);
resp["success"] = OSD.FromBoolean(result); resp["success"] = OSD.FromBoolean(result);
resp["reason"] = OSD.FromString(reason); resp["reason"] = OSD.FromString(reason);
resp["version"] = OSD.FromString(version); resp["version"] = OSD.FromString(version);
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map!
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
} }
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)

View File

@ -320,6 +320,10 @@ namespace OpenSim.Services.Connectors.Simulation
{ {
OSDMap data = (OSDMap)result["_Result"]; OSDMap data = (OSDMap)result["_Result"];
// FIXME: If there is a _Result map then it's the success key here that indicates the true success
// or failure, not the sibling result node.
success = data["success"];
reason = data["reason"].AsString(); reason = data["reason"].AsString();
if (data["version"] != null && data["version"].AsString() != string.Empty) if (data["version"] != null && data["version"].AsString() != string.Empty)
version = data["version"].AsString(); version = data["version"].AsString();