aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-18 01:09:47 -0700
committerTom Grimshaw2010-05-18 01:09:47 -0700
commit91b1d17e5bd3ff6ed006744bc529b53a67af1a64 (patch)
tree0d903e6526fd66151a43ff86dd674fe28b120cec /OpenSim/Region
parentWhile examining our 10,10,10 issue I discovered that several threads were loc... (diff)
downloadopensim-SC_OLD-91b1d17e5bd3ff6ed006744bc529b53a67af1a64.zip
opensim-SC_OLD-91b1d17e5bd3ff6ed006744bc529b53a67af1a64.tar.gz
opensim-SC_OLD-91b1d17e5bd3ff6ed006744bc529b53a67af1a64.tar.bz2
opensim-SC_OLD-91b1d17e5bd3ff6ed006744bc529b53a67af1a64.tar.xz
Fix for hanging on "Connecting to region".. caused by packets being processed before the presence has bound to receive events. Fixed this by adding packets to a queue and then processing them when the presence is ready.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs37
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs102
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
5 files changed, 97 insertions, 54 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 5670a78..df6a767 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -376,6 +376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
376 private AgentUpdateArgs lastarg; 376 private AgentUpdateArgs lastarg;
377 private bool m_IsActive = true; 377 private bool m_IsActive = true;
378 private bool m_IsLoggingOut = false; 378 private bool m_IsLoggingOut = false;
379 private bool m_IsPresenceReady = false;
379 380
380 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 381 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
381 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 382 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -399,6 +400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
399 400
400 private Timer m_propertiesPacketTimer; 401 private Timer m_propertiesPacketTimer;
401 private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); 402 private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>();
403 private List<Packet> m_pendingPackets;
402 404
403 #endregion Class Members 405 #endregion Class Members
404 406
@@ -439,6 +441,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
439 get { return m_IsActive; } 441 get { return m_IsActive; }
440 set { m_IsActive = value; } 442 set { m_IsActive = value; }
441 } 443 }
444
442 public bool IsLoggingOut 445 public bool IsLoggingOut
443 { 446 {
444 get { return m_IsLoggingOut; } 447 get { return m_IsLoggingOut; }
@@ -11196,18 +11199,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11196 } 11199 }
11197 11200
11198 /// <summary> 11201 /// <summary>
11202 /// This processes packets which have accumulated while the presence was still in the process of initialising.
11203 /// </summary>
11204 public void ProcessPendingPackets()
11205 {
11206 m_IsPresenceReady = true;
11207 foreach (Packet p in m_pendingPackets)
11208 {
11209 ProcessInPacket(p);
11210 }
11211 m_pendingPackets.Clear();
11212 }
11213
11214 /// <summary>
11199 /// Entryway from the client to the simulator. All UDP packets from the client will end up here 11215 /// Entryway from the client to the simulator. All UDP packets from the client will end up here
11200 /// </summary> 11216 /// </summary>
11201 /// <param name="Pack">OpenMetaverse.packet</param> 11217 /// <param name="Pack">OpenMetaverse.packet</param>
11202 public void ProcessInPacket(Packet Pack) 11218 public void ProcessInPacket(Packet Pack)
11203 { 11219 {
11204 if (m_debugPacketLevel >= 255) 11220 if (!m_IsPresenceReady)
11205 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); 11221 {
11222 if (m_pendingPackets == null)
11223 {
11224 m_pendingPackets = new List<Packet>();
11225 }
11226 m_pendingPackets.Add(Pack);
11227 }
11228 else
11229 {
11230 if (m_debugPacketLevel >= 255)
11231 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
11206 11232
11207 if (!ProcessPacketMethod(Pack)) 11233 if (!ProcessPacketMethod(Pack))
11208 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); 11234 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
11209 11235
11210 PacketPool.Instance.ReturnPacket(Pack); 11236 PacketPool.Instance.ReturnPacket(Pack);
11237 }
11211 } 11238 }
11212 11239
11213 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) 11240 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 84385ad..c454d1f 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -825,6 +825,10 @@ namespace OpenSim.Region.Examples.SimpleModule
825 { 825 {
826 } 826 }
827 827
828 public void ProcessPendingPackets()
829 {
830 }
831
828 public void ProcessInPacket(Packet NewPack) 832 public void ProcessInPacket(Packet NewPack)
829 { 833 {
830 } 834 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d76f029..0b644b9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Scenes
129 129
130 private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation 130 private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation
131 private Vector3 m_avUnscriptedSitPos; // for non-scripted prims 131 private Vector3 m_avUnscriptedSitPos; // for non-scripted prims
132 private Vector3 m_lastPosition; 132 private Vector3 m_lastPosition;
133 private Vector3 m_lastWorldPosition; 133 private Vector3 m_lastWorldPosition;
134 private Quaternion m_lastRotation; 134 private Quaternion m_lastRotation;
135 private Vector3 m_lastVelocity; 135 private Vector3 m_lastVelocity;
@@ -715,8 +715,11 @@ namespace OpenSim.Region.Framework.Scenes
715 // Request info about all the (root) agents in this region 715 // Request info about all the (root) agents in this region
716 // Note: This won't send data *to* other clients in that region (children don't send) 716 // Note: This won't send data *to* other clients in that region (children don't send)
717 SendInitialFullUpdateToAllClients(); 717 SendInitialFullUpdateToAllClients();
718
719 RegisterToEvents(); 718 RegisterToEvents();
719 if (m_controllingClient != null)
720 {
721 m_controllingClient.ProcessPendingPackets();
722 }
720 SetDirectionVectors(); 723 SetDirectionVectors();
721 } 724 }
722 725
@@ -858,7 +861,6 @@ namespace OpenSim.Region.Framework.Scenes
858 m_grouptitle = gm.GetGroupTitle(m_uuid); 861 m_grouptitle = gm.GetGroupTitle(m_uuid);
859 862
860 m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; 863 m_rootRegionHandle = m_scene.RegionInfo.RegionHandle;
861
862 m_scene.SetRootAgentScene(m_uuid); 864 m_scene.SetRootAgentScene(m_uuid);
863 865
864 // Moved this from SendInitialData to ensure that m_appearance is initialized 866 // Moved this from SendInitialData to ensure that m_appearance is initialized
@@ -875,22 +877,22 @@ namespace OpenSim.Region.Framework.Scenes
875 { 877 {
876 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); 878 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
877 pos.Y = crossedBorder.BorderLine.Z - 1; 879 pos.Y = crossedBorder.BorderLine.Z - 1;
878 } 880 }
879 881
880 //If they're TP'ing in or logging in, we haven't had time to add any known child regions yet. 882 //If they're TP'ing in or logging in, we haven't had time to add any known child regions yet.
881 //This has the unfortunate consequence that if somebody is TP'ing who is already a child agent, 883 //This has the unfortunate consequence that if somebody is TP'ing who is already a child agent,
882 //they'll bypass the landing point. But I can't think of any decent way of fixing this. 884 //they'll bypass the landing point. But I can't think of any decent way of fixing this.
883 if (KnownChildRegionHandles.Count == 0) 885 if (KnownChildRegionHandles.Count == 0)
884 { 886 {
885 ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); 887 ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
886 if (land != null) 888 if (land != null)
887 { 889 {
888 //Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni. 890 //Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni.
889 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_userLevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid) 891 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_userLevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid)
890 { 892 {
891 pos = land.LandData.UserLocation; 893 pos = land.LandData.UserLocation;
892 } 894 }
893 } 895 }
894 } 896 }
895 897
896 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 898 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
@@ -1027,8 +1029,8 @@ namespace OpenSim.Region.Framework.Scenes
1027 bool isFlying = false; 1029 bool isFlying = false;
1028 1030
1029 if (m_physicsActor != null) 1031 if (m_physicsActor != null)
1030 isFlying = m_physicsActor.Flying; 1032 isFlying = m_physicsActor.Flying;
1031 1033
1032 RemoveFromPhysicalScene(); 1034 RemoveFromPhysicalScene();
1033 Velocity = Vector3.Zero; 1035 Velocity = Vector3.Zero;
1034 AbsolutePosition = pos; 1036 AbsolutePosition = pos;
@@ -1039,7 +1041,7 @@ namespace OpenSim.Region.Framework.Scenes
1039 SetHeight(m_appearance.AvatarHeight); 1041 SetHeight(m_appearance.AvatarHeight);
1040 } 1042 }
1041 1043
1042 SendTerseUpdateToAllClients(); 1044 SendTerseUpdateToAllClients();
1043 1045
1044 } 1046 }
1045 1047
@@ -1173,7 +1175,6 @@ namespace OpenSim.Region.Framework.Scenes
1173 pos.Z = ground + 1.5f; 1175 pos.Z = ground + 1.5f;
1174 AbsolutePosition = pos; 1176 AbsolutePosition = pos;
1175 } 1177 }
1176
1177 m_isChildAgent = false; 1178 m_isChildAgent = false;
1178 bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1179 bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1179 MakeRootAgent(AbsolutePosition, m_flying); 1180 MakeRootAgent(AbsolutePosition, m_flying);
@@ -1745,14 +1746,14 @@ namespace OpenSim.Region.Framework.Scenes
1745// else 1746// else
1746// { // single or child prim 1747// { // single or child prim
1747 1748
1748// } 1749// }
1749 if (part == null) //CW: Part may be gone. llDie() for example. 1750 if (part == null) //CW: Part may be gone. llDie() for example.
1750 { 1751 {
1751 partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); 1752 partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
1752 } 1753 }
1753 else 1754 else
1754 { 1755 {
1755 partRot = part.GetWorldRotation(); 1756 partRot = part.GetWorldRotation();
1756 } 1757 }
1757 1758
1758 Quaternion partIRot = Quaternion.Inverse(partRot); 1759 Quaternion partIRot = Quaternion.Inverse(partRot);
@@ -1760,22 +1761,22 @@ namespace OpenSim.Region.Framework.Scenes
1760 Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av 1761 Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av
1761 Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av 1762 Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av
1762 1763
1763 1764
1764 if (m_physicsActor == null) 1765 if (m_physicsActor == null)
1765 { 1766 {
1766 AddToPhysicalScene(false); 1767 AddToPhysicalScene(false);
1768 }
1769 //CW: If the part isn't null then we can set the current position
1770 if (part != null)
1771 {
1772 Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset!
1773 AbsolutePosition = avWorldStandUp; //KF: Fix stand up.
1774 part.IsOccupied = false;
1767 } 1775 }
1768 //CW: If the part isn't null then we can set the current position 1776 else
1769 if (part != null) 1777 {
1770 { 1778 //CW: Since the part doesn't exist, a coarse standup position isn't an issue
1771 Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset! 1779 AbsolutePosition = m_lastWorldPosition;
1772 AbsolutePosition = avWorldStandUp; //KF: Fix stand up.
1773 part.IsOccupied = false;
1774 }
1775 else
1776 {
1777 //CW: Since the part doesn't exist, a coarse standup position isn't an issue
1778 AbsolutePosition = m_lastWorldPosition;
1779 } 1780 }
1780 1781
1781 m_parentPosition = Vector3.Zero; 1782 m_parentPosition = Vector3.Zero;
@@ -1930,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes
1930// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) 1931// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
1931 if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) ) 1932 if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) )
1932 { 1933 {
1933 autopilot = false; // close enough 1934 autopilot = false; // close enough
1934 m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. 1935 m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup.
1935 Not using the part's position because returning the AV to the last known standing 1936 Not using the part's position because returning the AV to the last known standing
1936 position is likely to be more friendly, isn't it? */ 1937 position is likely to be more friendly, isn't it? */
@@ -1939,7 +1940,7 @@ namespace OpenSim.Region.Framework.Scenes
1939 } // else the autopilot will get us close 1940 } // else the autopilot will get us close
1940 } 1941 }
1941 else 1942 else
1942 { // its a scripted sit 1943 { // its a scripted sit
1943 m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup. 1944 m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup.
1944 I *am* using the part's position this time because we have no real idea how far away 1945 I *am* using the part's position this time because we have no real idea how far away
1945 the avatar is from the sit target. */ 1946 the avatar is from the sit target. */
@@ -3744,7 +3745,10 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
3744 m_scene = scene; 3745 m_scene = scene;
3745 3746
3746 RegisterToEvents(); 3747 RegisterToEvents();
3747 3748 if (m_controllingClient != null)
3749 {
3750 m_controllingClient.ProcessPendingPackets();
3751 }
3748 /* 3752 /*
3749 AbsolutePosition = client.StartPos; 3753 AbsolutePosition = client.StartPos;
3750 3754
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 7c0fe4c..cab640b 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -878,6 +878,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
878 878
879 } 879 }
880 880
881 public void ProcessPendingPackets()
882 {
883 }
884
881 public void ProcessInPacket(Packet NewPack) 885 public void ProcessInPacket(Packet NewPack)
882 { 886 {
883 887
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 4323c94..b828357 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -839,6 +839,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
839 { 839 {
840 } 840 }
841 841
842 public void ProcessPendingPackets()
843 {
844 }
845
842 public void ProcessInPacket(Packet NewPack) 846 public void ProcessInPacket(Packet NewPack)
843 { 847 {
844 } 848 }