Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

Conflicts:
	OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
avinationmerge
ubit 2012-07-15 23:56:00 +02:00
commit 337b2e634a
2 changed files with 67 additions and 48 deletions

View File

@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Flag to signal when clients should send pings</summary> /// <summary>Flag to signal when clients should send pings</summary>
private bool m_sendPing; private bool m_sendPing;
private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
private int m_defaultRTO = 0; private int m_defaultRTO = 0;
private int m_maxRTO = 0; private int m_maxRTO = 0;
@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
object[] array = new object[] { buffer, packet }; object[] array = new object[] { buffer, packet };
lock (m_pendingCache)
m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60);
Util.FireAndForget(HandleUseCircuitCode, array); Util.FireAndForget(HandleUseCircuitCode, array);
return; return;
@ -710,7 +714,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IClientAPI client; IClientAPI client;
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
{ {
<<<<<<< HEAD
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
=======
lock (m_pendingCache)
{
Queue<UDPPacketBuffer> queue;
if (m_pendingCache.TryGetValue(address, out queue))
queue.Enqueue(buffer);
}
// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
>>>>>>> 2606484e45138adef289386509b1e27552a32aee
return; return;
} }
@ -943,6 +958,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// We only want to send initial data to new clients, not ones which are being converted from child to root. // We only want to send initial data to new clients, not ones which are being converted from child to root.
if (client != null) if (client != null)
client.SceneAgent.SendInitialDataToMe(); client.SceneAgent.SendInitialDataToMe();
// Now we know we can handle more data
Thread.Sleep(200);
// Obtain the queue and remove it from the cache
Queue<UDPPacketBuffer> queue = null;
lock (m_pendingCache)
{
if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue))
return;
m_pendingCache.Remove(remoteEndPoint);
}
// Reinject queued packets
while(queue.Count > 0)
{
UDPPacketBuffer buf = queue.Dequeue();
PacketReceived(buf);
}
queue = null;
} }
else else
{ {
@ -950,6 +986,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_log.WarnFormat( m_log.WarnFormat(
"[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
lock (m_pendingCache)
m_pendingCache.Remove(remoteEndPoint);
} }
// m_log.DebugFormat( // m_log.DebugFormat(

View File

@ -8000,7 +8000,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
int idx = 0; int idx = 0;
SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used
bool positionChanged = false; bool positionChanged = false;
Vector3 finalPos = Vector3.Zero; Vector3 finalPos = Vector3.Zero;
@ -8015,78 +8014,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (code) switch (code)
{ {
// a avatar is a child
case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POSITION:
case (int)ScriptBaseClass.PRIM_POS_LOCAL: case (int)ScriptBaseClass.PRIM_POS_LOCAL:
{ {
if (remain < 1) if (remain < 1)
return; return;
LSL_Vector v; LSL_Vector v;
v = rules.GetVector3Item(idx++); v = rules.GetVector3Item(idx++);
if (sitpart == null) SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
if (part == null)
break; break;
Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
if (sitpart != sitpart.ParentGroup.RootPart) if (llGetLinkNumber() > 1)
{ {
pos -= sitpart.OffsetPosition; // remove sit part offset localRot = llGetLocalRot();
Quaternion rot = sitpart.RotationOffset; localPos = llGetLocalPos();
pos *= Quaternion.Conjugate(rot); // removed sit part rotation
} }
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
pos += sitOffset;
finalPos = pos; v -= localPos;
positionChanged = true; v /= localRot;
LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
v = v + 2 * sitOffset;
av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
av.SendAvatarDataToAllAgents();
} }
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
case (int)ScriptBaseClass.PRIM_ROTATION: case (int)ScriptBaseClass.PRIM_ROTATION:
{ {
if (remain < 1) if (remain < 1)
return; return;
if (sitpart == null) LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
break; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
LSL_Rotation r = rules.GetQuaternionItem(idx++); if (llGetLinkNumber() > 1)
Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation
// need to replicate SL bug
SceneObjectGroup sitgrp = sitpart.ParentGroup;
if (sitgrp != null && sitgrp.RootPart != sitpart)
{ {
rot = sitgrp.RootPart.RotationOffset * rot; localRot = llGetLocalRot();
localPos = llGetLocalPos();
} }
Quaternion srot = sitpart.RotationOffset; LSL_Rotation r;
rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation r = rules.GetQuaternionItem(idx++);
av.Rotation = rot; r = r * llGetRootRotation() / localRot;
// av.SendAvatarDataToAllAgents(); av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
av.SendTerseUpdateToAllClients(); av.SendAvatarDataToAllAgents();
}
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
{
if (remain < 1)
return;
if (sitpart == null)
break;
LSL_Rotation r = rules.GetQuaternionItem(idx++);
Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation
if (sitpart != sitpart.ParentGroup.RootPart)
{
Quaternion srot = sitpart.RotationOffset;
rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation
}
av.Rotation = rot;
// av.SendAvatarDataToAllAgents();
av.SendTerseUpdateToAllClients();
} }
break; break;