diff options
author | Diva Canto | 2012-02-19 12:28:07 -0800 |
---|---|---|
committer | Diva Canto | 2012-02-19 16:46:32 -0800 |
commit | 5c8af6a13634d74bef46e72684751beaad132c86 (patch) | |
tree | d5575e6a5b563364d0223647b5d83538db49c4d4 | |
parent | This should smooth movement in heteregeneous networks by a lot: cache the reg... (diff) | |
download | opensim-SC_OLD-5c8af6a13634d74bef46e72684751beaad132c86.zip opensim-SC_OLD-5c8af6a13634d74bef46e72684751beaad132c86.tar.gz opensim-SC_OLD-5c8af6a13634d74bef46e72684751beaad132c86.tar.bz2 opensim-SC_OLD-5c8af6a13634d74bef46e72684751beaad132c86.tar.xz |
A few more tweaks on position updates and create child agents. Mono hates concurrent uses of the same TCP connection, and even of the connections to the same server. So let's stop doing it. This patch makes movement much smoother when there are lots of neighbours.
3 files changed, 23 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 928bcd0..6e4c0b1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1258,12 +1258,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1258 | 1258 | ||
1259 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 1259 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) |
1260 | { | 1260 | { |
1261 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1262 | try | 1261 | try |
1263 | { | 1262 | { |
1264 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1263 | // Let's put this back at sync, so that it doesn't clog |
1265 | InformClientOfNeighbourCompleted, | 1264 | // the network, especially for regions in the same physical server. |
1266 | d); | 1265 | // We're really not in a hurry here. |
1266 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); | ||
1267 | //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1268 | //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | ||
1269 | // InformClientOfNeighbourCompleted, | ||
1270 | // d); | ||
1267 | } | 1271 | } |
1268 | 1272 | ||
1269 | catch (ArgumentOutOfRangeException) | 1273 | catch (ArgumentOutOfRangeException) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 58a7b20..c04171b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -140,6 +140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | icon.EndInvoke(iar); | 140 | icon.EndInvoke(iar); |
141 | } | 141 | } |
142 | 142 | ||
143 | ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); | ||
143 | public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) | 144 | public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) |
144 | { | 145 | { |
145 | // This assumes that we know what our neighbors are. | 146 | // This assumes that we know what our neighbors are. |
@@ -156,16 +157,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // that the region position is cached or performance will degrade | 157 | // that the region position is cached or performance will degrade |
157 | Utils.LongToUInts(regionHandle, out x, out y); | 158 | Utils.LongToUInts(regionHandle, out x, out y); |
158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | 159 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
159 | if (! simulatorList.Contains(dest.ServerURI)) | 160 | bool v = true; |
161 | if (! simulatorList.Contains(dest.ServerURI) && !_failedSims.TryGetValue(dest.ServerURI, out v)) | ||
160 | { | 162 | { |
161 | // we havent seen this simulator before, add it to the list | 163 | // we havent seen this simulator before, add it to the list |
162 | // and send it an update | 164 | // and send it an update |
163 | simulatorList.Add(dest.ServerURI); | 165 | simulatorList.Add(dest.ServerURI); |
164 | 166 | // Let move this to sync. Mono definitely does not like async networking. | |
165 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | 167 | if (!m_scene.SimulationService.UpdateAgent(dest, cAgentData)) |
166 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, | 168 | // Also if it fails, get it out of the loop for a bit |
167 | SendChildAgentDataUpdateCompleted, | 169 | _failedSims.Add(dest.ServerURI, true, 120); |
168 | d); | 170 | |
171 | // Leaving this here as a reminder that we tried, and it sucks. | ||
172 | //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | ||
173 | //d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, | ||
174 | // SendChildAgentDataUpdateCompleted, | ||
175 | // d); | ||
169 | } | 176 | } |
170 | } | 177 | } |
171 | } | 178 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 77f7b32..8639697 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2738,7 +2738,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2738 | AgentPosition agentpos = new AgentPosition(); | 2738 | AgentPosition agentpos = new AgentPosition(); |
2739 | agentpos.CopyFrom(cadu); | 2739 | agentpos.CopyFrom(cadu); |
2740 | 2740 | ||
2741 | m_scene.SendOutChildAgentUpdates(agentpos, this); | 2741 | // Let's get this out of the update loop |
2742 | Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); | ||
2742 | } | 2743 | } |
2743 | } | 2744 | } |
2744 | 2745 | ||