XmlRpcGridRouter
Flesh out XmlRpcGridRouter to reap unused channels from gateway when scripts or objects are removed, or when the llCloseRemoteDataChannel is called. See: http://http://forge.opensimulator.org/gf/project/xmlrpcrouter/ or https://github.com/BlueWall/XmlRpcRouter for php gateway and test code.integration
parent
09dc8d6f96
commit
8a3a7fbf83
|
@ -34,5 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url);
|
void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url);
|
||||||
void ScriptRemoved(UUID itemID);
|
void ScriptRemoved(UUID itemID);
|
||||||
void ObjectRemoved(UUID objectID);
|
void ObjectRemoved(UUID objectID);
|
||||||
|
void UnRegisterReceiver(string channelID, UUID itemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
{
|
{
|
||||||
public class XmlRpcInfo
|
public class XmlRpcInfo
|
||||||
{
|
{
|
||||||
|
public UUID item;
|
||||||
public UUID channel;
|
public UUID channel;
|
||||||
public string uri;
|
public string uri;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +89,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||||
|
|
||||||
|
IScriptModule scriptEngine = scene.RequestModuleInterface<IScriptModule>();
|
||||||
|
if ( scriptEngine != null )
|
||||||
|
{
|
||||||
|
scriptEngine.OnScriptRemoved += this.ScriptRemoved;
|
||||||
|
scriptEngine.OnObjectRemoved += this.ObjectRemoved;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
@ -120,11 +129,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
|
|
||||||
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
||||||
{
|
{
|
||||||
if (!m_Channels.ContainsKey(itemID))
|
if (!m_Enabled)
|
||||||
{
|
return;
|
||||||
|
|
||||||
|
m_log.InfoFormat("[XMLRPC GRID ROUTER]: New receiver Obj: {0} Ch: {1} ID: {2} URI: {3}",
|
||||||
|
objectID.ToString(), channel.ToString(), itemID.ToString(), uri);
|
||||||
|
|
||||||
XmlRpcInfo info = new XmlRpcInfo();
|
XmlRpcInfo info = new XmlRpcInfo();
|
||||||
info.channel = channel;
|
info.channel = channel;
|
||||||
info.uri = uri;
|
info.uri = uri;
|
||||||
|
info.item = itemID;
|
||||||
|
|
||||||
bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
|
bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
|
||||||
"POST", m_ServerURI+"/RegisterChannel/", info);
|
"POST", m_ServerURI+"/RegisterChannel/", info);
|
||||||
|
@ -135,7 +149,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Channels[itemID] = channel;
|
m_Channels[itemID] = channel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnRegisterReceiver(string channelID, UUID itemID)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RemoveChannel(itemID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScriptRemoved(UUID itemID)
|
public void ScriptRemoved(UUID itemID)
|
||||||
|
@ -143,10 +166,33 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_Channels.ContainsKey(itemID))
|
RemoveChannel(itemID);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ObjectRemoved(UUID objectID)
|
||||||
{
|
{
|
||||||
bool success = SynchronousRestObjectRequester.MakeRequest<UUID, bool>(
|
// m_log.InfoFormat("[XMLRPC GRID ROUTER]: Object Removed {0}",objectID.ToString());
|
||||||
"POST", m_ServerURI+"/RemoveChannel/", m_Channels[itemID]);
|
}
|
||||||
|
|
||||||
|
private bool RemoveChannel(UUID itemID)
|
||||||
|
{
|
||||||
|
if(!m_Channels.ContainsKey(itemID))
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlRpcInfo info = new XmlRpcInfo();
|
||||||
|
|
||||||
|
info.channel = m_Channels[itemID];
|
||||||
|
info.item = itemID;
|
||||||
|
info.uri = "http://0.0.0.0:00";
|
||||||
|
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
|
||||||
|
"POST", m_ServerURI+"/RemoveChannel/", info);
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
@ -154,11 +200,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Channels.Remove(itemID);
|
m_Channels.Remove(itemID);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
|
||||||
public void ObjectRemoved(UUID objectID)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,12 +101,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
||||||
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});
|
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnRegisterReceiver(string channelID, UUID itemID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void ScriptRemoved(UUID itemID)
|
public void ScriptRemoved(UUID itemID)
|
||||||
{
|
{
|
||||||
|
System.Console.WriteLine("TEST Script Removed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ObjectRemoved(UUID objectID)
|
public void ObjectRemoved(UUID objectID)
|
||||||
{
|
{
|
||||||
|
System.Console.WriteLine("TEST Obj Removed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6856,6 +6856,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llCloseRemoteDataChannel(string channel)
|
public void llCloseRemoteDataChannel(string channel)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||||
|
if (xmlRpcRouter != null)
|
||||||
|
{
|
||||||
|
xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
|
||||||
|
}
|
||||||
|
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||||
ScriptSleep(1000);
|
ScriptSleep(1000);
|
||||||
|
|
Loading…
Reference in New Issue