aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs13
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs148
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs24
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs200
19 files changed, 334 insertions, 200 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 1e22fcc..fb6b11e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
244 base.Start(m_recvBufferSize, m_asyncPacketHandling); 244 base.Start(m_recvBufferSize, m_asyncPacketHandling);
245 245
246 // Start the packet processing threads 246 // Start the packet processing threads
247 Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); 247 Watchdog.StartThread(
248 Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); 248 IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
249 Watchdog.StartThread(
250 OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
251
249 m_elapsedMSSinceLastStatReport = Environment.TickCount; 252 m_elapsedMSSinceLastStatReport = Environment.TickCount;
250 } 253 }
251 254
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index a81f36c..650069a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -349,8 +349,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
349 { 349 {
350 try 350 try
351 { 351 {
352 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
353
354 Dictionary<string, object> options = new Dictionary<string, object>(); 352 Dictionary<string, object> options = new Dictionary<string, object>();
355 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 353 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
356 354
@@ -412,7 +410,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
412 return; 410 return;
413 } 411 }
414 412
415 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
416 if (options.ContainsKey("home")) 413 if (options.ContainsKey("home"))
417 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); 414 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
418 415
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 0c4ff7f..d2fe388 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
117 string userAssetServer = string.Empty; 117 string userAssetServer = string.Empty;
118 if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) 118 if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
119 { 119 {
120 Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); 120 m_assMapper.Post(assetID, avatarID, userAssetServer);
121 } 121 }
122 } 122 }
123 123
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index f367739..a6e2548 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
1210 if (homeScene.TryGetScenePresence(avatarId,out avatar)) 1210 if (homeScene.TryGetScenePresence(avatarId,out avatar))
1211 { 1211 {
1212 KillAUser ku = new KillAUser(avatar,mod); 1212 KillAUser ku = new KillAUser(avatar,mod);
1213 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); 1213 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
1214 } 1214 }
1215 } 1215 }
1216 1216
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 1c503aa..f6d4b40 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land
94 94
95 // caches ExtendedLandData 95 // caches ExtendedLandData
96 private Cache parcelInfoCache; 96 private Cache parcelInfoCache;
97 private Dictionary<UUID, Vector3> forcedPosition = 97
98 new Dictionary<UUID, Vector3>(); 98 /// <summary>
99 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
100 /// </summary>
101 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
99 102
100 #region INonSharedRegionModule Members 103 #region INonSharedRegionModule Members
101 104
@@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land
224 //When the avatar walks into a ban line on the ground, it prevents getting stuck 227 //When the avatar walks into a ban line on the ground, it prevents getting stuck
225 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 228 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
226 229
227
228 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines 230 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
229 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) 231 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
230 { 232 {
231 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); 233// m_log.DebugFormat(
234// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}",
235// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
236
232 forcedPosition.Remove(remoteClient.AgentId); 237 forcedPosition.Remove(remoteClient.AgentId);
233 } 238 }
234 //if we are far away, teleport 239 //if we are far away, teleport
235 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) 240 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
236 { 241 {
237 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); 242 Vector3 forcePosition = forcedPosition[remoteClient.AgentId];
238 clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); 243// m_log.DebugFormat(
244// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}",
245// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition);
246
247 m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle,
248 forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect);
249
239 forcedPosition.Remove(remoteClient.AgentId); 250 forcedPosition.Remove(remoteClient.AgentId);
240 } 251 }
241 else 252 else
242 { 253 {
254// m_log.DebugFormat(
255// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}",
256// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
257
243 //Forces them toward the forced position we want if they aren't there yet 258 //Forces them toward the forced position we want if they aren't there yet
244 agentData.UseClientAgentPosition = true; 259 agentData.UseClientAgentPosition = true;
245 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; 260 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index b315d2c..fd122da 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
132 { 132 {
133 } 133 }
134 134
135 public Type ReplaceableInterface 135 public Type ReplaceableInterface
136 { 136 {
137 get { return null; } 137 get { return null; }
138 } 138 }
@@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
220 // There is a major hack going on in this method. The viewer doesn't request 220 // There is a major hack going on in this method. The viewer doesn't request
221 // map blocks (RequestMapBlocks) above 2048. That means that if we don't hack, 221 // map blocks (RequestMapBlocks) above 2048. That means that if we don't hack,
222 // grids above that cell don't have a map at all. So, here's the hack: we wait 222 // grids above that cell don't have a map at all. So, here's the hack: we wait
223 // for this CAP request to come, and we inject the map blocks at this point. 223 // for this CAP request to come, and we inject the map blocks at this point.
224 // In a normal scenario, this request simply sends back the MapLayer (the blue color). 224 // In a normal scenario, this request simply sends back the MapLayer (the blue color).
225 // In the hacked scenario, it also sends the map blocks via UDP. 225 // In the hacked scenario, it also sends the map blocks via UDP.
226 // 226 //
@@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
351 process, 351 process,
352 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), 352 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
353 ThreadPriority.BelowNormal, 353 ThreadPriority.BelowNormal,
354 true,
354 true); 355 true);
355 } 356 }
356 357
@@ -750,7 +751,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
750 { 751 {
751 uint x = 0, y = 0; 752 uint x = 0, y = 0;
752 Utils.LongToUInts(regionhandle, out x, out y); 753 Utils.LongToUInts(regionhandle, out x, out y);
753 GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); 754 GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
754 755
755 if (mreg != null) 756 if (mreg != null)
756 { 757 {
@@ -856,7 +857,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
856 finally 857 finally
857 { 858 {
858 if (os != null) 859 if (os != null)
859 os.Close(); 860 os.Close();
860 } 861 }
861 862
862 string response_mapItems_reply = null; 863 string response_mapItems_reply = null;
@@ -959,16 +960,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
959 // on an unloaded square. 960 // on an unloaded square.
960 // But make sure: Look whether the one we requested is in there 961 // But make sure: Look whether the one we requested is in there
961 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 962 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
962 minX * (int)Constants.RegionSize, 963 minX * (int)Constants.RegionSize,
963 maxX * (int)Constants.RegionSize, 964 maxX * (int)Constants.RegionSize,
964 minY * (int)Constants.RegionSize, 965 minY * (int)Constants.RegionSize,
965 maxY * (int)Constants.RegionSize); 966 maxY * (int)Constants.RegionSize);
966 967
967 if (regions != null) 968 if (regions != null)
968 { 969 {
969 foreach (GridRegion r in regions) 970 foreach (GridRegion r in regions)
970 { 971 {
971 if ((r.RegionLocX == minX * (int)Constants.RegionSize) && 972 if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
972 (r.RegionLocY == minY * (int)Constants.RegionSize)) 973 (r.RegionLocY == minY * (int)Constants.RegionSize))
973 { 974 {
974 // found it => add it to response 975 // found it => add it to response
@@ -1003,7 +1004,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1003 { 1004 {
1004 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1005 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1005 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1006 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1006 (minX - 4) * (int)Constants.RegionSize, 1007 (minX - 4) * (int)Constants.RegionSize,
1007 (maxX + 4) * (int)Constants.RegionSize, 1008 (maxX + 4) * (int)Constants.RegionSize,
1008 (minY - 4) * (int)Constants.RegionSize, 1009 (minY - 4) * (int)Constants.RegionSize,
1009 (maxY + 4) * (int)Constants.RegionSize); 1010 (maxY + 4) * (int)Constants.RegionSize);
@@ -1335,7 +1336,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1335 // Cannot create a map for a nonexistant heightmap 1336 // Cannot create a map for a nonexistant heightmap
1336 if (m_scene.Heightmap == null) 1337 if (m_scene.Heightmap == null)
1337 return; 1338 return;
1338 1339
1339 //create a texture asset of the terrain 1340 //create a texture asset of the terrain
1340 IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>(); 1341 IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>();
1341 if (terrain == null) 1342 if (terrain == null)
@@ -1344,7 +1345,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1344 byte[] data = terrain.WriteJpeg2000Image(); 1345 byte[] data = terrain.WriteJpeg2000Image();
1345 if (data == null) 1346 if (data == null)
1346 return; 1347 return;
1347 1348
1348 byte[] overlay = GenerateOverlay(); 1349 byte[] overlay = GenerateOverlay();
1349 1350
1350 m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); 1351 m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
@@ -1365,7 +1366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1365 // Store the new one 1366 // Store the new one
1366 m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); 1367 m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
1367 m_scene.AssetService.Store(asset); 1368 m_scene.AssetService.Store(asset);
1368 1369
1369 if (overlay != null) 1370 if (overlay != null)
1370 { 1371 {
1371 parcelImageID = UUID.Random(); 1372 parcelImageID = UUID.Random();
@@ -1389,7 +1390,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1389 m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; 1390 m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
1390 m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; 1391 m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID;
1391 m_scene.RegionInfo.RegionSettings.Save(); 1392 m_scene.RegionInfo.RegionSettings.Save();
1392 1393
1393 // Delete the old one 1394 // Delete the old one
1394 // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); 1395 // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID);
1395 m_scene.AssetService.Delete(lastTerrainImageID.ToString()); 1396 m_scene.AssetService.Delete(lastTerrainImageID.ToString());
@@ -1468,18 +1469,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1468 if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) 1469 if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0)
1469 { 1470 {
1470 landForSale = true; 1471 landForSale = true;
1471 1472
1472 saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap()); 1473 saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap());
1473 } 1474 }
1474 } 1475 }
1475 1476
1476 if (!landForSale) 1477 if (!landForSale)
1477 { 1478 {
1478 m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName); 1479 m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName);
1479 return null; 1480 return null;
1480 } 1481 }
1481 1482
1482 m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName); 1483 m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName);
1483 1484
1484 for (int x = 0 ; x < 64 ; x++) 1485 for (int x = 0 ; x < 64 ; x++)
1485 { 1486 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6187803..9bca654 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1140,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes
1140 1140
1141 HeartbeatThread 1141 HeartbeatThread
1142 = Watchdog.StartThread( 1142 = Watchdog.StartThread(
1143 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); 1143 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1144 } 1144 }
1145 1145
1146 /// <summary> 1146 /// <summary>
@@ -1178,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes
1178 try 1178 try
1179 { 1179 {
1180 m_eventManager.TriggerOnRegionStarted(this); 1180 m_eventManager.TriggerOnRegionStarted(this);
1181
1182 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
1183 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1184 // alarms for scenes with many objects.
1185 Update();
1186 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1187
1181 while (!shuttingdown) 1188 while (!shuttingdown)
1182 Update(); 1189 Update();
1183 1190
@@ -1206,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes
1206 1213
1207 ++Frame; 1214 ++Frame;
1208 1215
1209// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); 1216// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1210 1217
1211 try 1218 try
1212 { 1219 {
@@ -1361,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes
1361 { 1368 {
1362 throw; 1369 throw;
1363 } 1370 }
1364 catch (AccessViolationException e)
1365 {
1366 m_log.ErrorFormat(
1367 "[REGION]: Failed on region {0} with exception {1}{2}",
1368 RegionInfo.RegionName, e.Message, e.StackTrace);
1369 }
1370 //catch (NullReferenceException e)
1371 //{
1372 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1373 //}
1374 catch (InvalidOperationException e)
1375 {
1376 m_log.ErrorFormat(
1377 "[REGION]: Failed on region {0} with exception {1}{2}",
1378 RegionInfo.RegionName, e.Message, e.StackTrace);
1379 }
1380 catch (Exception e) 1371 catch (Exception e)
1381 { 1372 {
1382 m_log.ErrorFormat( 1373 m_log.ErrorFormat(
1383 "[REGION]: Failed on region {0} with exception {1}{2}", 1374 "[SCENE]: Failed on region {0} with exception {1}{2}",
1384 RegionInfo.RegionName, e.Message, e.StackTrace); 1375 RegionInfo.RegionName, e.Message, e.StackTrace);
1385 } 1376 }
1386 1377
@@ -1418,7 +1409,6 @@ namespace OpenSim.Region.Framework.Scenes
1418 entry.checkAtTargets(); 1409 entry.checkAtTargets();
1419 } 1410 }
1420 1411
1421
1422 /// <summary> 1412 /// <summary>
1423 /// Send out simstats data to all clients 1413 /// Send out simstats data to all clients
1424 /// </summary> 1414 /// </summary>
@@ -4699,7 +4689,10 @@ namespace OpenSim.Region.Framework.Scenes
4699 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 4689 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
4700 if (nearestPoint != null) 4690 if (nearestPoint != null)
4701 { 4691 {
4702 Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); 4692// m_log.DebugFormat(
4693// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}",
4694// avatar.Name, nearestPoint, nearestParcel.LandData.Name);
4695
4703 return nearestPoint.Value; 4696 return nearestPoint.Value;
4704 } 4697 }
4705 4698
@@ -4709,12 +4702,16 @@ namespace OpenSim.Region.Framework.Scenes
4709 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 4702 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
4710 if (nearestPoint != null) 4703 if (nearestPoint != null)
4711 { 4704 {
4712 Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); 4705// m_log.DebugFormat(
4706// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint);
4707
4713 return nearestPoint.Value; 4708 return nearestPoint.Value;
4714 } 4709 }
4715 4710
4716 //Ultimate backup if we have no idea where they are 4711 //Ultimate backup if we have no idea where they are
4717 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 4712// m_log.DebugFormat(
4713// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition);
4714
4718 return avatar.lastKnownAllowedPosition; 4715 return avatar.lastKnownAllowedPosition;
4719 } 4716 }
4720 4717
@@ -5120,7 +5117,7 @@ namespace OpenSim.Region.Framework.Scenes
5120// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); 5117// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
5121 5118
5122 Vector3 agent_control_v3 = new Vector3(); 5119 Vector3 agent_control_v3 = new Vector3();
5123 presence.HandleMoveToTargetUpdate(ref agent_control_v3); 5120 presence.HandleMoveToTargetUpdate(1, ref agent_control_v3);
5124 presence.AddNewMovement(agent_control_v3); 5121 presence.AddNewMovement(agent_control_v3);
5125 } 5122 }
5126 } 5123 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 19c9745..4d98f00 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes
156 // that the region position is cached or performance will degrade 156 // that the region position is cached or performance will degrade
157 Utils.LongToUInts(regionHandle, out x, out y); 157 Utils.LongToUInts(regionHandle, out x, out y);
158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); 158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
159 bool v = true; 159// bool v = true;
160 if (! simulatorList.Contains(dest.ServerURI)) 160 if (!simulatorList.Contains(dest.ServerURI))
161 { 161 {
162 // we havent seen this simulator before, add it to the list 162 // we havent seen this simulator before, add it to the list
163 // and send it an update 163 // and send it an update
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9cfdf9f..40c8d06 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
1048 } 1048 }
1049 1049
1050 /// <summary> 1050 /// <summary>
1051 /// 1051 /// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
1052 /// </summary> 1052 /// </summary>
1053 /// <param name="pos"></param> 1053 /// <param name="pos"></param>
1054 public void Teleport(Vector3 pos) 1054 public void Teleport(Vector3 pos)
@@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes
1522 } 1522 }
1523 else if (bAllowUpdateMoveToPosition) 1523 else if (bAllowUpdateMoveToPosition)
1524 { 1524 {
1525 if (HandleMoveToTargetUpdate(ref agent_control_v3)) 1525 // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a
1526 // certain position. It's only check for tolerance on returning to that position is 0.2
1527 // rather than 1, at which point it removes its force target.
1528 if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3))
1526 update_movementflag = true; 1529 update_movementflag = true;
1527 } 1530 }
1528 } 1531 }
@@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
1584 /// </remarks> 1587 /// </remarks>
1585 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> 1588 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
1586 /// <returns>True if movement has been updated in some way. False otherwise.</returns> 1589 /// <returns>True if movement has been updated in some way. False otherwise.</returns>
1587 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) 1590 public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3)
1588 { 1591 {
1589// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); 1592// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
1590 1593
@@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes
1601// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); 1604// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
1602 1605
1603 // Check the error term of the current position in relation to the target position 1606 // Check the error term of the current position in relation to the target position
1604 if (distanceToTarget <= 1) 1607 if (distanceToTarget <= tolerance)
1605 { 1608 {
1606 // We are close enough to the target 1609 // We are close enough to the target
1607 AbsolutePosition = MoveToPositionTarget; 1610 AbsolutePosition = MoveToPositionTarget;
@@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes
1777// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); 1780// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
1778 1781
1779 Vector3 agent_control_v3 = new Vector3(); 1782 Vector3 agent_control_v3 = new Vector3();
1780 HandleMoveToTargetUpdate(ref agent_control_v3); 1783 HandleMoveToTargetUpdate(1, ref agent_control_v3);
1781 AddNewMovement(agent_control_v3); 1784 AddNewMovement(agent_control_v3);
1782 } 1785 }
1783 1786
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index c928af7..d3c96e2 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
70 m_client = client; 70 m_client = client;
71 m_scene = scene; 71 m_scene = scene;
72 72
73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); 73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
74 } 74 }
75 75
76 private void SendServerCommand(string command) 76 private void SendServerCommand(string command)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
index eb39026..a7c5020 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
57 57
58 m_listener.Start(50); 58 m_listener.Start(50);
59 59
60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); 60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
61 m_baseScene = baseScene; 61 m_baseScene = baseScene;
62 } 62 }
63 63
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 75364b7..97890ee 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:");
1474 /// </summary> 1474 /// </summary>
1475 private void changeadd() 1475 private void changeadd()
1476 { 1476 {
1477// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
1478
1477 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 1479 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
1478 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); 1480 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
1479 1481
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index ee32755..14edde4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
137 if (cmdHandlerThread == null) 137 if (cmdHandlerThread == null)
138 { 138 {
139 // Start the thread that will be doing the work 139 // Start the thread that will be doing the work
140 cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); 140 cmdHandlerThread
141 = Watchdog.StartThread(
142 CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
141 } 143 }
142 } 144 }
143 145
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 61a6907..c5392b5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6376 } 6376 }
6377 } 6377 }
6378 6378
6379 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) 6379 protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
6380 { 6380 {
6381 m_host.AddScriptLPS(1);
6382 // LSL quaternions can normalize to 0, normal Quaternions can't. 6381 // LSL quaternions can normalize to 0, normal Quaternions can't.
6383 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) 6382 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
6384 rot.z = 1; // ZERO_ROTATION = 0,0,0,1 6383 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
6385 6384
6386 m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); 6385 part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
6387 m_host.SitTargetOrientation = Rot2Quaternion(rot); 6386 part.SitTargetOrientation = Rot2Quaternion(rot);
6388 m_host.ParentGroup.HasGroupChanged = true; 6387 part.ParentGroup.HasGroupChanged = true;
6388 }
6389
6390 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
6391 {
6392 m_host.AddScriptLPS(1);
6393 SitTarget(m_host, offset, rot);
6394 }
6395
6396 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
6397 {
6398 m_host.AddScriptLPS(1);
6399 if (link == ScriptBaseClass.LINK_ROOT)
6400 SitTarget(m_host.ParentGroup.RootPart, offset, rot);
6401 else if (link == ScriptBaseClass.LINK_THIS)
6402 SitTarget(m_host, offset, rot);
6403 else
6404 {
6405 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
6406 if (null != part)
6407 {
6408 SitTarget(part, offset, rot);
6409 }
6410 }
6389 } 6411 }
6390 6412
6391 public LSL_String llAvatarOnSitTarget() 6413 public LSL_String llAvatarOnSitTarget()
@@ -7047,10 +7069,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7047 shapeBlock.PathScaleX = 100; 7069 shapeBlock.PathScaleX = 100;
7048 shapeBlock.PathScaleY = 150; 7070 shapeBlock.PathScaleY = 150;
7049 7071
7050 if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && 7072 int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
7051 type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE && 7073
7052 type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && 7074 if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
7053 type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) 7075 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
7076 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
7077 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
7054 { 7078 {
7055 // default 7079 // default
7056 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 7080 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
@@ -8151,23 +8175,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8151 { 8175 {
8152 m_host.AddScriptLPS(1); 8176 m_host.AddScriptLPS(1);
8153 ScriptSleep(1000); 8177 ScriptSleep(1000);
8178 return GetPrimMediaParams(m_host, face, rules);
8179 }
8154 8180
8181 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8182 {
8183 m_host.AddScriptLPS(1);
8184 ScriptSleep(1000);
8185 if (link == ScriptBaseClass.LINK_ROOT)
8186 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8187 else if (link == ScriptBaseClass.LINK_THIS)
8188 return GetPrimMediaParams(m_host, face, rules);
8189 else
8190 {
8191 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8192 if (null != part)
8193 return GetPrimMediaParams(part, face, rules);
8194 }
8195
8196 return new LSL_List();
8197 }
8198
8199 private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
8200 {
8155 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid 8201 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
8156 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). 8202 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
8157 // Assuming silently fail means give back an empty list. Ideally, need to check this. 8203 // Assuming silently fail means give back an empty list. Ideally, need to check this.
8158 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8204 if (face < 0 || face > part.GetNumberOfSides() - 1)
8159 return new LSL_List(); 8205 return new LSL_List();
8160 8206
8161 return GetPrimMediaParams(face, rules);
8162 }
8163
8164 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
8165 {
8166 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8207 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8167 if (null == module) 8208 if (null == module)
8168 throw new Exception("Media on a prim functions not available"); 8209 return new LSL_List();
8169 8210
8170 MediaEntry me = module.GetMediaEntry(m_host, face); 8211 MediaEntry me = module.GetMediaEntry(part, face);
8171 8212
8172 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 8213 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
8173 if (null == me) 8214 if (null == me)
@@ -8249,33 +8290,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8249 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8290 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8250 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8291 res.Add(new LSL_Integer((int)me.ControlPermissions));
8251 break; 8292 break;
8293
8294 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8252 } 8295 }
8253 } 8296 }
8254 8297
8255 return res; 8298 return res;
8256 } 8299 }
8257 8300
8258 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 8301 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
8259 { 8302 {
8260 m_host.AddScriptLPS(1); 8303 m_host.AddScriptLPS(1);
8261 ScriptSleep(1000); 8304 ScriptSleep(1000);
8305 return SetPrimMediaParams(m_host, face, rules);
8306 }
8262 8307
8263 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid 8308 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8264 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8309 {
8265 // Don't perform the media check directly 8310 m_host.AddScriptLPS(1);
8266 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8311 ScriptSleep(1000);
8267 return ScriptBaseClass.LSL_STATUS_OK; 8312 if (link == ScriptBaseClass.LINK_ROOT)
8313 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8314 else if (link == ScriptBaseClass.LINK_THIS)
8315 return SetPrimMediaParams(m_host, face, rules);
8316 else
8317 {
8318 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8319 if (null != part)
8320 return SetPrimMediaParams(part, face, rules);
8321 }
8268 8322
8269 return SetPrimMediaParams(face, rules); 8323 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8270 } 8324 }
8271 8325
8272 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 8326 private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
8273 { 8327 {
8328 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
8329 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8330 // Don't perform the media check directly
8331 if (face < 0 || face > part.GetNumberOfSides() - 1)
8332 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8333
8274 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8334 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8275 if (null == module) 8335 if (null == module)
8276 throw new Exception("Media on a prim functions not available"); 8336 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8277 8337
8278 MediaEntry me = module.GetMediaEntry(m_host, face); 8338 MediaEntry me = module.GetMediaEntry(part, face);
8279 if (null == me) 8339 if (null == me)
8280 me = new MediaEntry(); 8340 me = new MediaEntry();
8281 8341
@@ -8354,10 +8414,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8354 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8414 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8355 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8415 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8356 break; 8416 break;
8417
8418 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8357 } 8419 }
8358 } 8420 }
8359 8421
8360 module.SetMediaEntry(m_host, face, me); 8422 module.SetMediaEntry(part, face, me);
8361 8423
8362 return ScriptBaseClass.LSL_STATUS_OK; 8424 return ScriptBaseClass.LSL_STATUS_OK;
8363 } 8425 }
@@ -8366,18 +8428,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8366 { 8428 {
8367 m_host.AddScriptLPS(1); 8429 m_host.AddScriptLPS(1);
8368 ScriptSleep(1000); 8430 ScriptSleep(1000);
8431 return ClearPrimMedia(m_host, face);
8432 }
8369 8433
8434 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
8435 {
8436 m_host.AddScriptLPS(1);
8437 ScriptSleep(1000);
8438 if (link == ScriptBaseClass.LINK_ROOT)
8439 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
8440 else if (link == ScriptBaseClass.LINK_THIS)
8441 return ClearPrimMedia(m_host, face);
8442 else
8443 {
8444 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8445 if (null != part)
8446 return ClearPrimMedia(part, face);
8447 }
8448
8449 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8450 }
8451
8452 private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
8453 {
8370 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid 8454 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
8371 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8455 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8372 // FIXME: Don't perform the media check directly 8456 // FIXME: Don't perform the media check directly
8373 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8457 if (face < 0 || face > part.GetNumberOfSides() - 1)
8374 return ScriptBaseClass.LSL_STATUS_OK; 8458 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8375 8459
8376 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8460 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8377 if (null == module) 8461 if (null == module)
8378 throw new Exception("Media on a prim functions not available"); 8462 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8379 8463
8380 module.ClearMediaEntry(m_host, face); 8464 module.ClearMediaEntry(part, face);
8381 8465
8382 return ScriptBaseClass.LSL_STATUS_OK; 8466 return ScriptBaseClass.LSL_STATUS_OK;
8383 } 8467 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c55e2ae..ff1f5fd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2740 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 2740 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
2741 m_host.AddScriptLPS(1); 2741 m_host.AddScriptLPS(1);
2742 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 2742 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
2743 avatar.SpeedModifier = (float)SpeedModifier; 2743
2744 if (avatar != null)
2745 avatar.SpeedModifier = (float)SpeedModifier;
2744 } 2746 }
2745 2747
2746 public void osKickAvatar(string FirstName,string SurName,string alert) 2748 public void osKickAvatar(string FirstName,string SurName,string alert)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 6106a65..0f53bc3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
64 LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); 64 LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
65 LSL_Integer llCeil(double f); 65 LSL_Integer llCeil(double f);
66 void llClearCameraParams(); 66 void llClearCameraParams();
67 LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face);
67 LSL_Integer llClearPrimMedia(LSL_Integer face); 68 LSL_Integer llClearPrimMedia(LSL_Integer face);
68 void llCloseRemoteDataChannel(string channel); 69 void llCloseRemoteDataChannel(string channel);
69 LSL_Float llCloud(LSL_Vector offset); 70 LSL_Float llCloud(LSL_Vector offset);
@@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
139 LSL_String llGetLinkName(int linknum); 140 LSL_String llGetLinkName(int linknum);
140 LSL_Integer llGetLinkNumber(); 141 LSL_Integer llGetLinkNumber();
141 LSL_Integer llGetLinkNumberOfSides(int link); 142 LSL_Integer llGetLinkNumberOfSides(int link);
142 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); 143 LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
144 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
143 LSL_Integer llGetListEntryType(LSL_List src, int index); 145 LSL_Integer llGetListEntryType(LSL_List src, int index);
144 LSL_Integer llGetListLength(LSL_List src); 146 LSL_Integer llGetListLength(LSL_List src);
145 LSL_Vector llGetLocalPos(); 147 LSL_Vector llGetLocalPos();
@@ -218,6 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
218 LSL_String llGetDisplayName(string id); 220 LSL_String llGetDisplayName(string id);
219 LSL_String llRequestDisplayName(string id); 221 LSL_String llRequestDisplayName(string id);
220 void llLinkParticleSystem(int linknum, LSL_List rules); 222 void llLinkParticleSystem(int linknum, LSL_List rules);
223 void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
221 LSL_String llList2CSV(LSL_List src); 224 LSL_String llList2CSV(LSL_List src);
222 LSL_Float llList2Float(LSL_List src, int index); 225 LSL_Float llList2Float(LSL_List src, int index);
223 LSL_Integer llList2Integer(LSL_List src, int index); 226 LSL_Integer llList2Integer(LSL_List src, int index);
@@ -334,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
334 void llSetInventoryPermMask(string item, int mask, int value); 337 void llSetInventoryPermMask(string item, int mask, int value);
335 void llSetLinkAlpha(int linknumber, double alpha, int face); 338 void llSetLinkAlpha(int linknumber, double alpha, int face);
336 void llSetLinkColor(int linknumber, LSL_Vector color, int face); 339 void llSetLinkColor(int linknumber, LSL_Vector color, int face);
340 LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
337 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); 341 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
338 void llSetLinkTexture(int linknumber, string texture, int face); 342 void llSetLinkTexture(int linknumber, string texture, int face);
339 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); 343 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
@@ -344,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
344 void llSetParcelMusicURL(string url); 348 void llSetParcelMusicURL(string url);
345 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 349 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
346 void llSetPos(LSL_Vector pos); 350 void llSetPos(LSL_Vector pos);
347 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); 351 LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
348 void llSetPrimitiveParams(LSL_List rules); 352 void llSetPrimitiveParams(LSL_List rules);
349 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); 353 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
350 void llSetPrimURL(string url); 354 void llSetPrimURL(string url);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index bb498b5..5a53e15 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -378,6 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
378 public const int PRIM_SCULPT_TYPE_TORUS = 2; 378 public const int PRIM_SCULPT_TYPE_TORUS = 2;
379 public const int PRIM_SCULPT_TYPE_PLANE = 3; 379 public const int PRIM_SCULPT_TYPE_PLANE = 3;
380 public const int PRIM_SCULPT_TYPE_CYLINDER = 4; 380 public const int PRIM_SCULPT_TYPE_CYLINDER = 4;
381 public const int PRIM_SCULPT_FLAG_INVERT = 64;
382 public const int PRIM_SCULPT_FLAG_MIRROR = 128;
381 383
382 public const int MASK_BASE = 0; 384 public const int MASK_BASE = 0;
383 public const int MASK_OWNER = 1; 385 public const int MASK_OWNER = 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 83550a5..f8e3c36 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1688 m_LSL_Functions.llSitTarget(offset, rot); 1688 m_LSL_Functions.llSitTarget(offset, rot);
1689 } 1689 }
1690 1690
1691 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
1692 {
1693 m_LSL_Functions.llLinkSitTarget(link, offset, rot);
1694 }
1695
1691 public void llSleep(double sec) 1696 public void llSleep(double sec)
1692 { 1697 {
1693 m_LSL_Functions.llSleep(sec); 1698 m_LSL_Functions.llSleep(sec);
@@ -1882,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1882 { 1887 {
1883 return m_LSL_Functions.llGetPrimMediaParams(face, rules); 1888 return m_LSL_Functions.llGetPrimMediaParams(face, rules);
1884 } 1889 }
1885 1890
1891 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
1892 {
1893 return m_LSL_Functions.llGetLinkMedia(link, face, rules);
1894 }
1895
1886 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 1896 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
1887 { 1897 {
1888 return m_LSL_Functions.llSetPrimMediaParams(face, rules); 1898 return m_LSL_Functions.llSetPrimMediaParams(face, rules);
1889 } 1899 }
1890 1900
1901 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
1902 {
1903 return m_LSL_Functions.llSetLinkMedia(link, face, rules);
1904 }
1905
1891 public LSL_Integer llClearPrimMedia(LSL_Integer face) 1906 public LSL_Integer llClearPrimMedia(LSL_Integer face)
1892 { 1907 {
1893 return m_LSL_Functions.llClearPrimMedia(face); 1908 return m_LSL_Functions.llClearPrimMedia(face);
1894 } 1909 }
1895 1910
1911 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
1912 {
1913 return m_LSL_Functions.llClearLinkMedia(link, face);
1914 }
1915
1896 public void print(string str) 1916 public void print(string str)
1897 { 1917 {
1898 m_LSL_Functions.print(str); 1918 m_LSL_Functions.print(str);
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index f627e37..b9ba4bc 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics
83 { 83 {
84 if (m_scenes.Count == 0) 84 if (m_scenes.Count == 0)
85 { 85 {
86 if (Util.IsWindows())
87 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
88
86 //IConfig startupConfig = config.Configs["Startup"]; 89 //IConfig startupConfig = config.Configs["Startup"];
87 90
88 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); 91 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
@@ -221,13 +224,11 @@ namespace OpenSim.Region.UserStatistics
221 concurrencyCounter--; 224 concurrencyCounter--;
222 225
223 response_code = 200; 226 response_code = 200;
224
225 } 227 }
226 else 228 else
227 { 229 {
228 strOut = MainServer.Instance.GetHTTP404(""); 230 strOut = MainServer.Instance.GetHTTP404("");
229 } 231 }
230
231 232
232 responsedata["int_response_code"] = response_code; 233 responsedata["int_response_code"] = response_code;
233 responsedata["content_type"] = contenttype; 234 responsedata["content_type"] = contenttype;
@@ -244,43 +245,44 @@ namespace OpenSim.Region.UserStatistics
244 // TODO: FIXME: implement stats migrations 245 // TODO: FIXME: implement stats migrations
245 const string SQL = @"SELECT * FROM migrations LIMIT 1"; 246 const string SQL = @"SELECT * FROM migrations LIMIT 1";
246 247
247 SqliteCommand cmd = new SqliteCommand(SQL, db); 248 using (SqliteCommand cmd = new SqliteCommand(SQL, db))
248
249 try
250 {
251 cmd.ExecuteNonQuery();
252 }
253 catch (SqliteSyntaxException)
254 { 249 {
255 CreateTables(db); 250 try
251 {
252 cmd.ExecuteNonQuery();
253 }
254 catch (SqliteSyntaxException)
255 {
256 CreateTables(db);
257 }
256 } 258 }
257 } 259 }
258 } 260 }
259 261
260 public void CreateTables(SqliteConnection db) 262 public void CreateTables(SqliteConnection db)
261 { 263 {
262 SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db); 264 using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db))
263 createcmd.ExecuteNonQuery(); 265 {
266 createcmd.ExecuteNonQuery();
264 267
265 createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; 268 createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
266 createcmd.ExecuteNonQuery(); 269 createcmd.ExecuteNonQuery();
270 }
267 } 271 }
268 272
269 public virtual void PostInitialise() 273 public virtual void PostInitialise()
270 { 274 {
271 if (!enabled) 275 if (!enabled)
272 {
273 return; 276 return;
274 } 277
275 AddHandlers(); 278 AddHandlers();
276 } 279 }
277 280
278 public virtual void Close() 281 public virtual void Close()
279 { 282 {
280 if (!enabled) 283 if (!enabled)
281 {
282 return; 284 return;
283 } 285
284 dbConn.Close(); 286 dbConn.Close();
285 dbConn.Dispose(); 287 dbConn.Dispose();
286 m_sessions.Clear(); 288 m_sessions.Clear();
@@ -301,7 +303,8 @@ namespace OpenSim.Region.UserStatistics
301 303
302 public void OnRegisterCaps(UUID agentID, Caps caps) 304 public void OnRegisterCaps(UUID agentID, Caps caps)
303 { 305 {
304 m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 306// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
307
305 string capsPath = "/CAPS/VS/" + UUID.Random(); 308 string capsPath = "/CAPS/VS/" + UUID.Random();
306 caps.RegisterHandler("ViewerStats", 309 caps.RegisterHandler("ViewerStats",
307 new RestStreamHandler("POST", capsPath, 310 new RestStreamHandler("POST", capsPath,
@@ -315,7 +318,6 @@ namespace OpenSim.Region.UserStatistics
315 318
316 public void OnDeRegisterCaps(UUID agentID, Caps caps) 319 public void OnDeRegisterCaps(UUID agentID, Caps caps)
317 { 320 {
318
319 } 321 }
320 322
321 protected virtual void AddHandlers() 323 protected virtual void AddHandlers()
@@ -365,7 +367,6 @@ namespace OpenSim.Region.UserStatistics
365 367
366 public void OnMakeChildAgent(ScenePresence agent) 368 public void OnMakeChildAgent(ScenePresence agent)
367 { 369 {
368
369 } 370 }
370 371
371 public void OnClientClosed(UUID agentID, Scene scene) 372 public void OnClientClosed(UUID agentID, Scene scene)
@@ -427,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
427 return scene.RegionInfo.RegionID; 428 return scene.RegionInfo.RegionID;
428 } 429 }
429 } 430 }
431
430 return UUID.Zero; 432 return UUID.Zero;
431 } 433 }
432 434
@@ -455,14 +457,14 @@ namespace OpenSim.Region.UserStatistics
455 UserSessionData usd; 457 UserSessionData usd;
456 OSD message = OSDParser.DeserializeLLSDXml(request); 458 OSD message = OSDParser.DeserializeLLSDXml(request);
457 OSDMap mmap; 459 OSDMap mmap;
460
458 lock (m_sessions) 461 lock (m_sessions)
459 { 462 {
460 if (agentID != UUID.Zero) 463 if (agentID != UUID.Zero)
461 { 464 {
462
463 if (!m_sessions.ContainsKey(agentID)) 465 if (!m_sessions.ContainsKey(agentID))
464 { 466 {
465 m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure"); 467 m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
466 return new UserSessionID(); 468 return new UserSessionID();
467 } 469 }
468 uid = m_sessions[agentID]; 470 uid = m_sessions[agentID];
@@ -582,8 +584,6 @@ namespace OpenSim.Region.UserStatistics
582 usd.n_out_kb = (float)net_out["kbytes"].AsReal(); 584 usd.n_out_kb = (float)net_out["kbytes"].AsReal();
583 usd.n_out_pk = net_out["packets"].AsInteger(); 585 usd.n_out_pk = net_out["packets"].AsInteger();
584 } 586 }
585
586
587 } 587 }
588 } 588 }
589 589
@@ -599,83 +599,85 @@ namespace OpenSim.Region.UserStatistics
599 599
600 lock (db) 600 lock (db)
601 { 601 {
602 SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db); 602 using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db))
603 updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
604 updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
605 updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
606 updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
607 updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
608 updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
609 updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
610 updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
611 updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
612 (int) uid.session_data.min_agents_in_view));
613 updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
614 (int) uid.session_data.max_agents_in_view));
615 updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
616 (int) uid.session_data.mode_agents_in_view));
617 updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
618 updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
619 updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
620 updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
621 updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
622 updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
623 updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
624 updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
625 updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
626 updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
627 updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
628 updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
629 updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
630 updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
631 updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
632 updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
633 updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
634 updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
635 updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
636 updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
637 updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
638 updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
639 updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
640 updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
641 updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
642 updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
643 updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
644 updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
645 updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
646 updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
647 updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
648 updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
649 updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
650
651 updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
652 updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
653 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
654
655 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
656 updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
657 updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
658// m_log.Debug("UPDATE");
659
660 int result = updatecmd.ExecuteNonQuery();
661
662 if (result == 0)
663 { 603 {
664// m_log.Debug("INSERT"); 604 updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
665 updatecmd.CommandText = SQL_STATS_TABLE_INSERT; 605 updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
666 try 606 updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
667 { 607 updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
668 updatecmd.ExecuteNonQuery(); 608 updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
669 } 609 updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
670 catch (SqliteExecutionException) 610 updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
611 updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
612 updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
613 (int) uid.session_data.min_agents_in_view));
614 updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
615 (int) uid.session_data.max_agents_in_view));
616 updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
617 (int) uid.session_data.mode_agents_in_view));
618 updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
619 updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
620 updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
621 updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
622 updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
623 updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
624 updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
625 updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
626 updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
627 updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
628 updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
629 updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
630 updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
631 updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
632 updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
633 updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
634 updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
635 updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
636 updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
637 updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
638 updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
639 updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
640 updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
641 updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
642 updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
643 updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
644 updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
645 updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
646 updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
647 updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
648 updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
649 updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
650 updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
651
652 updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
653 updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
654 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
655
656 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
657 updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
658 updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
659
660// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
661
662 int result = updatecmd.ExecuteNonQuery();
663
664 if (result == 0)
671 { 665 {
672 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception"); 666// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id);
673 } 667
674 catch (SqliteSyntaxException) 668 updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
675 {
676 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
677 }
678 669
670 try
671 {
672 updatecmd.ExecuteNonQuery();
673 }
674 catch (Exception e)
675 {
676 m_log.WarnFormat(
677 "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
678 uid.session_data.agent_id, e.Message, e.StackTrace);
679 }
680 }
679 } 681 }
680 } 682 }
681 } 683 }