From f773733fcb6ef18ddb70d597cdf6f1e334dcf13e Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 13 Dec 2007 19:50:21 +0000 Subject: From Michael Osias (IBM) This patch makes some enhancements to the llRemoteData functions. The module is now a shared module, and allows remote data channels to be created among multiple regions in the same sim. The port is controlled from the remoteDataPort property under the [Network] section in OpenSim.ini. If this setting is not present or = 0, the module is disabled and no port is opened. llRemoteData commands have not effect when module is disabled. --- OpenSim/Region/Environment/Modules/XMLRPCModule.cs | 49 +++++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/XMLRPCModule.cs') diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs index 2618b17..f139d64 100644 --- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs @@ -26,6 +26,7 @@ * */ +using System; using System.Collections; using System.Collections.Generic; using System.Threading; @@ -35,6 +36,7 @@ using Nwc.XmlRpc; using OpenSim.Framework.Servers; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; +using OpenSim.Framework.Console; /***************************************************** * @@ -77,8 +79,11 @@ namespace OpenSim.Region.Environment.Modules private Queue rpcQueue = new Queue(); private object XMLRPCListLock = new object(); private string m_name = "XMLRPCModule"; - private int RemoteReplyScriptWait = 100; - private int RemoteReplyScriptTimeout = 300; + private int RemoteReplyScriptWait = 300; + private int RemoteReplyScriptTimeout = 900; + private int m_remoteDataPort = 0; + private List m_scenes = new List(); + private LogBase m_log; // private Dictionary m_openChannels; @@ -88,26 +93,43 @@ namespace OpenSim.Region.Environment.Modules public XMLRPCModule() { + m_log = MainLog.Instance; } public void Initialise(Scene scene, IConfigSource config) { - m_scene = scene; + try + { + + m_remoteDataPort = config.Configs["Network"].GetInt("remoteDataPort", m_remoteDataPort); - m_scene.RegisterModuleInterface(this); + } + catch (Exception e) + { + } - m_openChannels = new Dictionary(); - m_pendingResponse = new Dictionary(); + if (!m_scenes.Contains(scene)) + { + m_scenes.Add(scene); - // Start http server - // Attach xmlrpc handlers - BaseHttpServer httpServer = new BaseHttpServer(20800); - httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); - httpServer.Start(); + scene.RegisterModuleInterface(this); + } } public void PostInitialise() { + if ( IsEnabled() ) + { + m_openChannels = new Dictionary(); + m_pendingResponse = new Dictionary(); + + // Start http server + // Attach xmlrpc handlers + m_log.Verbose("REMOTE_DATA", "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); + BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); + httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); + httpServer.Start(); + } } public void Close() @@ -124,6 +146,11 @@ namespace OpenSim.Region.Environment.Modules get { return true; } } + public bool IsEnabled() + { + return (m_remoteDataPort > 0); + } + /********************************************** * OpenXMLRPCChannel * -- cgit v1.1