This may fix mantis #2855. There was a race condition on the TextureDownloadModule upon clients (ScenePresences) being closed. If there were still textures to send, the UserTextureServices was created again, but pointing to the old IClient that had just been closed, which made things not work upon that user returning to that region.
parent
2537a4098a
commit
3a56d91974
|
@ -121,7 +121,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
if (m_userTextureServices.TryGetValue(agentId, out textureService))
|
if (m_userTextureServices.TryGetValue(agentId, out textureService))
|
||||||
{
|
{
|
||||||
textureService.Close();
|
textureService.Close();
|
||||||
m_log.DebugFormat("[TEXTURE MODULE]: Removing UserTextureServices from {0}", m_scene.RegionInfo.RegionName);
|
//m_log.DebugFormat("[TEXTURE MODULE]: Removing UserTextureServices from {0}", m_scene.RegionInfo.RegionName);
|
||||||
m_userTextureServices.Remove(agentId);
|
m_userTextureServices.Remove(agentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,17 +129,60 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
|
|
||||||
public void NewClient(IClientAPI client)
|
public void NewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
UserTextureDownloadService textureService;
|
||||||
|
|
||||||
|
lock (m_userTextureServices)
|
||||||
|
{
|
||||||
|
if (m_userTextureServices.TryGetValue(client.AgentId, out textureService))
|
||||||
|
{
|
||||||
|
textureService.Close();
|
||||||
|
//m_log.DebugFormat("[TEXTURE MODULE]: Removing outdated UserTextureServices from {0}", m_scene.RegionInfo.RegionName);
|
||||||
|
m_userTextureServices.Remove(client.AgentId);
|
||||||
|
}
|
||||||
|
m_userTextureServices.Add(client.AgentId, new UserTextureDownloadService(client, m_scene, m_queueSenders));
|
||||||
|
}
|
||||||
|
|
||||||
client.OnRequestTexture += TextureRequest;
|
client.OnRequestTexture += TextureRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// I'm commenting this out, and replacing it with the implementation below, which
|
||||||
|
/// may return a null value. This is necessary for avoiding race conditions
|
||||||
|
/// recreating UserTextureServices for clients that have just been closed.
|
||||||
|
/// That behavior of always returning a UserTextureServices was causing the
|
||||||
|
/// A-B-A problem (mantis #2855).
|
||||||
|
///
|
||||||
|
///// <summary>
|
||||||
|
///// Does this user have a registered texture download service?
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="userID"></param>
|
||||||
|
///// <param name="textureService"></param>
|
||||||
|
///// <returns>Always returns true, since a service is created if one does not already exist</returns>
|
||||||
|
//private bool TryGetUserTextureService(
|
||||||
|
// IClientAPI client, out UserTextureDownloadService textureService)
|
||||||
|
//{
|
||||||
|
// lock (m_userTextureServices)
|
||||||
|
// {
|
||||||
|
// if (m_userTextureServices.TryGetValue(client.AgentId, out textureService))
|
||||||
|
// {
|
||||||
|
// //m_log.DebugFormat("[TEXTURE MODULE]: Found existing UserTextureServices in ", m_scene.RegionInfo.RegionName);
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[TEXTURE MODULE]: Creating new UserTextureServices in ", m_scene.RegionInfo.RegionName);
|
||||||
|
// textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders);
|
||||||
|
// m_userTextureServices.Add(client.AgentId, textureService);
|
||||||
|
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does this user have a registered texture download service?
|
/// Does this user have a registered texture download service?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
/// <param name="textureService"></param>
|
/// <param name="textureService"></param>
|
||||||
/// <returns>Always returns true, since a service is created if one does not already exist</returns>
|
/// <returns>A UserTextureDownloadService or null in the output parameter, and true or false accordingly.</returns>
|
||||||
private bool TryGetUserTextureService(
|
private bool TryGetUserTextureService(IClientAPI client, out UserTextureDownloadService textureService)
|
||||||
IClientAPI client, out UserTextureDownloadService textureService)
|
|
||||||
{
|
{
|
||||||
lock (m_userTextureServices)
|
lock (m_userTextureServices)
|
||||||
{
|
{
|
||||||
|
@ -149,11 +192,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[TEXTURE MODULE]: Creating new UserTextureServices in ", m_scene.RegionInfo.RegionName);
|
textureService = null;
|
||||||
textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders);
|
return false;
|
||||||
m_userTextureServices.Add(client.AgentId, textureService);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue