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).
0.6.0-stable
Dr Scofield 2008-10-23 10:15:19 +00:00
parent dbd8e1edb5
commit b91857b8f7
3 changed files with 35 additions and 14 deletions

View File

@ -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)

View File

@ -104,6 +104,13 @@ namespace OpenSim.Framework.Communications
/// </summary>
protected IUserServiceAdmin m_userServiceAdmin;
public BaseHttpServer HttpServer
{
get { return m_httpServer; }
}
protected BaseHttpServer m_httpServer;
/// <summary>
/// Constructor
/// </summary>
@ -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);
}

View File

@ -54,6 +54,7 @@ namespace OpenSim.Framework.Servers
protected HttpListener m_httpListener;
protected CoolHTTPListener m_httpListener2;
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
protected Dictionary<string, bool> m_rpcHandlersKeepAlive = new Dictionary<string, bool>();
protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
@ -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
{