aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer
diff options
context:
space:
mode:
authorBlueWall2013-01-23 08:14:21 -0500
committerBlueWall2013-01-23 08:14:21 -0500
commit1776986dc30d0ed5629da797a3a5c0bcdf4e9f72 (patch)
tree3be15cadc062392d478b2008fa6f2469084beb92 /OpenSim/Framework/Servers/HttpServer
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-1776986dc30d0ed5629da797a3a5c0bcdf4e9f72.zip
opensim-SC_OLD-1776986dc30d0ed5629da797a3a5c0bcdf4e9f72.tar.gz
opensim-SC_OLD-1776986dc30d0ed5629da797a3a5c0bcdf4e9f72.tar.bz2
opensim-SC_OLD-1776986dc30d0ed5629da797a3a5c0bcdf4e9f72.tar.xz
Add additional return status
Adding additional return status for JsonRpcMethod. Now returns true/false
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs25
-rw-r--r--OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs2
2 files changed, 23 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 85b19c0..cf1c753 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1025,7 +1025,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1025 return buffer; 1025 return buffer;
1026 } 1026 }
1027 1027
1028 // JsonRpc (v2.0 only) 1028 // JsonRpc (v2.0 only)
1029 // Batch requests not yet supported
1029 private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) 1030 private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response)
1030 { 1031 {
1031 Stream requestStream = request.InputStream; 1032 Stream requestStream = request.InputStream;
@@ -1065,8 +1066,26 @@ namespace OpenSim.Framework.Servers.HttpServer
1065 { 1066 {
1066 jsonRpcHandlers.TryGetValue(methodname, out method); 1067 jsonRpcHandlers.TryGetValue(methodname, out method);
1067 } 1068 }
1068 1069 bool res = false;
1069 method(jsonRpcRequest, ref jsonRpcResponse); 1070 try
1071 {
1072 res = method(jsonRpcRequest, ref jsonRpcResponse);
1073 if(!res)
1074 {
1075 // The handler sent back an unspecified error
1076 if(jsonRpcResponse.Error.Code == 0)
1077 {
1078 jsonRpcResponse.Error.Code = ErrorCode.InternalError;
1079 }
1080 }
1081 }
1082 catch (Exception e)
1083 {
1084 string ErrorMessage = string.Format("[BASE HTTP SERVER]: Json-Rpc Handler Error method {0} - {1}", methodname, e.Message);
1085 m_log.Error(ErrorMessage);
1086 jsonRpcResponse.Error.Code = ErrorCode.InternalError;
1087 jsonRpcResponse.Error.Message = ErrorMessage;
1088 }
1070 } 1089 }
1071 else // Error no hanlder defined for requested method 1090 else // Error no hanlder defined for requested method
1072 { 1091 {
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs b/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs
index 7334049..5bab508 100644
--- a/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs
+++ b/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs
@@ -30,5 +30,5 @@ using OpenMetaverse.StructuredData;
30 30
31namespace OpenSim.Framework.Servers.HttpServer 31namespace OpenSim.Framework.Servers.HttpServer
32{ 32{
33 public delegate void JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response); 33 public delegate bool JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response);
34} 34}