From b91857b8f7809b9bddfa5d36c1ccf84e8142d22b Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Thu, 23 Oct 2008 10:15:19 +0000
Subject: Adding AddXmlRpcHandler(name, method, bool) to selectively disable
KeepAlive for certain XmlRpc handlers.
Making use of new AddXmlRpcHandler method in RemoteAdminPlugin to
avoid clients waiting indefinitely for response.
taking note of BaseHttpServer parameter in CommunicationsManager
constructor (was passed it but then just ignored so far).
---
.../RemoteController/RemoteAdminPlugin.cs | 28 +++++++++++-----------
.../Communications/CommunicationsManager.cs | 8 +++++++
OpenSim/Framework/Servers/BaseHttpServer.cs | 13 ++++++++++
3 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index fed6ecb..d7ca679 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -85,20 +85,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_app = openSim;
m_httpd = openSim.HttpServer;
- m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod);
- m_httpd.AddXmlRPCHandler("admin_delete_region", XmlRpcDeleteRegionMethod);
- m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod);
- m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod);
- m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
- m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod);
- m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
- m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod);
- m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod);
- m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
- m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod);
- m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod);
- m_httpd.AddXmlRPCHandler("admin_save_oar", XmlRpcSaveOARMethod);
- m_httpd.AddXmlRPCHandler("admin_region_query", XmlRpcRegionQueryMethod);
+ m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_delete_region", XmlRpcDeleteRegionMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_save_oar", XmlRpcSaveOARMethod, false);
+ m_httpd.AddXmlRPCHandler("admin_region_query", XmlRpcRegionQueryMethod, false);
}
}
catch (NullReferenceException)
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 1bf8c05..dfe0fdc 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -104,6 +104,13 @@ namespace OpenSim.Framework.Communications
///
protected IUserServiceAdmin m_userServiceAdmin;
+
+ public BaseHttpServer HttpServer
+ {
+ get { return m_httpServer; }
+ }
+ protected BaseHttpServer m_httpServer;
+
///
/// Constructor
///
@@ -117,6 +124,7 @@ namespace OpenSim.Framework.Communications
m_networkServersInfo = serversInfo;
m_assetCache = assetCache;
m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder);
+ m_httpServer = httpServer;
// m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 7e8130a..3d125fb 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Framework.Servers
protected HttpListener m_httpListener;
protected CoolHTTPListener m_httpListener2;
protected Dictionary m_rpcHandlers = new Dictionary();
+ protected Dictionary m_rpcHandlersKeepAlive = new Dictionary();
protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/
protected Dictionary m_llsdHandlers = new Dictionary();
protected Dictionary m_streamHandlers = new Dictionary();
@@ -141,6 +142,17 @@ namespace OpenSim.Framework.Servers
lock (m_rpcHandlers)
{
m_rpcHandlers[method] = handler;
+ m_rpcHandlersKeepAlive[method] = true; // default
+ return true;
+ }
+ }
+
+ public bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive)
+ {
+ lock (m_rpcHandlers)
+ {
+ m_rpcHandlers[method] = handler;
+ m_rpcHandlersKeepAlive[method] = keepAlive; // default
return true;
}
}
@@ -584,6 +596,7 @@ namespace OpenSim.Framework.Servers
}
responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
+ response.KeepAlive = m_rpcHandlersKeepAlive[methodName];
}
else
{
--
cgit v1.1