mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
* Added removal of TextureSenders and UserTextureDownloadService on agent leaving region.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||
|
||||
private readonly BlockingQueue<TextureSender> m_queueSenders = new BlockingQueue<TextureSender>();
|
||||
|
||||
private Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
|
||||
private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
|
||||
new Dictionary<LLUUID, UserTextureDownloadService>();
|
||||
|
||||
private Thread m_thread;
|
||||
@@ -73,6 +73,22 @@ namespace OpenSim.Region.Environment.Modules
|
||||
m_scenes.Add(scene);
|
||||
m_scene = scene;
|
||||
m_scene.EventManager.OnNewClient += NewClient;
|
||||
m_scene.EventManager.OnRemovePresence += EventManager_OnRemovePresence;
|
||||
}
|
||||
}
|
||||
|
||||
private void EventManager_OnRemovePresence(LLUUID agentId)
|
||||
{
|
||||
UserTextureDownloadService textureService;
|
||||
|
||||
lock (m_userTextureServices)
|
||||
{
|
||||
if( m_userTextureServices.TryGetValue( agentId, out textureService ))
|
||||
{
|
||||
textureService.Close();
|
||||
|
||||
m_userTextureServices.Remove(agentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,5 +94,18 @@ namespace OpenSim.Region.Environment.Modules
|
||||
m_sharedSendersQueue.Enqueue(textureSender);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Close()
|
||||
{
|
||||
lock (m_textureSenders)
|
||||
{
|
||||
foreach( TextureSender textureSender in m_textureSenders.Values )
|
||||
{
|
||||
textureSender.Cancel = true;
|
||||
}
|
||||
|
||||
m_textureSenders.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
public event OnNewPresenceDelegate OnNewPresence;
|
||||
|
||||
public delegate void OnRemovePresenceDelegate(LLUUID uuid);
|
||||
public delegate void OnRemovePresenceDelegate(LLUUID agentId);
|
||||
|
||||
public event OnRemovePresenceDelegate OnRemovePresence;
|
||||
|
||||
@@ -165,11 +165,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
OnNewPresence(presence);
|
||||
}
|
||||
|
||||
public void TriggerOnRemovePresence(LLUUID uuid)
|
||||
public void TriggerOnRemovePresence(LLUUID agentId)
|
||||
{
|
||||
if (OnRemovePresence != null)
|
||||
{
|
||||
OnRemovePresence(uuid);
|
||||
OnRemovePresence(agentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user