aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-23 01:02:36 -0700
committerJohn Hurliman2009-10-23 01:02:36 -0700
commit588361e2a2398b963871762c2b5485c6a086cf47 (patch)
tree5be2c6705096817c599075da4e12a0e9b0a4c841 /OpenSim/Region/ClientStack
parentAdded VS2010 support to Prebuild and created runprebuild2010.bat (diff)
downloadopensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.zip
opensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.tar.gz
opensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.tar.bz2
opensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.tar.xz
Experimental change to use an immutable array for iterating ScenePresences, avoiding locking and copying the list each time it is accessed
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs141
1 files changed, 70 insertions, 71 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 5acf25f..e81ff4b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4434,6 +4434,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4434 protected virtual void RegisterLocalPacketHandlers() 4434 protected virtual void RegisterLocalPacketHandlers()
4435 { 4435 {
4436 AddLocalPacketHandler(PacketType.LogoutRequest, Logout); 4436 AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
4437 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate);
4437 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); 4438 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
4438 AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); 4439 AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
4439 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); 4440 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
@@ -4446,6 +4447,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4446 4447
4447 #region Packet Handlers 4448 #region Packet Handlers
4448 4449
4450 private bool HandleAgentUpdate(IClientAPI sener, Packet Pack)
4451 {
4452 if (OnAgentUpdate != null)
4453 {
4454 bool update = false;
4455 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
4456
4457 #region Packet Session and User Check
4458 if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId)
4459 return false;
4460 #endregion
4461
4462 AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
4463
4464 // We can only check when we have something to check
4465 // against.
4466
4467 if (lastarg != null)
4468 {
4469 update =
4470 (
4471 (x.BodyRotation != lastarg.BodyRotation) ||
4472 (x.CameraAtAxis != lastarg.CameraAtAxis) ||
4473 (x.CameraCenter != lastarg.CameraCenter) ||
4474 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
4475 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
4476 (x.ControlFlags != lastarg.ControlFlags) ||
4477 (x.Far != lastarg.Far) ||
4478 (x.Flags != lastarg.Flags) ||
4479 (x.State != lastarg.State) ||
4480 (x.HeadRotation != lastarg.HeadRotation) ||
4481 (x.SessionID != lastarg.SessionID) ||
4482 (x.AgentID != lastarg.AgentID)
4483 );
4484 }
4485 else
4486 update = true;
4487
4488 // These should be ordered from most-likely to
4489 // least likely to change. I've made an initial
4490 // guess at that.
4491
4492 if (update)
4493 {
4494 AgentUpdateArgs arg = new AgentUpdateArgs();
4495 arg.AgentID = x.AgentID;
4496 arg.BodyRotation = x.BodyRotation;
4497 arg.CameraAtAxis = x.CameraAtAxis;
4498 arg.CameraCenter = x.CameraCenter;
4499 arg.CameraLeftAxis = x.CameraLeftAxis;
4500 arg.CameraUpAxis = x.CameraUpAxis;
4501 arg.ControlFlags = x.ControlFlags;
4502 arg.Far = x.Far;
4503 arg.Flags = x.Flags;
4504 arg.HeadRotation = x.HeadRotation;
4505 arg.SessionID = x.SessionID;
4506 arg.State = x.State;
4507 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
4508 lastarg = arg; // save this set of arguments for nexttime
4509 if (handlerAgentUpdate != null)
4510 OnAgentUpdate(this, arg);
4511
4512 handlerAgentUpdate = null;
4513 }
4514 }
4515
4516 return true;
4517 }
4518
4449 private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) 4519 private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
4450 { 4520 {
4451 MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack; 4521 MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack;
@@ -5631,77 +5701,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5631 5701
5632 break; 5702 break;
5633 5703
5634 case PacketType.AgentUpdate:
5635 if (OnAgentUpdate != null)
5636 {
5637 bool update = false;
5638 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
5639
5640 #region Packet Session and User Check
5641 if (m_checkPackets)
5642 {
5643 if (agenUpdate.AgentData.SessionID != SessionId ||
5644 agenUpdate.AgentData.AgentID != AgentId)
5645 break;
5646 }
5647 #endregion
5648
5649 AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
5650
5651 // We can only check when we have something to check
5652 // against.
5653
5654 if (lastarg != null)
5655 {
5656 update =
5657 (
5658 (x.BodyRotation != lastarg.BodyRotation) ||
5659 (x.CameraAtAxis != lastarg.CameraAtAxis) ||
5660 (x.CameraCenter != lastarg.CameraCenter) ||
5661 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
5662 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
5663 (x.ControlFlags != lastarg.ControlFlags) ||
5664 (x.Far != lastarg.Far) ||
5665 (x.Flags != lastarg.Flags) ||
5666 (x.State != lastarg.State) ||
5667 (x.HeadRotation != lastarg.HeadRotation) ||
5668 (x.SessionID != lastarg.SessionID) ||
5669 (x.AgentID != lastarg.AgentID)
5670 );
5671 }
5672 else
5673 update = true;
5674
5675 // These should be ordered from most-likely to
5676 // least likely to change. I've made an initial
5677 // guess at that.
5678
5679 if (update)
5680 {
5681 AgentUpdateArgs arg = new AgentUpdateArgs();
5682 arg.AgentID = x.AgentID;
5683 arg.BodyRotation = x.BodyRotation;
5684 arg.CameraAtAxis = x.CameraAtAxis;
5685 arg.CameraCenter = x.CameraCenter;
5686 arg.CameraLeftAxis = x.CameraLeftAxis;
5687 arg.CameraUpAxis = x.CameraUpAxis;
5688 arg.ControlFlags = x.ControlFlags;
5689 arg.Far = x.Far;
5690 arg.Flags = x.Flags;
5691 arg.HeadRotation = x.HeadRotation;
5692 arg.SessionID = x.SessionID;
5693 arg.State = x.State;
5694 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
5695 lastarg = arg; // save this set of arguments for nexttime
5696 if (handlerAgentUpdate != null)
5697 OnAgentUpdate(this, arg);
5698
5699 handlerAgentUpdate = null;
5700 }
5701
5702 }
5703 break;
5704
5705 case PacketType.AgentAnimation: 5704 case PacketType.AgentAnimation:
5706 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 5705 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
5707 5706