diff options
author | Melanie Thielker | 2015-11-01 19:11:14 +0100 |
---|---|---|
committer | Melanie Thielker | 2015-11-01 19:11:14 +0100 |
commit | 69585a4824a7814bbe543d624de6c3627e0b927b (patch) | |
tree | 5d4bb6480906000f019c0d456939b24f5dfd8ab4 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into avinationmerge (diff) | |
download | opensim-SC-69585a4824a7814bbe543d624de6c3627e0b927b.zip opensim-SC-69585a4824a7814bbe543d624de6c3627e0b927b.tar.gz opensim-SC-69585a4824a7814bbe543d624de6c3627e0b927b.tar.bz2 opensim-SC-69585a4824a7814bbe543d624de6c3627e0b927b.tar.xz |
More plumbing of the EntityTransferContext (not yet complete)
Diffstat (limited to 'OpenSim/Region/CoreModules')
5 files changed, 38 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 0d3b39e..cdcd6b9 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -853,7 +853,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
853 | 853 | ||
854 | if (invService.GetRootFolder(userID) != null) | 854 | if (invService.GetRootFolder(userID) != null) |
855 | { | 855 | { |
856 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 856 | for (int i = 0; i < appearance.Wearables.Length; i++) |
857 | { | 857 | { |
858 | for (int j = 0; j < appearance.Wearables[i].Count; j++) | 858 | for (int j = 0; j < appearance.Wearables[i].Count; j++) |
859 | { | 859 | { |
@@ -1258,8 +1258,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1258 | 1258 | ||
1259 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 1259 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
1260 | { | 1260 | { |
1261 | if (wear.Type < AvatarWearable.MAX_WEARABLES) | 1261 | // If the wearable type is larger than the current array, expand it |
1262 | avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero); | 1262 | if (avatAppearance.Wearables.Length <= wear.Type) |
1263 | { | ||
1264 | int currentLength = avatAppearance.Wearables.Length; | ||
1265 | AvatarWearable[] wears = avatAppearance.Wearables; | ||
1266 | Array.Resize(ref wears, wear.Type + 1); | ||
1267 | for (int i = currentLength ; i <= wear.Type ; i++) | ||
1268 | wears[i] = new AvatarWearable(); | ||
1269 | avatAppearance.Wearables = wears; | ||
1270 | } | ||
1271 | avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero); | ||
1263 | } | 1272 | } |
1264 | 1273 | ||
1265 | avatAppearance.GetAssetsFrom(sp.Appearance); | 1274 | avatAppearance.GetAssetsFrom(sp.Appearance); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4d70c54..ed93f05 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -849,7 +849,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
849 | // Let's create an agent there if one doesn't exist yet. | 849 | // Let's create an agent there if one doesn't exist yet. |
850 | // NOTE: logout will always be false for a non-HG teleport. | 850 | // NOTE: logout will always be false for a non-HG teleport. |
851 | bool logout = false; | 851 | bool logout = false; |
852 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 852 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout)) |
853 | { | 853 | { |
854 | m_interRegionTeleportFailures.Value++; | 854 | m_interRegionTeleportFailures.Value++; |
855 | 855 | ||
@@ -948,7 +948,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
948 | // destination region but the viewer cannot establish the connection (e.g. due to network issues between | 948 | // destination region but the viewer cannot establish the connection (e.g. due to network issues between |
949 | // the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then | 949 | // the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then |
950 | // there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail(). | 950 | // there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail(). |
951 | if (!UpdateAgent(reg, finalDestination, agent, sp)) | 951 | if (!UpdateAgent(reg, finalDestination, agent, sp, ctx)) |
952 | { | 952 | { |
953 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) | 953 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) |
954 | { | 954 | { |
@@ -1084,7 +1084,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1084 | // Let's create an agent there if one doesn't exist yet. | 1084 | // Let's create an agent there if one doesn't exist yet. |
1085 | // NOTE: logout will always be false for a non-HG teleport. | 1085 | // NOTE: logout will always be false for a non-HG teleport. |
1086 | bool logout = false; | 1086 | bool logout = false; |
1087 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 1087 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout)) |
1088 | { | 1088 | { |
1089 | m_interRegionTeleportFailures.Value++; | 1089 | m_interRegionTeleportFailures.Value++; |
1090 | 1090 | ||
@@ -1158,7 +1158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1158 | // Send the Update. If this returns true, we know the client has contacted the destination | 1158 | // Send the Update. If this returns true, we know the client has contacted the destination |
1159 | // via CompleteMovementIntoRegion, so we can let go. | 1159 | // via CompleteMovementIntoRegion, so we can let go. |
1160 | // If it returns false, something went wrong, and we need to abort. | 1160 | // If it returns false, something went wrong, and we need to abort. |
1161 | if (!UpdateAgent(reg, finalDestination, agent, sp)) | 1161 | if (!UpdateAgent(reg, finalDestination, agent, sp, ctx)) |
1162 | { | 1162 | { |
1163 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) | 1163 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) |
1164 | { | 1164 | { |
@@ -1280,13 +1280,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1280 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); | 1280 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); |
1281 | } | 1281 | } |
1282 | 1282 | ||
1283 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 1283 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout) |
1284 | { | 1284 | { |
1285 | GridRegion source = new GridRegion(Scene.RegionInfo); | 1285 | GridRegion source = new GridRegion(Scene.RegionInfo); |
1286 | source.RawServerURI = m_GatekeeperURI; | 1286 | source.RawServerURI = m_GatekeeperURI; |
1287 | 1287 | ||
1288 | logout = false; | 1288 | logout = false; |
1289 | bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, out reason); | 1289 | bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, ctx, out reason); |
1290 | 1290 | ||
1291 | if (success) | 1291 | if (success) |
1292 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); | 1292 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); |
@@ -1294,9 +1294,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1294 | return success; | 1294 | return success; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp) | 1297 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp, EntityTransferContext ctx) |
1298 | { | 1298 | { |
1299 | return Scene.SimulationService.UpdateAgent(finalDestination, agent); | 1299 | return Scene.SimulationService.UpdateAgent(finalDestination, agent, ctx); |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) | 1302 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) |
@@ -1679,7 +1679,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1679 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1679 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1680 | } | 1680 | } |
1681 | 1681 | ||
1682 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) | 1682 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx)) |
1683 | { | 1683 | { |
1684 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); | 1684 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); |
1685 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1685 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
@@ -1695,7 +1695,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1695 | return agent; | 1695 | return agent; |
1696 | } | 1696 | } |
1697 | 1697 | ||
1698 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) | 1698 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) |
1699 | { | 1699 | { |
1700 | int ts = Util.EnvironmentTickCount(); | 1700 | int ts = Util.EnvironmentTickCount(); |
1701 | try | 1701 | try |
@@ -1718,7 +1718,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1718 | // Beyond this point, extra cleanup is needed beyond removing transit state | 1718 | // Beyond this point, extra cleanup is needed beyond removing transit state |
1719 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); | 1719 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); |
1720 | 1720 | ||
1721 | if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | 1721 | if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx)) |
1722 | { | 1722 | { |
1723 | // region doesn't take it | 1723 | // region doesn't take it |
1724 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1724 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
@@ -2360,7 +2360,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2360 | 2360 | ||
2361 | string reason = String.Empty; | 2361 | string reason = String.Empty; |
2362 | 2362 | ||
2363 | bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, out reason); | 2363 | EntityTransferContext ctx = new EntityTransferContext(); |
2364 | bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, ctx, out reason); | ||
2364 | 2365 | ||
2365 | if (regionAccepted) | 2366 | if (regionAccepted) |
2366 | { | 2367 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index dcc4746..1783e0a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 266 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout) |
267 | { | 267 | { |
268 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); | 268 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); |
269 | reason = string.Empty; | 269 | reason = string.Empty; |
@@ -308,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout); | 311 | return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout); |
312 | } | 312 | } |
313 | 313 | ||
314 | public void TriggerTeleportHome(UUID id, IClientAPI client) | 314 | public void TriggerTeleportHome(UUID id, IClientAPI client) |
@@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
333 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); | 333 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); |
334 | 334 | ||
335 | // Check wearables | 335 | // Check wearables |
336 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 336 | for (int i = 0; i < sp.Appearance.Wearables.Length ; i++) |
337 | { | 337 | { |
338 | for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++) | 338 | for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++) |
339 | { | 339 | { |
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
342 | 342 | ||
343 | bool found = false; | 343 | bool found = false; |
344 | foreach (AvatarAppearance a in ExportedAppearance) | 344 | foreach (AvatarAppearance a in ExportedAppearance) |
345 | if (a.Wearables[i] != null) | 345 | if (i < a.Wearables.Length && a.Wearables[i] != null) |
346 | { | 346 | { |
347 | found = true; | 347 | found = true; |
348 | break; | 348 | break; |
@@ -356,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
356 | 356 | ||
357 | found = false; | 357 | found = false; |
358 | foreach (AvatarAppearance a in ExportedAppearance) | 358 | foreach (AvatarAppearance a in ExportedAppearance) |
359 | if (sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) | 359 | if (i < a.Wearables.Length && sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) |
360 | { | 360 | { |
361 | found = true; | 361 | found = true; |
362 | break; | 362 | break; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 6cb15f6..3755650 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
185 | * Agent-related communications | 185 | * Agent-related communications |
186 | */ | 186 | */ |
187 | 187 | ||
188 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 188 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason) |
189 | { | 189 | { |
190 | if (destination == null) | 190 | if (destination == null) |
191 | { | 191 | { |
@@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
204 | return false; | 204 | return false; |
205 | } | 205 | } |
206 | 206 | ||
207 | public bool UpdateAgent(GridRegion destination, AgentData cAgentData) | 207 | public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx) |
208 | { | 208 | { |
209 | if (destination == null) | 209 | if (destination == null) |
210 | return false; | 210 | return false; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index cf19edd..0ebdbce 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -160,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
160 | * Agent-related communications | 160 | * Agent-related communications |
161 | */ | 161 | */ |
162 | 162 | ||
163 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 163 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason) |
164 | { | 164 | { |
165 | if (destination == null) | 165 | if (destination == null) |
166 | { | 166 | { |
@@ -170,27 +170,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
170 | } | 170 | } |
171 | 171 | ||
172 | // Try local first | 172 | // Try local first |
173 | if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason)) | 173 | if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason)) |
174 | return true; | 174 | return true; |
175 | 175 | ||
176 | // else do the remote thing | 176 | // else do the remote thing |
177 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) | 177 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
178 | { | 178 | { |
179 | return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); | 179 | return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason); |
180 | } | 180 | } |
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | 183 | ||
184 | public bool UpdateAgent(GridRegion destination, AgentData cAgentData) | 184 | public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx) |
185 | { | 185 | { |
186 | if (destination == null) | 186 | if (destination == null) |
187 | return false; | 187 | return false; |
188 | 188 | ||
189 | // Try local first | 189 | // Try local first |
190 | if (m_localBackend.IsLocalRegion(destination.RegionID)) | 190 | if (m_localBackend.IsLocalRegion(destination.RegionID)) |
191 | return m_localBackend.UpdateAgent(destination, cAgentData); | 191 | return m_localBackend.UpdateAgent(destination, cAgentData, ctx); |
192 | 192 | ||
193 | return m_remoteConnector.UpdateAgent(destination, cAgentData); | 193 | return m_remoteConnector.UpdateAgent(destination, cAgentData, ctx); |
194 | } | 194 | } |
195 | 195 | ||
196 | public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) | 196 | public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) |