diff options
author | Melanie | 2011-02-19 01:59:49 +0000 |
---|---|---|
committer | Melanie | 2011-02-19 01:59:49 +0000 |
commit | 4834b476798cce715d0b5b286a6f20bc577bdabd (patch) | |
tree | 5bf15fa7978daaff116147838f84e4915bca1777 /OpenSim | |
parent | Add needed dummy to sample money (diff) | |
parent | Remove test T020_TestMakeRootAgent() which hasn't been active for ages anyway (diff) | |
download | opensim-SC_OLD-4834b476798cce715d0b5b286a6f20bc577bdabd.zip opensim-SC_OLD-4834b476798cce715d0b5b286a6f20bc577bdabd.tar.gz opensim-SC_OLD-4834b476798cce715d0b5b286a6f20bc577bdabd.tar.bz2 opensim-SC_OLD-4834b476798cce715d0b5b286a6f20bc577bdabd.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 333 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | 174 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 136 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | 71 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 40 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | 8 | ||||
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 12 | ||||
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 2 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 7 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 95 |
15 files changed, 574 insertions, 407 deletions
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index c2f9c3a..3be97b5 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -181,7 +181,6 @@ namespace OpenSim.Framework.Capabilities | |||
181 | 181 | ||
182 | RegisterRegionServiceHandlers(capsBase); | 182 | RegisterRegionServiceHandlers(capsBase); |
183 | RegisterInventoryServiceHandlers(capsBase); | 183 | RegisterInventoryServiceHandlers(capsBase); |
184 | |||
185 | } | 184 | } |
186 | 185 | ||
187 | public void RegisterRegionServiceHandlers(string capsBase) | 186 | public void RegisterRegionServiceHandlers(string capsBase) |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4c35132..1d05b02 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -785,7 +785,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
785 | if (methodWasFound) | 785 | if (methodWasFound) |
786 | { | 786 | { |
787 | xmlRprcRequest.Params.Add(request.Url); // Param[2] | 787 | xmlRprcRequest.Params.Add(request.Url); // Param[2] |
788 | xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] | 788 | |
789 | string xff = "X-Forwarded-For"; | ||
790 | string xfflower = xff.ToLower(); | ||
791 | foreach (string s in request.Headers.AllKeys) | ||
792 | { | ||
793 | if (s != null && s.Equals(xfflower)) | ||
794 | { | ||
795 | xff = xfflower; | ||
796 | break; | ||
797 | } | ||
798 | } | ||
799 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] | ||
800 | |||
789 | 801 | ||
790 | try | 802 | try |
791 | { | 803 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index b7f9d87..c865c0f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -845,7 +845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
845 | 845 | ||
846 | private void HandleUseCircuitCode(object o) | 846 | private void HandleUseCircuitCode(object o) |
847 | { | 847 | { |
848 | DateTime startTime = DateTime.Now; | 848 | // DateTime startTime = DateTime.Now; |
849 | object[] array = (object[])o; | 849 | object[] array = (object[])o; |
850 | UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; | 850 | UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; |
851 | UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1]; | 851 | UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1]; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index a514a83..ded8743 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -49,16 +49,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
49 | { | 49 | { |
50 | m_scene = scene; | 50 | m_scene = scene; |
51 | m_scene.RegisterModuleInterface<IDialogModule>(this); | 51 | m_scene.RegisterModuleInterface<IDialogModule>(this); |
52 | 52 | ||
53 | m_scene.AddCommand( | 53 | m_scene.AddCommand( |
54 | this, "alert", "alert <first> <last> <message>", | 54 | this, "alert", "alert <message>", |
55 | "Send an alert to a user", | 55 | "Send an alert to everyone", |
56 | HandleAlertConsoleCommand); | 56 | HandleAlertConsoleCommand); |
57 | 57 | ||
58 | m_scene.AddCommand( | 58 | m_scene.AddCommand( |
59 | this, "alert general", "alert [general] <message>", | 59 | this, "alert-user", "alert-user <first> <last> <message>", |
60 | "Send an alert to everyone", | 60 | "Send an alert to a user", |
61 | "If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.", | ||
62 | HandleAlertConsoleCommand); | 61 | HandleAlertConsoleCommand); |
63 | } | 62 | } |
64 | 63 | ||
@@ -177,55 +176,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
177 | { | 176 | { |
178 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) | 177 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) |
179 | return; | 178 | return; |
180 | 179 | ||
181 | bool isGeneral = false; | ||
182 | string firstName = string.Empty; | ||
183 | string lastName = string.Empty; | ||
184 | string message = string.Empty; | 180 | string message = string.Empty; |
185 | 181 | ||
186 | if (cmdparams.Length > 1) | 182 | if (cmdparams[0].ToLower().Equals("alert")) |
187 | { | ||
188 | firstName = cmdparams[1]; | ||
189 | isGeneral = firstName.ToLower().Equals("general"); | ||
190 | } | ||
191 | if (cmdparams.Length == 2 && !isGeneral) | ||
192 | { | 183 | { |
193 | // alert "message" | 184 | message = CombineParams(cmdparams, 1); |
194 | message = cmdparams[1]; | 185 | m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", |
195 | isGeneral = true; | 186 | m_scene.RegionInfo.RegionName, message); |
196 | } | 187 | SendGeneralAlert(message); |
197 | else if (cmdparams.Length > 2 && isGeneral) | ||
198 | { | ||
199 | // alert general <message> | ||
200 | message = CombineParams(cmdparams, 2); | ||
201 | } | 188 | } |
202 | else if (cmdparams.Length > 3) | 189 | else if (cmdparams.Length > 3) |
203 | { | 190 | { |
204 | // alert <first> <last> <message> | 191 | string firstName = cmdparams[1]; |
205 | lastName = cmdparams[2]; | 192 | string lastName = cmdparams[2]; |
206 | message = CombineParams(cmdparams, 3); | 193 | message = CombineParams(cmdparams, 3); |
194 | m_log.InfoFormat( | ||
195 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | ||
196 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | ||
197 | SendAlertToUser(firstName, lastName, message, false); | ||
207 | } | 198 | } |
208 | else | 199 | else |
209 | { | 200 | { |
210 | OpenSim.Framework.Console.MainConsole.Instance.Output( | 201 | OpenSim.Framework.Console.MainConsole.Instance.Output( |
211 | "Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>"); | 202 | "Usage: alert <message> | alert-user <first> <last> <message>"); |
212 | return; | 203 | return; |
213 | } | 204 | } |
214 | |||
215 | if (isGeneral) | ||
216 | { | ||
217 | m_log.InfoFormat( | ||
218 | "[DIALOG]: Sending general alert in region {0} with message {1}", | ||
219 | m_scene.RegionInfo.RegionName, message); | ||
220 | SendGeneralAlert(message); | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | m_log.InfoFormat( | ||
225 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | ||
226 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | ||
227 | SendAlertToUser(firstName, lastName, message, false); | ||
228 | } | ||
229 | } | 205 | } |
230 | 206 | ||
231 | private string CombineParams(string[] commandParams, int pos) | 207 | private string CombineParams(string[] commandParams, int pos) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f38a6fc..d4bfd46 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -131,7 +131,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
131 | protected ICapabilitiesModule m_capsModule; | 131 | protected ICapabilitiesModule m_capsModule; |
132 | // Central Update Loop | 132 | // Central Update Loop |
133 | protected int m_fps = 10; | 133 | protected int m_fps = 10; |
134 | protected uint m_frame; | 134 | |
135 | /// <summary> | ||
136 | /// Current scene frame number | ||
137 | /// </summary> | ||
138 | public uint Frame | ||
139 | { | ||
140 | get; | ||
141 | protected set; | ||
142 | } | ||
143 | |||
135 | protected float m_timespan = 0.089f; | 144 | protected float m_timespan = 0.089f; |
136 | protected DateTime m_lastupdate = DateTime.UtcNow; | 145 | protected DateTime m_lastupdate = DateTime.UtcNow; |
137 | 146 | ||
@@ -1212,6 +1221,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1212 | try | 1221 | try |
1213 | { | 1222 | { |
1214 | Update(); | 1223 | Update(); |
1224 | |||
1225 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1226 | m_firstHeartbeat = false; | ||
1215 | } | 1227 | } |
1216 | catch (ThreadAbortException) | 1228 | catch (ThreadAbortException) |
1217 | { | 1229 | { |
@@ -1225,190 +1237,180 @@ namespace OpenSim.Region.Framework.Scenes | |||
1225 | Watchdog.RemoveThread(); | 1237 | Watchdog.RemoveThread(); |
1226 | } | 1238 | } |
1227 | 1239 | ||
1228 | /// <summary> | ||
1229 | /// Performs per-frame updates on the scene, this should be the central scene loop | ||
1230 | /// </summary> | ||
1231 | public override void Update() | 1240 | public override void Update() |
1232 | { | 1241 | { |
1233 | float physicsFPS; | 1242 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; |
1234 | int maintc; | 1243 | float physicsFPS = 0f; |
1244 | |||
1245 | int maintc = Util.EnvironmentTickCount(); | ||
1246 | int tmpFrameMS = maintc; | ||
1247 | tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | ||
1248 | |||
1249 | // Increment the frame counter | ||
1250 | ++Frame; | ||
1235 | 1251 | ||
1236 | while (!shuttingdown) | 1252 | try |
1237 | { | 1253 | { |
1238 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; | 1254 | // Check if any objects have reached their targets |
1239 | physicsFPS = 0f; | 1255 | CheckAtTargets(); |
1240 | 1256 | ||
1241 | maintc = Util.EnvironmentTickCount(); | 1257 | // Update SceneObjectGroups that have scheduled themselves for updates |
1242 | int tmpFrameMS = maintc; | 1258 | // Objects queue their updates onto all scene presences |
1243 | tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1259 | if (Frame % m_update_objects == 0) |
1260 | m_sceneGraph.UpdateObjectGroups(); | ||
1244 | 1261 | ||
1245 | // Increment the frame counter | 1262 | // Run through all ScenePresences looking for updates |
1246 | ++m_frame; | 1263 | // Presence updates and queued object updates for each presence are sent to clients |
1264 | if (Frame % m_update_presences == 0) | ||
1265 | m_sceneGraph.UpdatePresences(); | ||
1247 | 1266 | ||
1248 | try | 1267 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) |
1268 | if (Frame % m_update_coarse_locations == 0) | ||
1249 | { | 1269 | { |
1250 | // Check if any objects have reached their targets | 1270 | List<Vector3> coarseLocations; |
1251 | CheckAtTargets(); | 1271 | List<UUID> avatarUUIDs; |
1272 | SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); | ||
1273 | // Send coarse locations to clients | ||
1274 | ForEachScenePresence(delegate(ScenePresence presence) | ||
1275 | { | ||
1276 | presence.SendCoarseLocations(coarseLocations, avatarUUIDs); | ||
1277 | }); | ||
1278 | } | ||
1252 | 1279 | ||
1253 | // Update SceneObjectGroups that have scheduled themselves for updates | 1280 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); |
1254 | // Objects queue their updates onto all scene presences | 1281 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1255 | if (m_frame % m_update_objects == 0) | 1282 | m_sceneGraph.UpdatePreparePhysics(); |
1256 | m_sceneGraph.UpdateObjectGroups(); | 1283 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); |
1257 | 1284 | ||
1258 | // Run through all ScenePresences looking for updates | 1285 | // Apply any pending avatar force input to the avatar's velocity |
1259 | // Presence updates and queued object updates for each presence are sent to clients | 1286 | if (Frame % m_update_entitymovement == 0) |
1260 | if (m_frame % m_update_presences == 0) | 1287 | m_sceneGraph.UpdateScenePresenceMovement(); |
1261 | m_sceneGraph.UpdatePresences(); | ||
1262 | 1288 | ||
1263 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | 1289 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1264 | if (m_frame % m_update_coarse_locations == 0) | 1290 | // velocity |
1265 | { | 1291 | int tmpPhysicsMS = Util.EnvironmentTickCount(); |
1266 | List<Vector3> coarseLocations; | 1292 | if (Frame % m_update_physics == 0) |
1267 | List<UUID> avatarUUIDs; | 1293 | { |
1268 | SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); | 1294 | if (m_physics_enabled) |
1269 | // Send coarse locations to clients | 1295 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); |
1270 | ForEachScenePresence(delegate(ScenePresence presence) | 1296 | if (SynchronizeScene != null) |
1271 | { | 1297 | SynchronizeScene(this); |
1272 | presence.SendCoarseLocations(coarseLocations, avatarUUIDs); | 1298 | } |
1273 | }); | 1299 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); |
1274 | } | ||
1275 | |||
1276 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); | ||
1277 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) | ||
1278 | m_sceneGraph.UpdatePreparePhysics(); | ||
1279 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); | ||
1280 | 1300 | ||
1281 | // Apply any pending avatar force input to the avatar's velocity | 1301 | // Delete temp-on-rez stuff |
1282 | if (m_frame % m_update_entitymovement == 0) | 1302 | if (Frame % 1000 == 0 && !m_cleaningTemps) |
1283 | m_sceneGraph.UpdateScenePresenceMovement(); | 1303 | { |
1304 | int tmpTempOnRezMS = Util.EnvironmentTickCount(); | ||
1305 | m_cleaningTemps = true; | ||
1306 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | ||
1307 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | ||
1308 | } | ||
1284 | 1309 | ||
1285 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1310 | if (RegionStatus != RegionStatus.SlaveScene) |
1286 | // velocity | 1311 | { |
1287 | int tmpPhysicsMS = Util.EnvironmentTickCount(); | 1312 | if (Frame % m_update_events == 0) |
1288 | if (m_frame % m_update_physics == 0) | ||
1289 | { | 1313 | { |
1290 | if (m_physics_enabled) | 1314 | int evMS = Util.EnvironmentTickCount(); |
1291 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); | 1315 | UpdateEvents(); |
1292 | if (SynchronizeScene != null) | 1316 | eventMS = Util.EnvironmentTickCountSubtract(evMS); ; |
1293 | SynchronizeScene(this); | ||
1294 | } | 1317 | } |
1295 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); | ||
1296 | 1318 | ||
1297 | // Delete temp-on-rez stuff | 1319 | if (Frame % m_update_backup == 0) |
1298 | if (m_frame % 1000 == 0 && !m_cleaningTemps) | ||
1299 | { | 1320 | { |
1300 | int tmpTempOnRezMS = Util.EnvironmentTickCount(); | 1321 | int backMS = Util.EnvironmentTickCount(); |
1301 | m_cleaningTemps = true; | 1322 | UpdateStorageBackup(); |
1302 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | 1323 | backupMS = Util.EnvironmentTickCountSubtract(backMS); |
1303 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | ||
1304 | } | 1324 | } |
1305 | 1325 | ||
1306 | if (RegionStatus != RegionStatus.SlaveScene) | 1326 | if (Frame % m_update_terrain == 0) |
1307 | { | 1327 | { |
1308 | if (m_frame % m_update_events == 0) | 1328 | int terMS = Util.EnvironmentTickCount(); |
1309 | { | 1329 | UpdateTerrain(); |
1310 | int evMS = Util.EnvironmentTickCount(); | 1330 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); |
1311 | UpdateEvents(); | ||
1312 | eventMS = Util.EnvironmentTickCountSubtract(evMS); ; | ||
1313 | } | ||
1314 | |||
1315 | if (m_frame % m_update_backup == 0) | ||
1316 | { | ||
1317 | int backMS = Util.EnvironmentTickCount(); | ||
1318 | UpdateStorageBackup(); | ||
1319 | backupMS = Util.EnvironmentTickCountSubtract(backMS); | ||
1320 | } | ||
1321 | |||
1322 | if (m_frame % m_update_terrain == 0) | ||
1323 | { | ||
1324 | int terMS = Util.EnvironmentTickCount(); | ||
1325 | UpdateTerrain(); | ||
1326 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | ||
1327 | } | ||
1328 | |||
1329 | if (m_frame % m_update_land == 0) | ||
1330 | { | ||
1331 | int ldMS = Util.EnvironmentTickCount(); | ||
1332 | UpdateLand(); | ||
1333 | landMS = Util.EnvironmentTickCountSubtract(ldMS); | ||
1334 | } | ||
1335 | |||
1336 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); | ||
1337 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1338 | lastCompletedFrame = Util.EnvironmentTickCount(); | ||
1339 | |||
1340 | // if (m_frame%m_update_avatars == 0) | ||
1341 | // UpdateInWorldTime(); | ||
1342 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1343 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1344 | StatsReporter.AddFPS(1); | ||
1345 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | ||
1346 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); | ||
1347 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | ||
1348 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | ||
1349 | StatsReporter.addFrameMS(frameMS); | ||
1350 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1351 | StatsReporter.addOtherMS(otherMS); | ||
1352 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | ||
1353 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1354 | } | 1331 | } |
1355 | 1332 | ||
1356 | if (LoginsDisabled && m_frame == 20) | 1333 | if (Frame % m_update_land == 0) |
1357 | { | 1334 | { |
1358 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | 1335 | int ldMS = Util.EnvironmentTickCount(); |
1359 | // this is a rare case where we know we have just went through a long cycle of heap | 1336 | UpdateLand(); |
1360 | // allocations, and there is no more work to be done until someone logs in | 1337 | landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1361 | GC.Collect(); | 1338 | } |
1362 | 1339 | ||
1363 | IConfig startupConfig = m_config.Configs["Startup"]; | 1340 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); |
1364 | if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) | 1341 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; |
1365 | { | 1342 | lastCompletedFrame = Util.EnvironmentTickCount(); |
1366 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | 1343 | |
1367 | LoginsDisabled = false; | 1344 | // if (Frame%m_update_avatars == 0) |
1368 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1345 | // UpdateInWorldTime(); |
1369 | } | 1346 | StatsReporter.AddPhysicsFPS(physicsFPS); |
1347 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1348 | StatsReporter.AddFPS(1); | ||
1349 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | ||
1350 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); | ||
1351 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | ||
1352 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | ||
1353 | StatsReporter.addFrameMS(frameMS); | ||
1354 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1355 | StatsReporter.addOtherMS(otherMS); | ||
1356 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | ||
1357 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1358 | } | ||
1359 | |||
1360 | if (LoginsDisabled && Frame == 20) | ||
1361 | { | ||
1362 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | ||
1363 | // this is a rare case where we know we have just went through a long cycle of heap | ||
1364 | // allocations, and there is no more work to be done until someone logs in | ||
1365 | GC.Collect(); | ||
1366 | |||
1367 | IConfig startupConfig = m_config.Configs["Startup"]; | ||
1368 | if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) | ||
1369 | { | ||
1370 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | ||
1371 | LoginsDisabled = false; | ||
1372 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | ||
1370 | } | 1373 | } |
1371 | } | 1374 | } |
1372 | catch (NotImplementedException) | 1375 | } |
1373 | { | 1376 | catch (NotImplementedException) |
1374 | throw; | 1377 | { |
1375 | } | 1378 | throw; |
1376 | catch (AccessViolationException e) | 1379 | } |
1377 | { | 1380 | catch (AccessViolationException e) |
1378 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1381 | { |
1379 | } | 1382 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1380 | //catch (NullReferenceException e) | 1383 | } |
1381 | //{ | 1384 | //catch (NullReferenceException e) |
1382 | // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1385 | //{ |
1383 | //} | 1386 | // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1384 | catch (InvalidOperationException e) | 1387 | //} |
1385 | { | 1388 | catch (InvalidOperationException e) |
1386 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1389 | { |
1387 | } | 1390 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1388 | catch (Exception e) | 1391 | } |
1389 | { | 1392 | catch (Exception e) |
1390 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1393 | { |
1391 | } | 1394 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1392 | finally | 1395 | } |
1393 | { | 1396 | finally |
1394 | m_lastupdate = DateTime.UtcNow; | 1397 | { |
1395 | } | 1398 | m_lastupdate = DateTime.UtcNow; |
1399 | } | ||
1396 | 1400 | ||
1397 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1401 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1398 | maintc = (int)(m_timespan * 1000) - maintc; | 1402 | maintc = (int)(m_timespan * 1000) - maintc; |
1399 | 1403 | ||
1400 | if (maintc > 0) | ||
1401 | Thread.Sleep(maintc); | ||
1402 | 1404 | ||
1403 | // Tell the watchdog that this thread is still alive | 1405 | m_lastUpdate = Util.EnvironmentTickCount(); |
1404 | Watchdog.UpdateThread(); | 1406 | m_firstHeartbeat = false; |
1405 | 1407 | ||
1406 | m_lastUpdate = Util.EnvironmentTickCount(); | 1408 | if (maintc > 0) |
1407 | m_firstHeartbeat = false; | 1409 | Thread.Sleep(maintc); |
1408 | } | ||
1409 | } | ||
1410 | 1410 | ||
1411 | 1411 | // Tell the watchdog that this thread is still alive | |
1412 | Watchdog.UpdateThread(); | ||
1413 | } | ||
1412 | 1414 | ||
1413 | public void AddGroupTarget(SceneObjectGroup grp) | 1415 | public void AddGroupTarget(SceneObjectGroup grp) |
1414 | { | 1416 | { |
@@ -3127,7 +3129,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3127 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); | 3129 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); |
3128 | 3130 | ||
3129 | m_sceneGraph.removeUserCount(!childagentYN); | 3131 | m_sceneGraph.removeUserCount(!childagentYN); |
3130 | CapsModule.RemoveCapsHandler(agentID); | 3132 | |
3133 | if (CapsModule != null) | ||
3134 | CapsModule.RemoveCapsHandler(agentID); | ||
3131 | 3135 | ||
3132 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3136 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3133 | // this method is doing is HORRIBLE!!! | 3137 | // this method is doing is HORRIBLE!!! |
@@ -3405,8 +3409,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3405 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3409 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3406 | agent.AgentID, agent.circuitcode); | 3410 | agent.AgentID, agent.circuitcode); |
3407 | 3411 | ||
3408 | CapsModule.NewUserConnection(agent); | 3412 | if (CapsModule != null) |
3409 | CapsModule.AddCapsHandler(agent.AgentID); | 3413 | { |
3414 | CapsModule.NewUserConnection(agent); | ||
3415 | CapsModule.AddCapsHandler(agent.AgentID); | ||
3416 | } | ||
3410 | } | 3417 | } |
3411 | else | 3418 | else |
3412 | { | 3419 | { |
@@ -3421,7 +3428,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3421 | agent.AgentID, RegionInfo.RegionName); | 3428 | agent.AgentID, RegionInfo.RegionName); |
3422 | 3429 | ||
3423 | sp.AdjustKnownSeeds(); | 3430 | sp.AdjustKnownSeeds(); |
3424 | CapsModule.NewUserConnection(agent); | 3431 | |
3432 | if (CapsModule != null) | ||
3433 | CapsModule.NewUserConnection(agent); | ||
3425 | } | 3434 | } |
3426 | } | 3435 | } |
3427 | 3436 | ||
@@ -3933,15 +3942,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3933 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 3942 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
3934 | Vector3 lookat, uint teleportFlags) | 3943 | Vector3 lookat, uint teleportFlags) |
3935 | { | 3944 | { |
3936 | GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); | 3945 | List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); |
3937 | if (regionInfo == null) | 3946 | if (regions == null || regions.Count == 0) |
3938 | { | 3947 | { |
3939 | // can't find the region: Tell viewer and abort | 3948 | // can't find the region: Tell viewer and abort |
3940 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); | 3949 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); |
3941 | return; | 3950 | return; |
3942 | } | 3951 | } |
3943 | 3952 | ||
3944 | RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); | 3953 | RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); |
3945 | } | 3954 | } |
3946 | 3955 | ||
3947 | /// <summary> | 3956 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index af24ed3..fd03e93 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1310,7 +1310,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1310 | if (m_agentTransfer != null) | 1310 | if (m_agentTransfer != null) |
1311 | m_agentTransfer.EnableChildAgents(this); | 1311 | m_agentTransfer.EnableChildAgents(this); |
1312 | else | 1312 | else |
1313 | m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); | 1313 | m_log.DebugFormat( |
1314 | "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}", | ||
1315 | m_scene.RegionInfo.RegionName); | ||
1314 | 1316 | ||
1315 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 1317 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
1316 | if (friendsModule != null) | 1318 | if (friendsModule != null) |
@@ -3028,8 +3030,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3028 | #region Border Crossing Methods | 3030 | #region Border Crossing Methods |
3029 | 3031 | ||
3030 | /// <summary> | 3032 | /// <summary> |
3031 | /// Checks to see if the avatar is in range of a border and calls CrossToNewRegion | 3033 | /// Starts the process of moving an avatar into another region if they are crossing the border. |
3032 | /// </summary> | 3034 | /// </summary> |
3035 | /// <remarks> | ||
3036 | /// Also removes the avatar from the physical scene if transit has started. | ||
3037 | /// </remarks> | ||
3033 | protected void CheckForBorderCrossing() | 3038 | protected void CheckForBorderCrossing() |
3034 | { | 3039 | { |
3035 | if (IsChildAgent) | 3040 | if (IsChildAgent) |
@@ -3097,7 +3102,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3097 | neighbor = HaveNeighbor(Cardinals.N, ref fix); | 3102 | neighbor = HaveNeighbor(Cardinals.N, ref fix); |
3098 | } | 3103 | } |
3099 | 3104 | ||
3100 | |||
3101 | // Makes sure avatar does not end up outside region | 3105 | // Makes sure avatar does not end up outside region |
3102 | if (neighbor <= 0) | 3106 | if (neighbor <= 0) |
3103 | { | 3107 | { |
@@ -3152,6 +3156,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3152 | } | 3156 | } |
3153 | else | 3157 | else |
3154 | { | 3158 | { |
3159 | // We must remove the agent from the physical scene if it has been placed in transit. If we don't, | ||
3160 | // then this method continues to be called from ScenePresence.Update() until the handover of the client between | ||
3161 | // regions is completed. Since this handover can take more than 1000ms (due to the 1000ms | ||
3162 | // event queue polling response from the server), this results in the avatar pausing on the border | ||
3163 | // for the handover period. | ||
3164 | RemoveFromPhysicalScene(); | ||
3165 | |||
3155 | // This constant has been inferred from experimentation | 3166 | // This constant has been inferred from experimentation |
3156 | // I'm not sure what this value should be, so I tried a few values. | 3167 | // I'm not sure what this value should be, so I tried a few values. |
3157 | timeStep = 0.04f; | 3168 | timeStep = 0.04f; |
@@ -3163,6 +3174,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3163 | } | 3174 | } |
3164 | } | 3175 | } |
3165 | 3176 | ||
3177 | /// <summary> | ||
3178 | /// Checks whether this region has a neighbour in the given direction. | ||
3179 | /// </summary> | ||
3180 | /// <param name="car"></param> | ||
3181 | /// <param name="fix"></param> | ||
3182 | /// <returns> | ||
3183 | /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8. | ||
3184 | /// Returns a positive integer if there is a region in that direction, a negative integer if not. | ||
3185 | /// </returns> | ||
3166 | protected int HaveNeighbor(Cardinals car, ref int[] fix) | 3186 | protected int HaveNeighbor(Cardinals car, ref int[] fix) |
3167 | { | 3187 | { |
3168 | uint neighbourx = m_regionInfo.RegionLocX; | 3188 | uint neighbourx = m_regionInfo.RegionLocX; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs new file mode 100644 index 0000000..af44640 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Timer=System.Timers.Timer; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenMetaverse; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Communications; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Region.Framework.Interfaces; | ||
43 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
45 | using OpenSim.Tests.Common; | ||
46 | using OpenSim.Tests.Common.Mock; | ||
47 | using OpenSim.Tests.Common.Setup; | ||
48 | |||
49 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
50 | { | ||
51 | /// <summary> | ||
52 | /// Attachment tests | ||
53 | /// </summary> | ||
54 | [TestFixture] | ||
55 | public class AttachmentTests | ||
56 | { | ||
57 | public Scene scene, scene2; | ||
58 | public UUID agent1; | ||
59 | public static Random random; | ||
60 | public ulong region1, region2; | ||
61 | public AgentCircuitData acd1; | ||
62 | public SceneObjectGroup sog1, sog2, sog3; | ||
63 | |||
64 | [TestFixtureSetUp] | ||
65 | public void Init() | ||
66 | { | ||
67 | TestHelper.InMethod(); | ||
68 | |||
69 | scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | ||
70 | scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | ||
71 | |||
72 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | ||
73 | interregionComms.Initialise(new IniConfigSource()); | ||
74 | interregionComms.PostInitialise(); | ||
75 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); | ||
76 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); | ||
77 | |||
78 | agent1 = UUID.Random(); | ||
79 | random = new Random(); | ||
80 | sog1 = NewSOG(UUID.Random(), scene, agent1); | ||
81 | sog2 = NewSOG(UUID.Random(), scene, agent1); | ||
82 | sog3 = NewSOG(UUID.Random(), scene, agent1); | ||
83 | |||
84 | //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | ||
85 | region1 = scene.RegionInfo.RegionHandle; | ||
86 | region2 = scene2.RegionInfo.RegionHandle; | ||
87 | |||
88 | SceneSetupHelpers.AddRootAgent(scene, agent1); | ||
89 | } | ||
90 | |||
91 | [Test] | ||
92 | public void T030_TestAddAttachments() | ||
93 | { | ||
94 | TestHelper.InMethod(); | ||
95 | |||
96 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
97 | |||
98 | presence.AddAttachment(sog1); | ||
99 | presence.AddAttachment(sog2); | ||
100 | presence.AddAttachment(sog3); | ||
101 | |||
102 | Assert.That(presence.HasAttachments(), Is.True); | ||
103 | Assert.That(presence.ValidateAttachments(), Is.True); | ||
104 | } | ||
105 | |||
106 | [Test] | ||
107 | public void T031_RemoveAttachments() | ||
108 | { | ||
109 | TestHelper.InMethod(); | ||
110 | |||
111 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
112 | presence.RemoveAttachment(sog1); | ||
113 | presence.RemoveAttachment(sog2); | ||
114 | presence.RemoveAttachment(sog3); | ||
115 | Assert.That(presence.HasAttachments(), Is.False); | ||
116 | } | ||
117 | |||
118 | // I'm commenting this test because scene setup NEEDS InventoryService to | ||
119 | // be non-null | ||
120 | //[Test] | ||
121 | public void T032_CrossAttachments() | ||
122 | { | ||
123 | TestHelper.InMethod(); | ||
124 | |||
125 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
126 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
127 | presence2.AddAttachment(sog1); | ||
128 | presence2.AddAttachment(sog2); | ||
129 | |||
130 | ISharedRegionModule serialiser = new SerialiserModule(); | ||
131 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
132 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
133 | |||
134 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
135 | |||
136 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | ||
137 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | ||
138 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | ||
139 | } | ||
140 | |||
141 | private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) | ||
142 | { | ||
143 | SceneObjectPart sop = new SceneObjectPart(); | ||
144 | sop.Name = RandomName(); | ||
145 | sop.Description = RandomName(); | ||
146 | sop.Text = RandomName(); | ||
147 | sop.SitName = RandomName(); | ||
148 | sop.TouchName = RandomName(); | ||
149 | sop.UUID = uuid; | ||
150 | sop.Shape = PrimitiveBaseShape.Default; | ||
151 | sop.Shape.State = 1; | ||
152 | sop.OwnerID = agent; | ||
153 | |||
154 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
155 | sog.SetScene(scene); | ||
156 | |||
157 | return sog; | ||
158 | } | ||
159 | |||
160 | private static string RandomName() | ||
161 | { | ||
162 | StringBuilder name = new StringBuilder(); | ||
163 | int size = random.Next(5,12); | ||
164 | char ch; | ||
165 | for (int i = 0; i < size; i++) | ||
166 | { | ||
167 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
168 | name.Append(ch); | ||
169 | } | ||
170 | |||
171 | return name.ToString(); | ||
172 | } | ||
173 | } | ||
174 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ef52363..fd2d6fa 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework; | |||
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 44 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
@@ -116,9 +117,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | 117 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); |
117 | agent.child = true; | 118 | agent.child = true; |
118 | 119 | ||
119 | if (scene.PresenceService == null) | ||
120 | Console.WriteLine("Presence Service is null"); | ||
121 | |||
122 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); | 120 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); |
123 | 121 | ||
124 | string reason; | 122 | string reason; |
@@ -175,25 +173,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
175 | 173 | ||
176 | Assert.That(neighbours.Count, Is.EqualTo(2)); | 174 | Assert.That(neighbours.Count, Is.EqualTo(2)); |
177 | } | 175 | } |
178 | |||
179 | public void fixNullPresence() | ||
180 | { | ||
181 | string firstName = "testfirstname"; | ||
182 | |||
183 | AgentCircuitData agent = new AgentCircuitData(); | ||
184 | agent.AgentID = agent1; | ||
185 | agent.firstname = firstName; | ||
186 | agent.lastname = "testlastname"; | ||
187 | agent.SessionID = UUID.Zero; | ||
188 | agent.SecureSessionID = UUID.Zero; | ||
189 | agent.circuitcode = 123; | ||
190 | agent.BaseFolder = UUID.Zero; | ||
191 | agent.InventoryFolder = UUID.Zero; | ||
192 | agent.startpos = Vector3.Zero; | ||
193 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
194 | |||
195 | acd1 = agent; | ||
196 | } | ||
197 | 176 | ||
198 | [Test] | 177 | [Test] |
199 | public void T013_TestRemoveNeighbourRegion() | 178 | public void T013_TestRemoveNeighbourRegion() |
@@ -211,24 +190,36 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
211 | CompleteAvatarMovement | 190 | CompleteAvatarMovement |
212 | */ | 191 | */ |
213 | } | 192 | } |
214 | 193 | ||
215 | // I'm commenting this test, because this is not supposed to happen here | 194 | /// <summary> |
216 | //[Test] | 195 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
217 | public void T020_TestMakeRootAgent() | 196 | /// </summary> |
197 | /// <remarks> | ||
198 | /// Please note that unlike the other tests here, this doesn't rely on structures | ||
199 | /// </remarks> | ||
200 | [Test] | ||
201 | public void TestChildAgentEstablished() | ||
218 | { | 202 | { |
219 | TestHelper.InMethod(); | 203 | TestHelper.InMethod(); |
220 | 204 | // log4net.Config.XmlConfigurator.Configure(); | |
221 | ScenePresence presence = scene.GetScenePresence(agent1); | 205 | |
222 | Assert.That(presence.IsChildAgent, Is.False, "Starts out as a root agent"); | 206 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
223 | 207 | ||
224 | presence.MakeChildAgent(); | 208 | TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
225 | Assert.That(presence.IsChildAgent, Is.True, "Did not change to child agent after MakeChildAgent"); | 209 | TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
226 | 210 | ||
227 | // Accepts 0 but rejects Constants.RegionSize | 211 | IConfigSource configSource = new IniConfigSource(); |
228 | Vector3 pos = new Vector3(0,unchecked(Constants.RegionSize-1),0); | 212 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); |
229 | presence.MakeRootAgent(pos,true); | 213 | EntityTransferModule etm = new EntityTransferModule(); |
230 | Assert.That(presence.IsChildAgent, Is.False, "Did not go back to root agent"); | 214 | |
231 | Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered"); | 215 | SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); |
216 | |||
217 | SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); | ||
218 | ScenePresence childPresence = myScene2.GetScenePresence(agent1); | ||
219 | |||
220 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | ||
221 | // Assert.That(childPresence, Is.Not.Null); | ||
222 | // Assert.That(childPresence.IsChildAgent, Is.True); | ||
232 | } | 223 | } |
233 | 224 | ||
234 | // I'm commenting this test because it does not represent | 225 | // I'm commenting this test because it does not represent |
@@ -333,63 +324,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
333 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); | 324 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); |
334 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); | 325 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); |
335 | } | 326 | } |
336 | 327 | ||
337 | [Test] | 328 | public void fixNullPresence() |
338 | public void T030_TestAddAttachments() | ||
339 | { | ||
340 | TestHelper.InMethod(); | ||
341 | |||
342 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
343 | |||
344 | presence.AddAttachment(sog1); | ||
345 | presence.AddAttachment(sog2); | ||
346 | presence.AddAttachment(sog3); | ||
347 | |||
348 | Assert.That(presence.HasAttachments(), Is.True); | ||
349 | Assert.That(presence.ValidateAttachments(), Is.True); | ||
350 | } | ||
351 | |||
352 | [Test] | ||
353 | public void T031_RemoveAttachments() | ||
354 | { | ||
355 | TestHelper.InMethod(); | ||
356 | |||
357 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
358 | presence.RemoveAttachment(sog1); | ||
359 | presence.RemoveAttachment(sog2); | ||
360 | presence.RemoveAttachment(sog3); | ||
361 | Assert.That(presence.HasAttachments(), Is.False); | ||
362 | } | ||
363 | |||
364 | // I'm commenting this test because scene setup NEEDS InventoryService to | ||
365 | // be non-null | ||
366 | //[Test] | ||
367 | public void T032_CrossAttachments() | ||
368 | { | 329 | { |
369 | TestHelper.InMethod(); | 330 | string firstName = "testfirstname"; |
370 | |||
371 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
372 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
373 | presence2.AddAttachment(sog1); | ||
374 | presence2.AddAttachment(sog2); | ||
375 | |||
376 | ISharedRegionModule serialiser = new SerialiserModule(); | ||
377 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
378 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
379 | |||
380 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
381 | 331 | ||
382 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | 332 | AgentCircuitData agent = new AgentCircuitData(); |
383 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | 333 | agent.AgentID = agent1; |
384 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | 334 | agent.firstname = firstName; |
385 | } | 335 | agent.lastname = "testlastname"; |
336 | agent.SessionID = UUID.Zero; | ||
337 | agent.SecureSessionID = UUID.Zero; | ||
338 | agent.circuitcode = 123; | ||
339 | agent.BaseFolder = UUID.Zero; | ||
340 | agent.InventoryFolder = UUID.Zero; | ||
341 | agent.startpos = Vector3.Zero; | ||
342 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
386 | 343 | ||
387 | [TearDown] | 344 | acd1 = agent; |
388 | public void TearDown() | ||
389 | { | ||
390 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | ||
391 | } | 345 | } |
392 | 346 | ||
393 | public static string GetRandomCapsObjectPath() | 347 | public static string GetRandomCapsObjectPath() |
394 | { | 348 | { |
395 | UUID caps = UUID.Random(); | 349 | UUID caps = UUID.Random(); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs new file mode 100644 index 0000000..9aba8a8 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Timer=System.Timers.Timer; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenMetaverse; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Communications; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Region.Framework.Interfaces; | ||
43 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
45 | using OpenSim.Tests.Common; | ||
46 | using OpenSim.Tests.Common.Mock; | ||
47 | using OpenSim.Tests.Common.Setup; | ||
48 | |||
49 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
50 | { | ||
51 | /// <summary> | ||
52 | /// Scene presence tests | ||
53 | /// </summary> | ||
54 | [TestFixture] | ||
55 | public class SceneTests | ||
56 | { | ||
57 | /// <summary> | ||
58 | /// Very basic scene update test. Should become more elaborate with time. | ||
59 | /// </summary> | ||
60 | [Test] | ||
61 | public void TestUpdateScene() | ||
62 | { | ||
63 | TestHelper.InMethod(); | ||
64 | |||
65 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
66 | scene.Update(); | ||
67 | |||
68 | Assert.That(scene.Frame, Is.EqualTo(1)); | ||
69 | } | ||
70 | } | ||
71 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c2e5c13..39e1a27 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -690,10 +690,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
690 | // | 690 | // |
691 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 691 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); |
692 | 692 | ||
693 | TeleportAgent(agent, regionName, position, lookat); | 693 | TeleportAgent(agent, regionName, position, lookat, false); |
694 | } | 694 | } |
695 | 695 | ||
696 | private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 696 | private void TeleportAgent(string agent, string regionName, |
697 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | ||
697 | { | 698 | { |
698 | m_host.AddScriptLPS(1); | 699 | m_host.AddScriptLPS(1); |
699 | UUID agentId = new UUID(); | 700 | UUID agentId = new UUID(); |
@@ -702,25 +703,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
702 | ScenePresence presence = World.GetScenePresence(agentId); | 703 | ScenePresence presence = World.GetScenePresence(agentId); |
703 | if (presence != null) | 704 | if (presence != null) |
704 | { | 705 | { |
705 | // agent must be over owners land to avoid abuse | 706 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
706 | if (m_host.OwnerID | 707 | // For osTeleportOwner, this restriction isn't necessary |
708 | if (relaxRestrictions || | ||
709 | m_host.OwnerID | ||
707 | == World.LandChannel.GetLandObject( | 710 | == World.LandChannel.GetLandObject( |
708 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 711 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
709 | { | 712 | { |
710 | // Check for hostname, attempt to make a HG link, | ||
711 | // and convert the regionName to the target region | ||
712 | if (regionName.Contains(".") && regionName.Contains(":")) | ||
713 | { | ||
714 | // Even though we use none of the results, we need to perform this call because it appears | ||
715 | // to have some the side effect of setting up hypergrid teleport locations. | ||
716 | World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
717 | // List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
718 | |||
719 | string[] parts = regionName.Split(new char[] { ':' }); | ||
720 | if (parts.Length > 2) | ||
721 | regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; | ||
722 | regionName = "http://" + regionName; | ||
723 | } | ||
724 | World.RequestTeleportLocation(presence.ControllingClient, regionName, | 713 | World.RequestTeleportLocation(presence.ControllingClient, regionName, |
725 | new Vector3((float)position.x, (float)position.y, (float)position.z), | 714 | new Vector3((float)position.x, (float)position.y, (float)position.z), |
726 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); | 715 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); |
@@ -737,10 +726,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
737 | // | 726 | // |
738 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 727 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); |
739 | 728 | ||
740 | TeleportAgent(agent, regionX, regionY, position, lookat); | 729 | TeleportAgent(agent, regionX, regionY, position, lookat, false); |
741 | } | 730 | } |
742 | 731 | ||
743 | private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 732 | private void TeleportAgent(string agent, int regionX, int regionY, |
733 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | ||
744 | { | 734 | { |
745 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); | 735 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); |
746 | 736 | ||
@@ -751,8 +741,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
751 | ScenePresence presence = World.GetScenePresence(agentId); | 741 | ScenePresence presence = World.GetScenePresence(agentId); |
752 | if (presence != null) | 742 | if (presence != null) |
753 | { | 743 | { |
754 | // agent must be over owners land to avoid abuse | 744 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
755 | if (m_host.OwnerID | 745 | // For osTeleportOwner, this restriction isn't necessary |
746 | if (relaxRestrictions || | ||
747 | m_host.OwnerID | ||
756 | == World.LandChannel.GetLandObject( | 748 | == World.LandChannel.GetLandObject( |
757 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 749 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
758 | { | 750 | { |
@@ -775,7 +767,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
775 | // Threat level None because this is what can already be done with the World Map in the viewer | 767 | // Threat level None because this is what can already be done with the World Map in the viewer |
776 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 768 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
777 | 769 | ||
778 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); | 770 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); |
779 | } | 771 | } |
780 | 772 | ||
781 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 773 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
@@ -787,7 +779,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
787 | { | 779 | { |
788 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 780 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
789 | 781 | ||
790 | TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); | 782 | TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); |
791 | } | 783 | } |
792 | 784 | ||
793 | // Functions that get information from the agent itself. | 785 | // Functions that get information from the agent itself. |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 98f72f0..3c5ecc5 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -185,7 +185,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
185 | } | 185 | } |
186 | 186 | ||
187 | // unreachable | 187 | // unreachable |
188 | return true; | 188 | // return true; |
189 | } | 189 | } |
190 | 190 | ||
191 | /// <summary> | 191 | /// <summary> |
@@ -274,7 +274,11 @@ namespace OpenSim.Services.Connectors.Simulation | |||
274 | try | 274 | try |
275 | { | 275 | { |
276 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); | 276 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); |
277 | bool success = result["Success"].AsBoolean(); | 277 | bool success = result["success"].AsBoolean(); |
278 | reason = result["reason"].AsString(); | ||
279 | |||
280 | //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success); | ||
281 | |||
278 | if (!success) | 282 | if (!success) |
279 | { | 283 | { |
280 | if (result.ContainsKey("Message")) | 284 | if (result.ContainsKey("Message")) |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aeff9b5..985d77b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -271,6 +271,7 @@ namespace OpenSim.Services.GridService | |||
271 | { | 271 | { |
272 | List<GridRegion> rinfos = new List<GridRegion>(); | 272 | List<GridRegion> rinfos = new List<GridRegion>(); |
273 | RegionData region = m_Database.Get(regionID, scopeID); | 273 | RegionData region = m_Database.Get(regionID, scopeID); |
274 | |||
274 | if (region != null) | 275 | if (region != null) |
275 | { | 276 | { |
276 | // Not really? Maybe? | 277 | // Not really? Maybe? |
@@ -278,15 +279,24 @@ namespace OpenSim.Services.GridService | |||
278 | region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); | 279 | region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); |
279 | 280 | ||
280 | foreach (RegionData rdata in rdatas) | 281 | foreach (RegionData rdata in rdatas) |
282 | { | ||
281 | if (rdata.RegionID != regionID) | 283 | if (rdata.RegionID != regionID) |
282 | { | 284 | { |
283 | int flags = Convert.ToInt32(rdata.Data["flags"]); | 285 | int flags = Convert.ToInt32(rdata.Data["flags"]); |
284 | if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours | 286 | if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours |
285 | rinfos.Add(RegionData2RegionInfo(rdata)); | 287 | rinfos.Add(RegionData2RegionInfo(rdata)); |
286 | } | 288 | } |
289 | } | ||
287 | 290 | ||
291 | m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); | ||
288 | } | 292 | } |
289 | m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); | 293 | else |
294 | { | ||
295 | m_log.WarnFormat( | ||
296 | "[GRID SERVICE]: GetNeighbours() called for scope {0}, region {1} but no such region found", | ||
297 | scopeID, regionID); | ||
298 | } | ||
299 | |||
290 | return rinfos; | 300 | return rinfos; |
291 | } | 301 | } |
292 | 302 | ||
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index e0d8103..a4aa44d 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService | |||
121 | 121 | ||
122 | m_Check4096 = gridConfig.GetBoolean("Check4096", true); | 122 | m_Check4096 = gridConfig.GetBoolean("Check4096", true); |
123 | 123 | ||
124 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); | 124 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); |
125 | 125 | ||
126 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); | 126 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); |
127 | 127 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 147571b..7b7d66e 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -560,8 +560,11 @@ namespace OpenSim.Tests.Common.Mock | |||
560 | agentData.lastname = m_lastName; | 560 | agentData.lastname = m_lastName; |
561 | 561 | ||
562 | ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); | 562 | ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); |
563 | agentData.CapsPath = capsModule.GetCapsPath(m_agentId); | 563 | if (capsModule != null) |
564 | agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId)); | 564 | { |
565 | agentData.CapsPath = capsModule.GetCapsPath(m_agentId); | ||
566 | agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId)); | ||
567 | } | ||
565 | 568 | ||
566 | return agentData; | 569 | return agentData; |
567 | } | 570 | } |
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 8b16496..5be70bc 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -132,24 +132,11 @@ namespace OpenSim.Tests.Common.Setup | |||
132 | public static TestScene SetupScene( | 132 | public static TestScene SetupScene( |
133 | string name, UUID id, uint x, uint y, String realServices) | 133 | string name, UUID id, uint x, uint y, String realServices) |
134 | { | 134 | { |
135 | bool newScene = false; | ||
136 | |||
137 | Console.WriteLine("Setting up test scene {0}", name); | 135 | Console.WriteLine("Setting up test scene {0}", name); |
138 | 136 | ||
139 | // REFACTORING PROBLEM! | ||
140 | //// If cm is the same as our last commsManager used, this means the tester wants to link | ||
141 | //// regions. In this case, don't use the sameshared region modules and dont initialize them again. | ||
142 | //// Also, no need to start another MainServer and MainConsole instance. | ||
143 | //if (cm == null || cm != commsManager) | ||
144 | //{ | ||
145 | // System.Console.WriteLine("Starting a brand new scene"); | ||
146 | // newScene = true; | ||
147 | MainConsole.Instance = new MockConsole("TEST PROMPT"); | ||
148 | // MainServer.Instance = new BaseHttpServer(980); | ||
149 | // commsManager = cm; | ||
150 | //} | ||
151 | |||
152 | // We must set up a console otherwise setup of some modules may fail | 137 | // We must set up a console otherwise setup of some modules may fail |
138 | MainConsole.Instance = new MockConsole("TEST PROMPT"); | ||
139 | |||
153 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | 140 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); |
154 | regInfo.RegionName = name; | 141 | regInfo.RegionName = name; |
155 | regInfo.RegionID = id; | 142 | regInfo.RegionID = id; |
@@ -164,50 +151,27 @@ namespace OpenSim.Tests.Common.Setup | |||
164 | TestScene testScene = new TestScene( | 151 | TestScene testScene = new TestScene( |
165 | regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); | 152 | regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); |
166 | 153 | ||
167 | INonSharedRegionModule capsModule = new CapabilitiesModule(); | ||
168 | capsModule.Initialise(new IniConfigSource()); | ||
169 | testScene.AddRegionModule(capsModule.Name, capsModule); | ||
170 | capsModule.AddRegion(testScene); | ||
171 | |||
172 | IRegionModule godsModule = new GodsModule(); | 154 | IRegionModule godsModule = new GodsModule(); |
173 | godsModule.Initialise(testScene, new IniConfigSource()); | 155 | godsModule.Initialise(testScene, new IniConfigSource()); |
174 | testScene.AddModule(godsModule.Name, godsModule); | 156 | testScene.AddModule(godsModule.Name, godsModule); |
175 | realServices = realServices.ToLower(); | 157 | realServices = realServices.ToLower(); |
176 | // IConfigSource config = new IniConfigSource(); | ||
177 | 158 | ||
178 | // If we have a brand new scene, need to initialize shared region modules | 159 | if (realServices.Contains("asset")) |
179 | if ((m_assetService == null && m_inventoryService == null) || newScene) | 160 | StartAssetService(testScene, true); |
180 | { | ||
181 | if (realServices.Contains("asset")) | ||
182 | StartAssetService(testScene, true); | ||
183 | else | ||
184 | StartAssetService(testScene, false); | ||
185 | |||
186 | // For now, always started a 'real' authentication service | ||
187 | StartAuthenticationService(testScene, true); | ||
188 | |||
189 | if (realServices.Contains("inventory")) | ||
190 | StartInventoryService(testScene, true); | ||
191 | else | ||
192 | StartInventoryService(testScene, false); | ||
193 | |||
194 | StartGridService(testScene, true); | ||
195 | StartUserAccountService(testScene); | ||
196 | StartPresenceService(testScene); | ||
197 | } | ||
198 | // If not, make sure the shared module gets references to this new scene | ||
199 | else | 161 | else |
200 | { | 162 | StartAssetService(testScene, false); |
201 | m_assetService.AddRegion(testScene); | ||
202 | m_assetService.RegionLoaded(testScene); | ||
203 | m_inventoryService.AddRegion(testScene); | ||
204 | m_inventoryService.RegionLoaded(testScene); | ||
205 | m_userAccountService.AddRegion(testScene); | ||
206 | m_userAccountService.RegionLoaded(testScene); | ||
207 | m_presenceService.AddRegion(testScene); | ||
208 | m_presenceService.RegionLoaded(testScene); | ||
209 | 163 | ||
210 | } | 164 | // For now, always started a 'real' authentication service |
165 | StartAuthenticationService(testScene, true); | ||
166 | |||
167 | if (realServices.Contains("inventory")) | ||
168 | StartInventoryService(testScene, true); | ||
169 | else | ||
170 | StartInventoryService(testScene, false); | ||
171 | |||
172 | StartGridService(testScene, true); | ||
173 | StartUserAccountService(testScene); | ||
174 | StartPresenceService(testScene); | ||
211 | 175 | ||
212 | m_inventoryService.PostInitialise(); | 176 | m_inventoryService.PostInitialise(); |
213 | m_assetService.PostInitialise(); | 177 | m_assetService.PostInitialise(); |
@@ -504,12 +468,10 @@ namespace OpenSim.Tests.Common.Setup | |||
504 | TestClient client = new TestClient(agentData, scene); | 468 | TestClient client = new TestClient(agentData, scene); |
505 | scene.AddNewClient(client); | 469 | scene.AddNewClient(client); |
506 | 470 | ||
507 | // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, | 471 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. |
508 | // inventory, etc.) | ||
509 | //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE | ||
510 | |||
511 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); | 472 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); |
512 | scp.MakeRootAgent(new Vector3(90, 90, 90), true); | 473 | scp.CompleteMovement(client); |
474 | //scp.MakeRootAgent(new Vector3(90, 90, 90), true); | ||
513 | 475 | ||
514 | return client; | 476 | return client; |
515 | } | 477 | } |
@@ -543,24 +505,5 @@ namespace OpenSim.Tests.Common.Setup | |||
543 | 505 | ||
544 | return part; | 506 | return part; |
545 | } | 507 | } |
546 | |||
547 | /// <summary> | ||
548 | /// Delete a scene object asynchronously | ||
549 | /// </summary> | ||
550 | /// <param name="scene"></param> | ||
551 | /// <param name="part"></param> | ||
552 | /// <param name="action"></param> | ||
553 | /// <param name="destinationId"></param> | ||
554 | /// <param name="client"></param> | ||
555 | public static void DeleteSceneObjectAsync( | ||
556 | TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client) | ||
557 | { | ||
558 | // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test | ||
559 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
560 | sogd.Enabled = false; | ||
561 | |||
562 | scene.DeRezObjects(client, new List<uint>() { part.LocalId }, UUID.Zero, action, destinationId); | ||
563 | sogd.InventoryDeQueueAndDelete(); | ||
564 | } | ||
565 | } | 508 | } |
566 | } | 509 | } |