diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 85b19c0..b24336d 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 | { |
@@ -1731,6 +1750,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1731 | 1750 | ||
1732 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 1751 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
1733 | m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); | 1752 | m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); |
1753 | m_PollServiceManager.Start(); | ||
1734 | HTTPDRunning = true; | 1754 | HTTPDRunning = true; |
1735 | 1755 | ||
1736 | //HttpListenerContext context; | 1756 | //HttpListenerContext context; |
@@ -1781,6 +1801,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1781 | HTTPDRunning = false; | 1801 | HTTPDRunning = false; |
1782 | try | 1802 | try |
1783 | { | 1803 | { |
1804 | m_PollServiceManager.Stop(); | ||
1805 | |||
1784 | m_httpListener2.ExceptionThrown -= httpServerException; | 1806 | m_httpListener2.ExceptionThrown -= httpServerException; |
1785 | //m_httpListener2.DisconnectHandler = null; | 1807 | //m_httpListener2.DisconnectHandler = null; |
1786 | 1808 | ||