aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs71
2 files changed, 64 insertions, 45 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index c64b5f2..10e8e48 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
153 /// <summary>Flag to signal when clients should send pings</summary> 153 /// <summary>Flag to signal when clients should send pings</summary>
154 private bool m_sendPing; 154 private bool m_sendPing;
155 155
156 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
157
156 private int m_defaultRTO = 0; 158 private int m_defaultRTO = 0;
157 private int m_maxRTO = 0; 159 private int m_maxRTO = 0;
158 160
@@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
701 { 703 {
702 object[] array = new object[] { buffer, packet }; 704 object[] array = new object[] { buffer, packet };
703 705
706 lock (m_pendingCache)
707 m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60);
704 Util.FireAndForget(HandleUseCircuitCode, array); 708 Util.FireAndForget(HandleUseCircuitCode, array);
705 709
706 return; 710 return;
@@ -710,7 +714,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
710 IClientAPI client; 714 IClientAPI client;
711 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) 715 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
712 { 716 {
717<<<<<<< HEAD
713 m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 718 m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
719=======
720 lock (m_pendingCache)
721 {
722 Queue<UDPPacketBuffer> queue;
723 if (m_pendingCache.TryGetValue(address, out queue))
724 queue.Enqueue(buffer);
725 }
726
727// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
728>>>>>>> 2606484e45138adef289386509b1e27552a32aee
714 return; 729 return;
715 } 730 }
716 731
@@ -943,6 +958,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
943 // We only want to send initial data to new clients, not ones which are being converted from child to root. 958 // We only want to send initial data to new clients, not ones which are being converted from child to root.
944 if (client != null) 959 if (client != null)
945 client.SceneAgent.SendInitialDataToMe(); 960 client.SceneAgent.SendInitialDataToMe();
961
962 // Now we know we can handle more data
963 Thread.Sleep(200);
964
965 // Obtain the queue and remove it from the cache
966 Queue<UDPPacketBuffer> queue = null;
967
968 lock (m_pendingCache)
969 {
970 if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue))
971 return;
972 m_pendingCache.Remove(remoteEndPoint);
973 }
974
975 // Reinject queued packets
976 while(queue.Count > 0)
977 {
978 UDPPacketBuffer buf = queue.Dequeue();
979 PacketReceived(buf);
980 }
981 queue = null;
946 } 982 }
947 else 983 else
948 { 984 {
@@ -950,6 +986,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
950 m_log.WarnFormat( 986 m_log.WarnFormat(
951 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", 987 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
952 uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); 988 uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
989 lock (m_pendingCache)
990 m_pendingCache.Remove(remoteEndPoint);
953 } 991 }
954 992
955 // m_log.DebugFormat( 993 // m_log.DebugFormat(
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d2dab6f..5bade25 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8000,7 +8000,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8000 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. 8000 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
8001 8001
8002 int idx = 0; 8002 int idx = 0;
8003 SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used
8004 8003
8005 bool positionChanged = false; 8004 bool positionChanged = false;
8006 Vector3 finalPos = Vector3.Zero; 8005 Vector3 finalPos = Vector3.Zero;
@@ -8015,78 +8014,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8015 8014
8016 switch (code) 8015 switch (code)
8017 { 8016 {
8018 // a avatar is a child
8019 case (int)ScriptBaseClass.PRIM_POSITION: 8017 case (int)ScriptBaseClass.PRIM_POSITION:
8020 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8018 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8021 { 8019 {
8022 if (remain < 1) 8020 if (remain < 1)
8023 return; 8021 return;
8022
8024 LSL_Vector v; 8023 LSL_Vector v;
8025 v = rules.GetVector3Item(idx++); 8024 v = rules.GetVector3Item(idx++);
8026 8025
8027 if (sitpart == null) 8026 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
8027 if (part == null)
8028 break; 8028 break;
8029 8029
8030 Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position 8030 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8031 8031 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8032 if (sitpart != sitpart.ParentGroup.RootPart) 8032 if (llGetLinkNumber() > 1)
8033 { 8033 {
8034 pos -= sitpart.OffsetPosition; // remove sit part offset 8034 localRot = llGetLocalRot();
8035 Quaternion rot = sitpart.RotationOffset; 8035 localPos = llGetLocalPos();
8036 pos *= Quaternion.Conjugate(rot); // removed sit part rotation
8037 } 8036 }
8038 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
8039 pos += sitOffset;
8040 8037
8041 finalPos = pos; 8038 v -= localPos;
8042 positionChanged = true; 8039 v /= localRot;
8043 }
8044 break;
8045 8040
8046 case (int)ScriptBaseClass.PRIM_ROTATION: 8041 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
8047 {
8048 if (remain < 1)
8049 return;
8050 8042
8051 if (sitpart == null) 8043 v = v + 2 * sitOffset;
8052 break;
8053 8044
8054 LSL_Rotation r = rules.GetQuaternionItem(idx++); 8045 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
8055 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation 8046 av.SendAvatarDataToAllAgents();
8056 8047
8057// need to replicate SL bug
8058 SceneObjectGroup sitgrp = sitpart.ParentGroup;
8059 if (sitgrp != null && sitgrp.RootPart != sitpart)
8060 {
8061 rot = sitgrp.RootPart.RotationOffset * rot;
8062 }
8063
8064 Quaternion srot = sitpart.RotationOffset;
8065 rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
8066 av.Rotation = rot;
8067// av.SendAvatarDataToAllAgents();
8068 av.SendTerseUpdateToAllClients();
8069 } 8048 }
8070 break; 8049 break;
8071 8050
8072 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8051 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8052 case (int)ScriptBaseClass.PRIM_ROTATION:
8073 { 8053 {
8074 if (remain < 1) 8054 if (remain < 1)
8075 return; 8055 return;
8076 8056
8077 if (sitpart == null) 8057 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8078 break; 8058 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8079 8059
8080 LSL_Rotation r = rules.GetQuaternionItem(idx++); 8060 if (llGetLinkNumber() > 1)
8081 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation
8082 if (sitpart != sitpart.ParentGroup.RootPart)
8083 { 8061 {
8084 Quaternion srot = sitpart.RotationOffset; 8062 localRot = llGetLocalRot();
8085 rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation 8063 localPos = llGetLocalPos();
8086 } 8064 }
8087 av.Rotation = rot; 8065
8088// av.SendAvatarDataToAllAgents(); 8066 LSL_Rotation r;
8089 av.SendTerseUpdateToAllClients(); 8067 r = rules.GetQuaternionItem(idx++);
8068 r = r * llGetRootRotation() / localRot;
8069 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
8070 av.SendAvatarDataToAllAgents();
8090 } 8071 }
8091 break; 8072 break;
8092 8073