diff options
author | Melanie | 2012-02-20 19:48:28 +0000 |
---|---|---|
committer | Melanie | 2012-02-20 19:48:28 +0000 |
commit | 3b2900e88415e3dc7826df3e8685415134676dcc (patch) | |
tree | c66bb6827a6d1b03be2561bd476249bbd1cf50f3 /OpenSim/Services/Connectors | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff) | |
parent | Amend to last commit: synchronize access to queues. (diff) | |
download | opensim-SC_OLD-3b2900e88415e3dc7826df3e8685415134676dcc.zip opensim-SC_OLD-3b2900e88415e3dc7826df3e8685415134676dcc.tar.gz opensim-SC_OLD-3b2900e88415e3dc7826df3e8685415134676dcc.tar.bz2 opensim-SC_OLD-3b2900e88415e3dc7826df3e8685415134676dcc.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 8ab3b64..4132ec7 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -153,6 +153,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
153 | return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds | 153 | return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds |
154 | } | 154 | } |
155 | 155 | ||
156 | private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); | ||
156 | /// <summary> | 157 | /// <summary> |
157 | /// Send updated position information about an agent in this region to a neighbor | 158 | /// Send updated position information about an agent in this region to a neighbor |
158 | /// This operation may be called very frequently if an avatar is moving about in | 159 | /// This operation may be called very frequently if an avatar is moving about in |
@@ -160,6 +161,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
160 | /// </summary> | 161 | /// </summary> |
161 | public bool UpdateAgent(GridRegion destination, AgentPosition data) | 162 | public bool UpdateAgent(GridRegion destination, AgentPosition data) |
162 | { | 163 | { |
164 | bool v = true; | ||
165 | if (_failedSims.TryGetValue(destination.ServerURI, out v)) | ||
166 | return false; | ||
167 | |||
163 | // The basic idea of this code is that the first thread that needs to | 168 | // The basic idea of this code is that the first thread that needs to |
164 | // send an update for a specific avatar becomes the worker for any subsequent | 169 | // send an update for a specific avatar becomes the worker for any subsequent |
165 | // requests until there are no more outstanding requests. Further, only send the most | 170 | // requests until there are no more outstanding requests. Further, only send the most |
@@ -183,9 +188,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
183 | // Otherwise update the reference and start processing | 188 | // Otherwise update the reference and start processing |
184 | m_updateAgentQueue[uri] = data; | 189 | m_updateAgentQueue[uri] = data; |
185 | } | 190 | } |
186 | 191 | ||
187 | AgentPosition pos = null; | 192 | AgentPosition pos = null; |
188 | while (true) | 193 | bool success = true; |
194 | while (success) | ||
189 | { | 195 | { |
190 | lock (m_updateAgentQueue) | 196 | lock (m_updateAgentQueue) |
191 | { | 197 | { |
@@ -205,11 +211,16 @@ namespace OpenSim.Services.Connectors.Simulation | |||
205 | } | 211 | } |
206 | } | 212 | } |
207 | 213 | ||
208 | UpdateAgent(destination, (IAgentData)pos, 10000); | 214 | success = UpdateAgent(destination, (IAgentData)pos, 10000); |
209 | } | 215 | } |
210 | 216 | // we get here iff success == false | |
211 | // unreachable | 217 | // blacklist sim for 2 minutes |
212 | // return true; | 218 | lock (m_updateAgentQueue) |
219 | { | ||
220 | _failedSims.AddOrUpdate(destination.ServerURI, true, 120); | ||
221 | m_updateAgentQueue.Remove(uri); | ||
222 | } | ||
223 | return false; | ||
213 | } | 224 | } |
214 | 225 | ||
215 | /// <summary> | 226 | /// <summary> |