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.
afrisby
Sean Dague 2007-12-13 19:50:21 +00:00
parent fd09b22552
commit f773733fcb
6 changed files with 54 additions and 17 deletions

View File

@ -38,5 +38,6 @@ namespace OpenSim.Region.Environment.Interfaces
bool hasRequests();
RPCRequestInfo GetNextRequest();
void RemoteDataReply(string channel, string message_id, string sdata, int idata);
bool IsEnabled();
}
}

View File

@ -90,6 +90,9 @@ namespace OpenSim.Region.Environment
AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory);
XMLRPCModule xmlRpcMod = new XMLRPCModule();
m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod);
//TextureDownloadModule textureModule = new TextureDownloadModule();
//LoadedSharedModules.Add(textureModule.Name, textureModule);
}

View File

@ -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<RPCRequestInfo> rpcQueue = new Queue<RPCRequestInfo>();
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<Scene> m_scenes = new List<Scene>();
private LogBase m_log;
// <channel id, RPCChannelInfo>
private Dictionary<LLUUID, RPCChannelInfo> 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_scene.RegisterModuleInterface<IXMLRPC>(this);
m_remoteDataPort = config.Configs["Network"].GetInt("remoteDataPort", m_remoteDataPort);
}
catch (Exception e)
{
}
if (!m_scenes.Contains(scene))
{
m_scenes.Add(scene);
scene.RegisterModuleInterface<IXMLRPC>(this);
}
}
public void PostInitialise()
{
if ( IsEnabled() )
{
m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>();
m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>();
// Start http server
// Attach xmlrpc handlers
BaseHttpServer httpServer = new BaseHttpServer(20800);
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 PostInitialise()
{
}
public void Close()
@ -124,6 +146,11 @@ namespace OpenSim.Region.Environment.Modules
get { return true; }
}
public bool IsEnabled()
{
return (m_remoteDataPort > 0);
}
/**********************************************
* OpenXMLRPCChannel
*

View File

@ -2044,10 +2044,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llOpenRemoteDataChannel()
{
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpcMod.IsEnabled())
{
LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID);
object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" };
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj);
}
}
public string llSendRemoteData(string channel, string dest, int idata, string sdata)
{

View File

@ -213,7 +213,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
while ( httpInfo != null )
{
Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status);
//Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status);
// Deliver data to prim's remote_data handler
//
@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
while (xmlrpc.hasRequests())
{
RPCRequestInfo rInfo = xmlrpc.GetNextRequest();
Console.WriteLine("PICKED REQUEST");
//Console.WriteLine("PICKED REQUEST");
//Deliver data to prim's remote_data handler
object[] resobj = new object[]

View File

@ -58,6 +58,9 @@ dump_assets_to_file = false
http_listener_port = 9000
remoting_listener_port = 8895
; Uncomment below to enable llRemoteData/remote channels
; remoteDataPort = 20800
grid_server_url = "http://127.0.0.1:8001"
grid_send_key = "null"
grid_recv_key = "null"