aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
diff options
context:
space:
mode:
authorDiva Canto2012-02-20 10:58:07 -0800
committerDiva Canto2012-02-20 10:58:07 -0800
commit99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5 (patch)
tree84711d3dca430a1c546b4185b00c0f928782f2cb /OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
parentOne more tweak related to the previous 2 commits. (diff)
downloadopensim-SC-99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5.zip
opensim-SC-99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5.tar.gz
opensim-SC-99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5.tar.bz2
opensim-SC-99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5.tar.xz
More improvements on agent position updates: if the target sims fail, blacklist them for 2 min, so that we don't keep doing remote calls that fail.
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs20
1 files changed, 14 insertions, 6 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index c45f456..c45e312 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,13 @@ 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 _failedSims.AddOrUpdate(destination.ServerURI, true, 120);
219 m_updateAgentQueue.Clear();
220 return false;
213 } 221 }
214 222
215 /// <summary> 223 /// <summary>