diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs index aa17cec..06a5108 100644 --- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs | |||
@@ -47,6 +47,11 @@ namespace OpenSim.Region.Environment.Modules | |||
47 | { | 47 | { |
48 | private static readonly log4net.ILog m_log | 48 | private static readonly log4net.ILog m_log |
49 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 49 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
50 | |||
51 | /// <summary> | ||
52 | /// We will allow the client to request the same texture n times before dropping further requests | ||
53 | /// </summary> | ||
54 | private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5; | ||
50 | 55 | ||
51 | /// <summary> | 56 | /// <summary> |
52 | /// Holds texture senders before they have received the appropriate texture from the asset cache. | 57 | /// Holds texture senders before they have received the appropriate texture from the asset cache. |
@@ -116,7 +121,7 @@ namespace OpenSim.Region.Environment.Modules | |||
116 | if (requests % 20 == 0) | 121 | if (requests % 20 == 0) |
117 | { | 122 | { |
118 | m_log.WarnFormat( | 123 | m_log.WarnFormat( |
119 | "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for the missing texture {1} from client {2}", | 124 | "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for the already notified missing texture {1} from {2}", |
120 | requests, e.RequestedAssetID, m_client.AgentId); | 125 | requests, e.RequestedAssetID, m_client.AgentId); |
121 | } | 126 | } |
122 | 127 | ||
@@ -124,22 +129,25 @@ namespace OpenSim.Region.Environment.Modules | |||
124 | } | 129 | } |
125 | else | 130 | else |
126 | { | 131 | { |
127 | // Warn the log if we're getting requests for textures we've already dispatched | 132 | // If we keep receiving requests for textures we've already served to the client, |
133 | // then stop sending them. This is a short term approach approach to the problem | ||
134 | // of clients which keep requesting the same texture - the long term approach | ||
135 | // will be to treat the cause (and possibly more generally cap the request | ||
136 | // queues as well/instead) | ||
128 | if (dispatchedTextureRequestCounts.ContainsKey(e.RequestedAssetID)) | 137 | if (dispatchedTextureRequestCounts.ContainsKey(e.RequestedAssetID)) |
129 | { | 138 | { |
130 | int requests = dispatchedTextureRequestCounts[e.RequestedAssetID] + 1; | 139 | dispatchedTextureRequestCounts[e.RequestedAssetID] += 1; |
131 | 140 | ||
132 | if (requests % 20 == 0) | 141 | if (dispatchedTextureRequestCounts[e.RequestedAssetID] > MAX_ALLOWED_TEXTURE_REQUESTS) |
133 | { | 142 | { |
134 | m_log.WarnFormat( | 143 | m_log.WarnFormat( |
135 | "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for already dispatched texture {1} from client {2}", | 144 | "[USER TEXTURE DOWNLOAD SERVICE]: No longer sending already dispatched texture {0} to {1} since it has made more than {2} requests for it", |
136 | requests, e.RequestedAssetID, m_client.AgentId); | 145 | e.RequestedAssetID, m_client.AgentId, MAX_ALLOWED_TEXTURE_REQUESTS); |
137 | } | 146 | |
138 | 147 | return; | |
139 | dispatchedTextureRequestCounts[e.RequestedAssetID] = requests; | 148 | } |
140 | } | 149 | } |
141 | 150 | ||
142 | //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID); | ||
143 | m_scene.AddPendingDownloads(1); | 151 | m_scene.AddPendingDownloads(1); |
144 | 152 | ||
145 | TextureSender requestHandler = new TextureSender(m_client, e.DiscardLevel, e.PacketNumber); | 153 | TextureSender requestHandler = new TextureSender(m_client, e.DiscardLevel, e.PacketNumber); |