aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712008-01-03 14:01:53 +0000
committerlbsa712008-01-03 14:01:53 +0000
commit7b062cefa22a5b67e124e478345751bab7a18093 (patch)
tree0b862bdb288d7afe513c3985f233c2b65861c9c6
parentSet svn:eol-style. (diff)
downloadopensim-SC_OLD-7b062cefa22a5b67e124e478345751bab7a18093.zip
opensim-SC_OLD-7b062cefa22a5b67e124e478345751bab7a18093.tar.gz
opensim-SC_OLD-7b062cefa22a5b67e124e478345751bab7a18093.tar.bz2
opensim-SC_OLD-7b062cefa22a5b67e124e478345751bab7a18093.tar.xz
* Added removal of TextureSenders and UserTextureDownloadService on agent leaving region.
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs18
-rw-r--r--OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs6
3 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 4e96572..6ebf47f 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Environment.Modules
49 49
50 private readonly BlockingQueue<TextureSender> m_queueSenders = new BlockingQueue<TextureSender>(); 50 private readonly BlockingQueue<TextureSender> m_queueSenders = new BlockingQueue<TextureSender>();
51 51
52 private Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices = 52 private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
53 new Dictionary<LLUUID, UserTextureDownloadService>(); 53 new Dictionary<LLUUID, UserTextureDownloadService>();
54 54
55 private Thread m_thread; 55 private Thread m_thread;
@@ -73,6 +73,22 @@ namespace OpenSim.Region.Environment.Modules
73 m_scenes.Add(scene); 73 m_scenes.Add(scene);
74 m_scene = scene; 74 m_scene = scene;
75 m_scene.EventManager.OnNewClient += NewClient; 75 m_scene.EventManager.OnNewClient += NewClient;
76 m_scene.EventManager.OnRemovePresence += EventManager_OnRemovePresence;
77 }
78 }
79
80 private void EventManager_OnRemovePresence(LLUUID agentId)
81 {
82 UserTextureDownloadService textureService;
83
84 lock (m_userTextureServices)
85 {
86 if( m_userTextureServices.TryGetValue( agentId, out textureService ))
87 {
88 textureService.Close();
89
90 m_userTextureServices.Remove(agentId);
91 }
76 } 92 }
77 } 93 }
78 94
diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
index 9a5b362..5e768ee 100644
--- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
+++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
@@ -94,5 +94,18 @@ namespace OpenSim.Region.Environment.Modules
94 m_sharedSendersQueue.Enqueue(textureSender); 94 m_sharedSendersQueue.Enqueue(textureSender);
95 } 95 }
96 } 96 }
97
98 internal void Close()
99 {
100 lock (m_textureSenders)
101 {
102 foreach( TextureSender textureSender in m_textureSenders.Values )
103 {
104 textureSender.Cancel = true;
105 }
106
107 m_textureSenders.Clear();
108 }
109 }
97 } 110 }
98} \ No newline at end of file 111}
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 5bf23ac..d3822f0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
60 60
61 public event OnNewPresenceDelegate OnNewPresence; 61 public event OnNewPresenceDelegate OnNewPresence;
62 62
63 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 63 public delegate void OnRemovePresenceDelegate(LLUUID agentId);
64 64
65 public event OnRemovePresenceDelegate OnRemovePresence; 65 public event OnRemovePresenceDelegate OnRemovePresence;
66 66
@@ -165,11 +165,11 @@ namespace OpenSim.Region.Environment.Scenes
165 OnNewPresence(presence); 165 OnNewPresence(presence);
166 } 166 }
167 167
168 public void TriggerOnRemovePresence(LLUUID uuid) 168 public void TriggerOnRemovePresence(LLUUID agentId)
169 { 169 {
170 if (OnRemovePresence != null) 170 if (OnRemovePresence != null)
171 { 171 {
172 OnRemovePresence(uuid); 172 OnRemovePresence(agentId);
173 } 173 }
174 } 174 }
175 175