diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs index b8899d2..ae2df69 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs | |||
@@ -40,14 +40,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
40 | { | 40 | { |
41 | //private static readonly log4net.ILog m_log | 41 | //private static readonly log4net.ILog m_log |
42 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 42 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
43 | |||
44 | private Scene m_scene; | ||
45 | private List<Scene> m_scenes = new List<Scene>(); | ||
46 | 43 | ||
47 | /// <summary> | 44 | /// <summary> |
48 | /// There is one queue for all textures waiting to be sent, regardless of the requesting user. | 45 | /// There is one queue for all textures waiting to be sent, regardless of the requesting user. |
49 | /// </summary> | 46 | /// </summary> |
50 | private readonly BlockingQueue<ITextureSender> m_queueSenders | 47 | private readonly BlockingQueue<ITextureSender> m_queueSenders |
51 | = new BlockingQueue<ITextureSender>(); | 48 | = new BlockingQueue<ITextureSender>(); |
52 | 49 | ||
53 | /// <summary> | 50 | /// <summary> |
@@ -56,12 +53,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
56 | private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices = | 53 | private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices = |
57 | new Dictionary<LLUUID, UserTextureDownloadService>(); | 54 | new Dictionary<LLUUID, UserTextureDownloadService>(); |
58 | 55 | ||
56 | private Scene m_scene; | ||
57 | private List<Scene> m_scenes = new List<Scene>(); | ||
58 | |||
59 | private Thread m_thread; | 59 | private Thread m_thread; |
60 | 60 | ||
61 | public TextureDownloadModule() | 61 | public TextureDownloadModule() |
62 | { | 62 | { |
63 | } | 63 | } |
64 | 64 | ||
65 | #region IRegionModule Members | ||
66 | |||
65 | public void Initialise(Scene scene, IConfigSource config) | 67 | public void Initialise(Scene scene, IConfigSource config) |
66 | { | 68 | { |
67 | if (m_scene == null) | 69 | if (m_scene == null) |
@@ -83,6 +85,26 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
88 | public void PostInitialise() | ||
89 | { | ||
90 | } | ||
91 | |||
92 | public void Close() | ||
93 | { | ||
94 | } | ||
95 | |||
96 | public string Name | ||
97 | { | ||
98 | get { return "TextureDownloadModule"; } | ||
99 | } | ||
100 | |||
101 | public bool IsSharedModule | ||
102 | { | ||
103 | get { return false; } | ||
104 | } | ||
105 | |||
106 | #endregion | ||
107 | |||
86 | /// <summary> | 108 | /// <summary> |
87 | /// Cleanup the texture service related objects for the removed presence. | 109 | /// Cleanup the texture service related objects for the removed presence. |
88 | /// </summary> | 110 | /// </summary> |
@@ -102,24 +124,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
102 | } | 124 | } |
103 | } | 125 | } |
104 | 126 | ||
105 | public void PostInitialise() | ||
106 | { | ||
107 | } | ||
108 | |||
109 | public void Close() | ||
110 | { | ||
111 | } | ||
112 | |||
113 | public string Name | ||
114 | { | ||
115 | get { return "TextureDownloadModule"; } | ||
116 | } | ||
117 | |||
118 | public bool IsSharedModule | ||
119 | { | ||
120 | get { return false; } | ||
121 | } | ||
122 | |||
123 | public void NewClient(IClientAPI client) | 127 | public void NewClient(IClientAPI client) |
124 | { | 128 | { |
125 | client.OnRequestTexture += TextureRequest; | 129 | client.OnRequestTexture += TextureRequest; |
@@ -143,7 +147,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
143 | 147 | ||
144 | textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders); | 148 | textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders); |
145 | m_userTextureServices.Add(client.AgentId, textureService); | 149 | m_userTextureServices.Add(client.AgentId, textureService); |
146 | 150 | ||
147 | return true; | 151 | return true; |
148 | } | 152 | } |
149 | } | 153 | } |
@@ -157,11 +161,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
157 | { | 161 | { |
158 | IClientAPI client = (IClientAPI) sender; | 162 | IClientAPI client = (IClientAPI) sender; |
159 | UserTextureDownloadService textureService; | 163 | UserTextureDownloadService textureService; |
160 | 164 | ||
161 | if (TryGetUserTextureService(client, out textureService)) | 165 | if (TryGetUserTextureService(client, out textureService)) |
162 | { | 166 | { |
163 | textureService.HandleTextureRequest(e); | 167 | textureService.HandleTextureRequest(e); |
164 | } | 168 | } |
165 | } | 169 | } |
166 | 170 | ||
167 | /// <summary> | 171 | /// <summary> |
@@ -170,11 +174,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
170 | public void ProcessTextureSenders() | 174 | public void ProcessTextureSenders() |
171 | { | 175 | { |
172 | ITextureSender sender = null; | 176 | ITextureSender sender = null; |
173 | 177 | ||
174 | while (true) | 178 | while (true) |
175 | { | 179 | { |
176 | sender = m_queueSenders.Dequeue(); | 180 | sender = m_queueSenders.Dequeue(); |
177 | 181 | ||
178 | if (sender.Cancel) | 182 | if (sender.Cancel) |
179 | { | 183 | { |
180 | TextureSent(sender); | 184 | TextureSent(sender); |
@@ -193,10 +197,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
193 | m_queueSenders.Enqueue(sender); | 197 | m_queueSenders.Enqueue(sender); |
194 | } | 198 | } |
195 | } | 199 | } |
196 | 200 | ||
197 | // Make sure that any sender we currently have can get garbage collected | 201 | // Make sure that any sender we currently have can get garbage collected |
198 | sender = null; | 202 | sender = null; |
199 | 203 | ||
200 | //m_log.InfoFormat("[TEXTURE DOWNLOAD] Texture sender queue size: {0}", m_queueSenders.Count()); | 204 | //m_log.InfoFormat("[TEXTURE DOWNLOAD] Texture sender queue size: {0}", m_queueSenders.Count()); |
201 | } | 205 | } |
202 | } | 206 | } |
@@ -207,9 +211,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
207 | /// <param name="sender"></param> | 211 | /// <param name="sender"></param> |
208 | private void TextureSent(ITextureSender sender) | 212 | private void TextureSent(ITextureSender sender) |
209 | { | 213 | { |
210 | sender.Sending = false; | 214 | sender.Sending = false; |
211 | //m_log.DebugFormat("[TEXTURE DOWNLOAD]: Removing download stat for {0}", sender.assetID); | 215 | //m_log.DebugFormat("[TEXTURE DOWNLOAD]: Removing download stat for {0}", sender.assetID); |
212 | m_scene.AddPendingDownloads(-1); | 216 | m_scene.AddPendingDownloads(-1); |
213 | } | 217 | } |
214 | } | 218 | } |
215 | } \ No newline at end of file | 219 | } \ No newline at end of file |