diff options
author | John Hurliman | 2009-10-20 15:19:19 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-20 15:19:19 -0700 |
commit | 1833c6956892f1c8324ecbe0179103bff2079151 (patch) | |
tree | d7a8ee9c60676cffbf296d963f3d0403151d93e7 /OpenSim/Region | |
parent | * Removed the throttle speed optimizations to see if it brings stability back (diff) | |
download | opensim-SC-1833c6956892f1c8324ecbe0179103bff2079151.zip opensim-SC-1833c6956892f1c8324ecbe0179103bff2079151.tar.gz opensim-SC-1833c6956892f1c8324ecbe0179103bff2079151.tar.bz2 opensim-SC-1833c6956892f1c8324ecbe0179103bff2079151.tar.xz |
* Removed the unused m_agentUpdates collection and some extra work that was being done for AgentUpdate packets
* Start LLUDPClients unpaused (this variable is not being used yet)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 126 |
2 files changed, 34 insertions, 94 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index ec74188..bf0fda3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -98,7 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
98 | /// <summary>True when this connection is alive, otherwise false</summary> | 98 | /// <summary>True when this connection is alive, otherwise false</summary> |
99 | public bool IsConnected = true; | 99 | public bool IsConnected = true; |
100 | /// <summary>True when this connection is paused, otherwise false</summary> | 100 | /// <summary>True when this connection is paused, otherwise false</summary> |
101 | public bool IsPaused = true; | 101 | public bool IsPaused; |
102 | /// <summary>Environment.TickCount when the last packet was received for this client</summary> | 102 | /// <summary>Environment.TickCount when the last packet was received for this client</summary> |
103 | public int TickLastPacketReceived; | 103 | public int TickLastPacketReceived; |
104 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed for this client</summary> | 104 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed for this client</summary> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bdd80c6..d7113bf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -128,8 +128,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | 128 | ||
129 | private bool m_setAlwaysRun; | 129 | private bool m_setAlwaysRun; |
130 | 130 | ||
131 | private bool m_updatesAllowed = true; | ||
132 | private List<AgentUpdateArgs> m_agentUpdates = new List<AgentUpdateArgs>(); | ||
133 | private string m_movementAnimation = "DEFAULT"; | 131 | private string m_movementAnimation = "DEFAULT"; |
134 | private long m_animPersistUntil = 0; | 132 | private long m_animPersistUntil = 0; |
135 | private bool m_allowFalling = false; | 133 | private bool m_allowFalling = false; |
@@ -1090,34 +1088,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1090 | 1088 | ||
1091 | } | 1089 | } |
1092 | 1090 | ||
1093 | // These methods allow to queue up agent updates (like key presses) | ||
1094 | // until all attachment scripts are running and the animations from | ||
1095 | // AgentDataUpdate have been started. It is essential for combat | ||
1096 | // devices, weapons and AOs that keypresses are not processed | ||
1097 | // until scripts that are potentially interested in them are | ||
1098 | // up and running and that animations a script knows to be running | ||
1099 | // from before a crossing are running again | ||
1100 | // | ||
1101 | public void LockAgentUpdates() | ||
1102 | { | ||
1103 | m_updatesAllowed = false; | ||
1104 | } | ||
1105 | |||
1106 | public void UnlockAgentUpdates() | ||
1107 | { | ||
1108 | lock (m_agentUpdates) | ||
1109 | { | ||
1110 | if (m_updatesAllowed == false) | ||
1111 | { | ||
1112 | foreach (AgentUpdateArgs a in m_agentUpdates) | ||
1113 | RealHandleAgentUpdate(ControllingClient, a); | ||
1114 | m_agentUpdates.Clear(); | ||
1115 | m_updatesAllowed = true; | ||
1116 | } | ||
1117 | } | ||
1118 | } | ||
1119 | |||
1120 | |||
1121 | /// <summary> | 1091 | /// <summary> |
1122 | /// Callback for the Camera view block check. Gets called with the results of the camera view block test | 1092 | /// Callback for the Camera view block check. Gets called with the results of the camera view block test |
1123 | /// hitYN is true when there's something in the way. | 1093 | /// hitYN is true when there's something in the way. |
@@ -1155,49 +1125,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1155 | } | 1125 | } |
1156 | } | 1126 | } |
1157 | 1127 | ||
1128 | Array m_dirControlFlags = Enum.GetValues(typeof(Dir_ControlFlags)); | ||
1129 | |||
1158 | /// <summary> | 1130 | /// <summary> |
1159 | /// This is the event handler for client movement. If a client is moving, this event is triggering. | 1131 | /// This is the event handler for client movement. If a client is moving, this event is triggering. |
1160 | /// </summary> | 1132 | /// </summary> |
1161 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 1133 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
1162 | { | 1134 | { |
1163 | const int AGENT_UPDATE_TIMEOUT_MS = 1000 * 3; | ||
1164 | |||
1165 | if (System.Threading.Monitor.TryEnter(m_agentUpdates, AGENT_UPDATE_TIMEOUT_MS)) | ||
1166 | { | ||
1167 | try | ||
1168 | { | ||
1169 | if (m_updatesAllowed) | ||
1170 | { | ||
1171 | RealHandleAgentUpdate(remoteClient, agentData); | ||
1172 | return; | ||
1173 | } | ||
1174 | |||
1175 | m_agentUpdates.Add(agentData); | ||
1176 | } | ||
1177 | finally { System.Threading.Monitor.Exit(m_agentUpdates); } | ||
1178 | } | ||
1179 | } | ||
1180 | |||
1181 | private void RealHandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | ||
1182 | { | ||
1183 | //if (m_isChildAgent) | 1135 | //if (m_isChildAgent) |
1184 | //{ | 1136 | //{ |
1185 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1137 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1186 | // return; | 1138 | // return; |
1187 | //} | 1139 | //} |
1188 | 1140 | ||
1189 | 1141 | m_perfMonMS = Environment.TickCount; | |
1190 | m_movementUpdateCount++; | ||
1191 | if (m_movementUpdateCount >= int.MaxValue) | ||
1192 | m_movementUpdateCount = 1; | ||
1193 | 1142 | ||
1143 | ++m_movementUpdateCount; | ||
1144 | if (m_movementUpdateCount < 1) | ||
1145 | m_movementUpdateCount = 1; | ||
1194 | 1146 | ||
1195 | // Must check for standing up even when PhysicsActor is null, | 1147 | // Must check for standing up even when PhysicsActor is null, |
1196 | // since sitting currently removes avatar from physical scene | 1148 | // since sitting currently removes avatar from physical scene |
1197 | //m_log.Debug("agentPos:" + AbsolutePosition.ToString()); | 1149 | //m_log.Debug("agentPos:" + AbsolutePosition.ToString()); |
1198 | 1150 | ||
1199 | // This is irritating. Really. | 1151 | // This is irritating. Really. |
1200 | |||
1201 | if (!AbsolutePosition.IsFinite()) | 1152 | if (!AbsolutePosition.IsFinite()) |
1202 | { | 1153 | { |
1203 | RemoveFromPhysicalScene(); | 1154 | RemoveFromPhysicalScene(); |
@@ -1218,19 +1169,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1218 | { | 1169 | { |
1219 | m_LastFinitePos = m_pos; | 1170 | m_LastFinitePos = m_pos; |
1220 | } | 1171 | } |
1221 | //m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true); | ||
1222 | 1172 | ||
1173 | //m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true); | ||
1223 | 1174 | ||
1224 | //ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 1175 | //ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
1225 | //if (land != null) | 1176 | //if (land != null) |
1226 | //{ | 1177 | //{ |
1227 | //if (land.landData.landingType == (byte)1 && land.landData.userLocation != Vector3.Zero) | 1178 | //if (land.landData.landingType == (byte)1 && land.landData.userLocation != Vector3.Zero) |
1228 | //{ | 1179 | //{ |
1229 | // agent.startpos = land.landData.userLocation; | 1180 | // agent.startpos = land.landData.userLocation; |
1230 | //} | 1181 | //} |
1231 | //} | 1182 | //} |
1232 | |||
1233 | m_perfMonMS = Environment.TickCount; | ||
1234 | 1183 | ||
1235 | uint flags = agentData.ControlFlags; | 1184 | uint flags = agentData.ControlFlags; |
1236 | Quaternion bodyRotation = agentData.BodyRotation; | 1185 | Quaternion bodyRotation = agentData.BodyRotation; |
@@ -1253,7 +1202,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1253 | // The Agent's Draw distance setting | 1202 | // The Agent's Draw distance setting |
1254 | m_DrawDistance = agentData.Far; | 1203 | m_DrawDistance = agentData.Far; |
1255 | 1204 | ||
1256 | if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 1205 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
1257 | { | 1206 | { |
1258 | StandUp(); | 1207 | StandUp(); |
1259 | } | 1208 | } |
@@ -1261,14 +1210,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1261 | // Check if Client has camera in 'follow cam' or 'build' mode. | 1210 | // Check if Client has camera in 'follow cam' or 'build' mode. |
1262 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); | 1211 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); |
1263 | 1212 | ||
1264 | m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) | 1213 | m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) |
1265 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; | 1214 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; |
1266 | 1215 | ||
1267 | //m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto); | 1216 | //m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto); |
1268 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | 1217 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view |
1269 | if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) | 1218 | if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) |
1270 | { | 1219 | { |
1271 | |||
1272 | if (m_followCamAuto) | 1220 | if (m_followCamAuto) |
1273 | { | 1221 | { |
1274 | Vector3 headadjustment = new Vector3(0, 0, 0.3f); | 1222 | Vector3 headadjustment = new Vector3(0, 0, 0.3f); |
@@ -1276,24 +1224,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1276 | } | 1224 | } |
1277 | } | 1225 | } |
1278 | 1226 | ||
1279 | m_mouseLook = (flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; | 1227 | m_mouseLook = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; |
1280 | |||
1281 | |||
1282 | |||
1283 | m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; | 1228 | m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; |
1284 | 1229 | ||
1285 | |||
1286 | |||
1287 | lock (scriptedcontrols) | 1230 | lock (scriptedcontrols) |
1288 | { | 1231 | { |
1289 | if (scriptedcontrols.Count > 0) | 1232 | if (scriptedcontrols.Count > 0) |
1290 | { | 1233 | { |
1291 | SendControlToScripts(flags); | 1234 | SendControlToScripts(flags); |
1292 | flags = RemoveIgnoredControls(flags, IgnoredControls); | 1235 | flags = RemoveIgnoredControls(flags, IgnoredControls); |
1293 | |||
1294 | } | 1236 | } |
1295 | } | 1237 | } |
1296 | 1238 | ||
1297 | if (PhysicsActor == null) | 1239 | if (PhysicsActor == null) |
1298 | { | 1240 | { |
1299 | return; | 1241 | return; |
@@ -1302,7 +1244,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1302 | if (m_autopilotMoving) | 1244 | if (m_autopilotMoving) |
1303 | CheckAtSitTarget(); | 1245 | CheckAtSitTarget(); |
1304 | 1246 | ||
1305 | if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) | 1247 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) |
1306 | { | 1248 | { |
1307 | // TODO: This doesn't prevent the user from walking yet. | 1249 | // TODO: This doesn't prevent the user from walking yet. |
1308 | // Setting parent ID would fix this, if we knew what value | 1250 | // Setting parent ID would fix this, if we knew what value |
@@ -1335,13 +1277,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1335 | PhysicsActor.Flying = false; | 1277 | PhysicsActor.Flying = false; |
1336 | else | 1278 | else |
1337 | PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1279 | PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1338 | 1280 | ||
1339 | if (PhysicsActor.Flying != oldflying) | 1281 | if (PhysicsActor.Flying != oldflying) |
1340 | { | 1282 | { |
1341 | update_movementflag = true; | 1283 | update_movementflag = true; |
1342 | } | 1284 | } |
1343 | } | 1285 | } |
1344 | 1286 | ||
1345 | if (q != m_bodyRot) | 1287 | if (q != m_bodyRot) |
1346 | { | 1288 | { |
1347 | m_bodyRot = q; | 1289 | m_bodyRot = q; |
@@ -1357,15 +1299,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1357 | 1299 | ||
1358 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying | 1300 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying |
1359 | // this prevents 'jumping' in inappropriate situations. | 1301 | // this prevents 'jumping' in inappropriate situations. |
1360 | if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying)) | 1302 | if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying)) |
1361 | dirVectors = GetWalkDirectionVectors(); | 1303 | dirVectors = GetWalkDirectionVectors(); |
1362 | else | 1304 | else |
1363 | dirVectors = Dir_Vectors; | 1305 | dirVectors = Dir_Vectors; |
1364 | 1306 | ||
1365 | 1307 | ||
1366 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) | 1308 | foreach (Dir_ControlFlags DCF in m_dirControlFlags) |
1367 | { | 1309 | { |
1368 | if ((flags & (uint) DCF) != 0) | 1310 | if ((flags & (uint)DCF) != 0) |
1369 | { | 1311 | { |
1370 | bResetMoveToPosition = true; | 1312 | bResetMoveToPosition = true; |
1371 | DCFlagKeyPressed = true; | 1313 | DCFlagKeyPressed = true; |
@@ -1377,18 +1319,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1377 | { | 1319 | { |
1378 | // Why did I get this? | 1320 | // Why did I get this? |
1379 | } | 1321 | } |
1380 | 1322 | ||
1381 | if ((m_movementflag & (uint) DCF) == 0) | 1323 | if ((m_movementflag & (uint)DCF) == 0) |
1382 | { | 1324 | { |
1383 | m_movementflag += (byte) (uint) DCF; | 1325 | m_movementflag += (byte)(uint)DCF; |
1384 | update_movementflag = true; | 1326 | update_movementflag = true; |
1385 | } | 1327 | } |
1386 | } | 1328 | } |
1387 | else | 1329 | else |
1388 | { | 1330 | { |
1389 | if ((m_movementflag & (uint) DCF) != 0) | 1331 | if ((m_movementflag & (uint)DCF) != 0) |
1390 | { | 1332 | { |
1391 | m_movementflag -= (byte) (uint) DCF; | 1333 | m_movementflag -= (byte)(uint)DCF; |
1392 | update_movementflag = true; | 1334 | update_movementflag = true; |
1393 | } | 1335 | } |
1394 | else | 1336 | else |
@@ -1479,14 +1421,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1479 | } | 1421 | } |
1480 | catch (Exception) | 1422 | catch (Exception) |
1481 | { | 1423 | { |
1482 | |||
1483 | //Avoid system crash, can be slower but... | 1424 | //Avoid system crash, can be slower but... |
1484 | } | 1425 | } |
1485 | |||
1486 | } | 1426 | } |
1487 | } | 1427 | } |
1488 | } | 1428 | } |
1489 | 1429 | ||
1490 | // Cause the avatar to stop flying if it's colliding | 1430 | // Cause the avatar to stop flying if it's colliding |
1491 | // with something with the down arrow pressed. | 1431 | // with something with the down arrow pressed. |
1492 | 1432 | ||
@@ -1494,8 +1434,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1494 | if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) | 1434 | if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) |
1495 | { | 1435 | { |
1496 | // Are the landing controls requirements filled? | 1436 | // Are the landing controls requirements filled? |
1497 | bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | 1437 | bool controlland = (((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
1498 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1438 | ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1499 | 1439 | ||
1500 | // Are the collision requirements fulfilled? | 1440 | // Are the collision requirements fulfilled? |
1501 | bool colliding = (m_physicsActor.IsColliding == true); | 1441 | bool colliding = (m_physicsActor.IsColliding == true); |
@@ -1508,10 +1448,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1508 | 1448 | ||
1509 | if (update_movementflag || (update_rotation && DCFlagKeyPressed)) | 1449 | if (update_movementflag || (update_rotation && DCFlagKeyPressed)) |
1510 | { | 1450 | { |
1511 | // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); | 1451 | // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); |
1512 | // m_log.DebugFormat( | 1452 | // m_log.DebugFormat( |
1513 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); | 1453 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); |
1514 | 1454 | ||
1515 | AddNewMovement(agent_control_v3, q); | 1455 | AddNewMovement(agent_control_v3, q); |
1516 | 1456 | ||
1517 | if (update_movementflag) | 1457 | if (update_movementflag) |