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