Add additional return status
Adding additional return status for JsonRpcMethod. Now returns true/falseuser_profiles
parent
a6afd2f706
commit
1776986dc3
|
@ -1026,6 +1026,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
// JsonRpc (v2.0 only)
|
||||
// Batch requests not yet supported
|
||||
private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
Stream requestStream = request.InputStream;
|
||||
|
@ -1065,8 +1066,26 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
jsonRpcHandlers.TryGetValue(methodname, out method);
|
||||
}
|
||||
|
||||
method(jsonRpcRequest, ref jsonRpcResponse);
|
||||
bool res = false;
|
||||
try
|
||||
{
|
||||
res = method(jsonRpcRequest, ref jsonRpcResponse);
|
||||
if(!res)
|
||||
{
|
||||
// The handler sent back an unspecified error
|
||||
if(jsonRpcResponse.Error.Code == 0)
|
||||
{
|
||||
jsonRpcResponse.Error.Code = ErrorCode.InternalError;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string ErrorMessage = string.Format("[BASE HTTP SERVER]: Json-Rpc Handler Error method {0} - {1}", methodname, e.Message);
|
||||
m_log.Error(ErrorMessage);
|
||||
jsonRpcResponse.Error.Code = ErrorCode.InternalError;
|
||||
jsonRpcResponse.Error.Message = ErrorMessage;
|
||||
}
|
||||
}
|
||||
else // Error no hanlder defined for requested method
|
||||
{
|
||||
|
|
|
@ -30,5 +30,5 @@ using OpenMetaverse.StructuredData;
|
|||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate void JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response);
|
||||
public delegate bool JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue