Patch from Michael Osias IBM (jimbo2120)

In his own words: 
If a prim becomes a listener or remote channel and the script is deleted, it cannot become a listener or channel again with a new script.  
This patch fixes that.
ThreadPoolClientBranch
Justin Clarke Casey 2008-02-18 11:14:53 +00:00
parent 5fb1809384
commit 1cbef0b908
5 changed files with 50 additions and 0 deletions

View File

@ -40,5 +40,6 @@ namespace OpenSim.Region.Environment.Interfaces
ListenerInfo GetNextMessage();
void ListenControl(int handle, int active);
void ListenRemove(int handle);
void DeleteListener(LLUUID itemID);
}
}

View File

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

View File

@ -70,6 +70,7 @@ namespace OpenSim.Region.Environment.Modules
{
private Scene m_scene;
private object CommListLock = new object();
private object ListLock = new object();
private string m_name = "WorldCommModule";
private ListenerManager m_listenerManager;
private Queue<ListenerInfo> m_pending;
@ -136,6 +137,15 @@ namespace OpenSim.Region.Environment.Modules
m_listenerManager.Remove(handle);
}
public void DeleteListener(LLUUID itemID)
{
lock (ListLock)
{
m_listenerManager.DeleteListener(itemID);
}
}
// This method scans nearby objects and determines if they are listeners,
// and if so if this message fits the filter. If it does, then
// enqueue the message for delivery to the objects listen event handler.
@ -303,6 +313,18 @@ namespace OpenSim.Region.Environment.Modules
m_listeners.Remove(handle);
}
public void DeleteListener(LLUUID itemID)
{
foreach (ListenerInfo li in m_listeners.Values)
{
if (li.GetItemID().Equals(itemID))
{
Remove(li.GetHandle());
return;
}
}
}
private int GetNewHandle()
{
for (int i = 0; i < int.MaxValue - 1; i++)

View File

@ -188,6 +188,24 @@ namespace OpenSim.Region.Environment.Modules
return channel;
}
public void DeleteChannel(LLUUID itemID)
{
foreach (RPCChannelInfo li in m_openChannels.Values)
{
if (li.GetItemID().Equals(itemID))
{
m_openChannels.Remove(li.GetChannelID());
return;
}
}
}
/**********************************************
* Remote Data Reply
*
@ -408,5 +426,6 @@ namespace OpenSim.Region.Environment.Modules
{
return m_localID;
}
}
}

View File

@ -120,6 +120,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
IHttpRequests iHttpReq =
m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>();
iHttpReq.StopHttpRequest(localID, itemID);
IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
comms.DeleteListener(itemID);
IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
xmlrpc.DeleteChannel(itemID);
}
#region TIMER