diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/TextureDownload')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs index a7ad37d..35fa5ed 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs | |||
@@ -121,7 +121,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
121 | if (m_userTextureServices.TryGetValue(agentId, out textureService)) | 121 | if (m_userTextureServices.TryGetValue(agentId, out textureService)) |
122 | { | 122 | { |
123 | textureService.Close(); | 123 | textureService.Close(); |
124 | m_log.DebugFormat("[TEXTURE MODULE]: Removing UserTextureServices from {0}", m_scene.RegionInfo.RegionName); | 124 | //m_log.DebugFormat("[TEXTURE MODULE]: Removing UserTextureServices from {0}", m_scene.RegionInfo.RegionName); |
125 | m_userTextureServices.Remove(agentId); | 125 | m_userTextureServices.Remove(agentId); |
126 | } | 126 | } |
127 | } | 127 | } |
@@ -129,17 +129,60 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
129 | 129 | ||
130 | public void NewClient(IClientAPI client) | 130 | public void NewClient(IClientAPI client) |
131 | { | 131 | { |
132 | UserTextureDownloadService textureService; | ||
133 | |||
134 | lock (m_userTextureServices) | ||
135 | { | ||
136 | if (m_userTextureServices.TryGetValue(client.AgentId, out textureService)) | ||
137 | { | ||
138 | textureService.Close(); | ||
139 | //m_log.DebugFormat("[TEXTURE MODULE]: Removing outdated UserTextureServices from {0}", m_scene.RegionInfo.RegionName); | ||
140 | m_userTextureServices.Remove(client.AgentId); | ||
141 | } | ||
142 | m_userTextureServices.Add(client.AgentId, new UserTextureDownloadService(client, m_scene, m_queueSenders)); | ||
143 | } | ||
144 | |||
132 | client.OnRequestTexture += TextureRequest; | 145 | client.OnRequestTexture += TextureRequest; |
133 | } | 146 | } |
134 | 147 | ||
148 | /// I'm commenting this out, and replacing it with the implementation below, which | ||
149 | /// may return a null value. This is necessary for avoiding race conditions | ||
150 | /// recreating UserTextureServices for clients that have just been closed. | ||
151 | /// That behavior of always returning a UserTextureServices was causing the | ||
152 | /// A-B-A problem (mantis #2855). | ||
153 | /// | ||
154 | ///// <summary> | ||
155 | ///// Does this user have a registered texture download service? | ||
156 | ///// </summary> | ||
157 | ///// <param name="userID"></param> | ||
158 | ///// <param name="textureService"></param> | ||
159 | ///// <returns>Always returns true, since a service is created if one does not already exist</returns> | ||
160 | //private bool TryGetUserTextureService( | ||
161 | // IClientAPI client, out UserTextureDownloadService textureService) | ||
162 | //{ | ||
163 | // lock (m_userTextureServices) | ||
164 | // { | ||
165 | // if (m_userTextureServices.TryGetValue(client.AgentId, out textureService)) | ||
166 | // { | ||
167 | // //m_log.DebugFormat("[TEXTURE MODULE]: Found existing UserTextureServices in ", m_scene.RegionInfo.RegionName); | ||
168 | // return true; | ||
169 | // } | ||
170 | |||
171 | // m_log.DebugFormat("[TEXTURE MODULE]: Creating new UserTextureServices in ", m_scene.RegionInfo.RegionName); | ||
172 | // textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders); | ||
173 | // m_userTextureServices.Add(client.AgentId, textureService); | ||
174 | |||
175 | // return true; | ||
176 | // } | ||
177 | //} | ||
178 | |||
135 | /// <summary> | 179 | /// <summary> |
136 | /// Does this user have a registered texture download service? | 180 | /// Does this user have a registered texture download service? |
137 | /// </summary> | 181 | /// </summary> |
138 | /// <param name="userID"></param> | 182 | /// <param name="userID"></param> |
139 | /// <param name="textureService"></param> | 183 | /// <param name="textureService"></param> |
140 | /// <returns>Always returns true, since a service is created if one does not already exist</returns> | 184 | /// <returns>A UserTextureDownloadService or null in the output parameter, and true or false accordingly.</returns> |
141 | private bool TryGetUserTextureService( | 185 | private bool TryGetUserTextureService(IClientAPI client, out UserTextureDownloadService textureService) |
142 | IClientAPI client, out UserTextureDownloadService textureService) | ||
143 | { | 186 | { |
144 | lock (m_userTextureServices) | 187 | lock (m_userTextureServices) |
145 | { | 188 | { |
@@ -149,11 +192,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
149 | return true; | 192 | return true; |
150 | } | 193 | } |
151 | 194 | ||
152 | m_log.DebugFormat("[TEXTURE MODULE]: Creating new UserTextureServices in ", m_scene.RegionInfo.RegionName); | 195 | textureService = null; |
153 | textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders); | 196 | return false; |
154 | m_userTextureServices.Add(client.AgentId, textureService); | ||
155 | |||
156 | return true; | ||
157 | } | 197 | } |
158 | } | 198 | } |
159 | 199 | ||