diff options
author | Sean Dague | 2007-12-13 19:50:21 +0000 |
---|---|---|
committer | Sean Dague | 2007-12-13 19:50:21 +0000 |
commit | f773733fcb6ef18ddb70d597cdf6f1e334dcf13e (patch) | |
tree | dd59cbd8f684a9fc4f0ad656738857170905c6b2 /OpenSim/Region | |
parent | Enabled the sit_ground animation. The sit state is not properly set, but it ... (diff) | |
download | opensim-SC-f773733fcb6ef18ddb70d597cdf6f1e334dcf13e.zip opensim-SC-f773733fcb6ef18ddb70d597cdf6f1e334dcf13e.tar.gz opensim-SC-f773733fcb6ef18ddb70d597cdf6f1e334dcf13e.tar.bz2 opensim-SC-f773733fcb6ef18ddb70d597cdf6f1e334dcf13e.tar.xz |
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.
Diffstat (limited to '')
5 files changed, 51 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs index 6786b8c..02b74cb 100644 --- a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs +++ b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs | |||
@@ -38,5 +38,6 @@ namespace OpenSim.Region.Environment.Interfaces | |||
38 | bool hasRequests(); | 38 | bool hasRequests(); |
39 | RPCRequestInfo GetNextRequest(); | 39 | RPCRequestInfo GetNextRequest(); |
40 | void RemoteDataReply(string channel, string message_id, string sdata, int idata); | 40 | void RemoteDataReply(string channel, string message_id, string sdata, int idata); |
41 | bool IsEnabled(); | ||
41 | } | 42 | } |
42 | } \ No newline at end of file | 43 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 1bab2e5..6893e3f 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -90,6 +90,9 @@ namespace OpenSim.Region.Environment | |||
90 | AvatarFactoryModule avatarFactory = new AvatarFactoryModule(); | 90 | AvatarFactoryModule avatarFactory = new AvatarFactoryModule(); |
91 | m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory); | 91 | m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory); |
92 | 92 | ||
93 | XMLRPCModule xmlRpcMod = new XMLRPCModule(); | ||
94 | m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod); | ||
95 | |||
93 | //TextureDownloadModule textureModule = new TextureDownloadModule(); | 96 | //TextureDownloadModule textureModule = new TextureDownloadModule(); |
94 | //LoadedSharedModules.Add(textureModule.Name, textureModule); | 97 | //LoadedSharedModules.Add(textureModule.Name, textureModule); |
95 | } | 98 | } |
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 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
29 | using System.Collections; | 30 | using System.Collections; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Threading; | 32 | using System.Threading; |
@@ -35,6 +36,7 @@ using Nwc.XmlRpc; | |||
35 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
39 | using OpenSim.Framework.Console; | ||
38 | 40 | ||
39 | /***************************************************** | 41 | /***************************************************** |
40 | * | 42 | * |
@@ -77,8 +79,11 @@ namespace OpenSim.Region.Environment.Modules | |||
77 | private Queue<RPCRequestInfo> rpcQueue = new Queue<RPCRequestInfo>(); | 79 | private Queue<RPCRequestInfo> rpcQueue = new Queue<RPCRequestInfo>(); |
78 | private object XMLRPCListLock = new object(); | 80 | private object XMLRPCListLock = new object(); |
79 | private string m_name = "XMLRPCModule"; | 81 | private string m_name = "XMLRPCModule"; |
80 | private int RemoteReplyScriptWait = 100; | 82 | private int RemoteReplyScriptWait = 300; |
81 | private int RemoteReplyScriptTimeout = 300; | 83 | private int RemoteReplyScriptTimeout = 900; |
84 | private int m_remoteDataPort = 0; | ||
85 | private List<Scene> m_scenes = new List<Scene>(); | ||
86 | private LogBase m_log; | ||
82 | 87 | ||
83 | // <channel id, RPCChannelInfo> | 88 | // <channel id, RPCChannelInfo> |
84 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; | 89 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; |
@@ -88,26 +93,43 @@ namespace OpenSim.Region.Environment.Modules | |||
88 | 93 | ||
89 | public XMLRPCModule() | 94 | public XMLRPCModule() |
90 | { | 95 | { |
96 | m_log = MainLog.Instance; | ||
91 | } | 97 | } |
92 | 98 | ||
93 | public void Initialise(Scene scene, IConfigSource config) | 99 | public void Initialise(Scene scene, IConfigSource config) |
94 | { | 100 | { |
95 | m_scene = scene; | 101 | try |
102 | { | ||
103 | |||
104 | m_remoteDataPort = config.Configs["Network"].GetInt("remoteDataPort", m_remoteDataPort); | ||
96 | 105 | ||
97 | m_scene.RegisterModuleInterface<IXMLRPC>(this); | 106 | } |
107 | catch (Exception e) | ||
108 | { | ||
109 | } | ||
98 | 110 | ||
99 | m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>(); | 111 | if (!m_scenes.Contains(scene)) |
100 | m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>(); | 112 | { |
113 | m_scenes.Add(scene); | ||
101 | 114 | ||
102 | // Start http server | 115 | scene.RegisterModuleInterface<IXMLRPC>(this); |
103 | // Attach xmlrpc handlers | 116 | } |
104 | BaseHttpServer httpServer = new BaseHttpServer(20800); | ||
105 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); | ||
106 | httpServer.Start(); | ||
107 | } | 117 | } |
108 | 118 | ||
109 | public void PostInitialise() | 119 | public void PostInitialise() |
110 | { | 120 | { |
121 | if ( IsEnabled() ) | ||
122 | { | ||
123 | m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>(); | ||
124 | m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>(); | ||
125 | |||
126 | // Start http server | ||
127 | // Attach xmlrpc handlers | ||
128 | m_log.Verbose("REMOTE_DATA", "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); | ||
129 | BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); | ||
130 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); | ||
131 | httpServer.Start(); | ||
132 | } | ||
111 | } | 133 | } |
112 | 134 | ||
113 | public void Close() | 135 | public void Close() |
@@ -124,6 +146,11 @@ namespace OpenSim.Region.Environment.Modules | |||
124 | get { return true; } | 146 | get { return true; } |
125 | } | 147 | } |
126 | 148 | ||
149 | public bool IsEnabled() | ||
150 | { | ||
151 | return (m_remoteDataPort > 0); | ||
152 | } | ||
153 | |||
127 | /********************************************** | 154 | /********************************************** |
128 | * OpenXMLRPCChannel | 155 | * OpenXMLRPCChannel |
129 | * | 156 | * |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index aaac294..40c6533 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -2044,9 +2044,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
2044 | public void llOpenRemoteDataChannel() | 2044 | public void llOpenRemoteDataChannel() |
2045 | { | 2045 | { |
2046 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 2046 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
2047 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); | 2047 | if (xmlrpcMod.IsEnabled()) |
2048 | object[] resobj = new object[] {1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, ""}; | 2048 | { |
2049 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); | 2049 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); |
2050 | object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" }; | ||
2051 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); | ||
2052 | } | ||
2050 | } | 2053 | } |
2051 | 2054 | ||
2052 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) | 2055 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs index ddc0c62..fdd7260 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs | |||
@@ -213,7 +213,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
213 | while ( httpInfo != null ) | 213 | while ( httpInfo != null ) |
214 | { | 214 | { |
215 | 215 | ||
216 | Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status); | 216 | //Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status); |
217 | 217 | ||
218 | // Deliver data to prim's remote_data handler | 218 | // Deliver data to prim's remote_data handler |
219 | // | 219 | // |
@@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
249 | while (xmlrpc.hasRequests()) | 249 | while (xmlrpc.hasRequests()) |
250 | { | 250 | { |
251 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); | 251 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); |
252 | Console.WriteLine("PICKED REQUEST"); | 252 | //Console.WriteLine("PICKED REQUEST"); |
253 | 253 | ||
254 | //Deliver data to prim's remote_data handler | 254 | //Deliver data to prim's remote_data handler |
255 | object[] resobj = new object[] | 255 | object[] resobj = new object[] |
@@ -284,4 +284,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
284 | } | 284 | } |
285 | } | 285 | } |
286 | } | 286 | } |
287 | } \ No newline at end of file | 287 | } |