aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs51
1 files changed, 41 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index 27b64bf..a9147fb6 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using Nwc.XmlRpc; 37using Nwc.XmlRpc;
37using OpenMetaverse; 38using OpenMetaverse;
@@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes;
76 77
77namespace OpenSim.Region.CoreModules.Scripting.XMLRPC 78namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
78{ 79{
79 public class XMLRPCModule : IRegionModule, IXMLRPC 80 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
81 public class XMLRPCModule : ISharedRegionModule, IXMLRPC
80 { 82 {
81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
82 84
@@ -94,9 +96,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
94 private int RemoteReplyScriptWait = 300; 96 private int RemoteReplyScriptWait = 300;
95 private object XMLRPCListLock = new object(); 97 private object XMLRPCListLock = new object();
96 98
97 #region IRegionModule Members 99 #region ISharedRegionModule Members
98 100
99 public void Initialise(Scene scene, IConfigSource config) 101 public void Initialise(IConfigSource config)
100 { 102 {
101 // We need to create these early because the scripts might be calling 103 // We need to create these early because the scripts might be calling
102 // But since this gets called for every region, we need to make sure they 104 // But since this gets called for every region, we need to make sure they
@@ -116,7 +118,14 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
116 { 118 {
117 } 119 }
118 } 120 }
121 }
122
123 public void PostInitialise()
124 {
125 }
119 126
127 public void AddRegion(Scene scene)
128 {
120 if (!m_scenes.Contains(scene)) 129 if (!m_scenes.Contains(scene))
121 { 130 {
122 m_scenes.Add(scene); 131 m_scenes.Add(scene);
@@ -125,7 +134,12 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
125 } 134 }
126 } 135 }
127 136
128 public void PostInitialise() 137 public Type ReplaceableInterface
138 {
139 get { return null; }
140 }
141 private Dictionary<Scene, BaseHttpServer> m_HttpServers = new Dictionary<Scene, BaseHttpServer>();
142 public void RegionLoaded(Scene scene)
129 { 143 {
130 if (IsEnabled()) 144 if (IsEnabled())
131 { 145 {
@@ -133,24 +147,41 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
133 // Attach xmlrpc handlers 147 // Attach xmlrpc handlers
134 m_log.Info("[REMOTE_DATA]: " + 148 m_log.Info("[REMOTE_DATA]: " +
135 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 149 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
136 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); 150 BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort);
137 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 151 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
138 httpServer.Start(); 152 httpServer.Start();
153 m_HttpServers.Add(scene, httpServer);
139 } 154 }
140 } 155 }
141 156
142 public void Close() 157 public void RemoveRegion(Scene scene)
143 { 158 {
159 if (m_scenes.Contains(scene))
160 m_scenes.Remove(scene);
161 scene.UnregisterModuleInterface<IXMLRPC>(this);
162 if (IsEnabled())
163 {
164 // Start http server
165 // Attach xmlrpc handlers
166 if (m_HttpServers.ContainsKey(scene))
167 {
168 BaseHttpServer httpServer;
169 m_HttpServers.TryGetValue(scene, out httpServer);
170 m_log.Info("[REMOTE_DATA]: " +
171 "Stopping XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
172 httpServer.RemoveXmlRPCHandler("llRemoteData");
173 httpServer.Stop();
174 }
175 }
144 } 176 }
145 177
146 public string Name 178 public void Close()
147 { 179 {
148 get { return m_name; }
149 } 180 }
150 181
151 public bool IsSharedModule 182 public string Name
152 { 183 {
153 get { return true; } 184 get { return m_name; }
154 } 185 }
155 186
156 public int Port 187 public int Port