mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
This commit is contained in:
@@ -49,12 +49,10 @@ using OpenSim.Capabilities.Handlers;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarPickerSearchModule")]
|
||||
public class AvatarPickerSearchModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IPeople m_People;
|
||||
@@ -134,6 +132,5 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
caps.RegisterHandler("AvatarPickerSearch", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
// UUID capID = UUID.Random();
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
|
||||
@@ -3842,7 +3842,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
|
||||
|
||||
// Count this as a resent packet since we are going to requeue all of the updates contained in it
|
||||
Interlocked.Increment(ref m_udpClient.PacketsResent);
|
||||
Interlocked.Increment(ref m_udpClient.PacketsResent);
|
||||
|
||||
// We're not going to worry about interlock yet since its not currently critical that this total count
|
||||
// is 100% correct
|
||||
m_udpServer.PacketsResentCount++;
|
||||
|
||||
foreach (EntityUpdate update in updates)
|
||||
ResendPrimUpdate(update);
|
||||
@@ -4407,6 +4411,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// Count this as a resent packet since we are going to requeue all of the updates contained in it
|
||||
Interlocked.Increment(ref m_udpClient.PacketsResent);
|
||||
|
||||
// We're not going to worry about interlock yet since its not currently critical that this total count
|
||||
// is 100% correct
|
||||
m_udpServer.PacketsResentCount++;
|
||||
|
||||
foreach (ObjectPropertyUpdate update in updates)
|
||||
ResendPropertyUpdate(update);
|
||||
}
|
||||
@@ -4594,6 +4602,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
SceneObjectPart root = sop.ParentGroup.RootPart;
|
||||
|
||||
block.TouchName = Util.StringToBytes256(root.TouchName);
|
||||
|
||||
// SL 3.3.4, at least, appears to read this information as a concatenated byte[] stream of UUIDs but
|
||||
// it's not yet clear whether this is actually used. If this is done in the future then a pre-cached
|
||||
// copy is really needed since it's less efficient to be constantly recreating this byte array.
|
||||
// using (MemoryStream memStream = new MemoryStream())
|
||||
// {
|
||||
// using (BinaryWriter binWriter = new BinaryWriter(memStream))
|
||||
// {
|
||||
// for (int i = 0; i < sop.GetNumberOfSides(); i++)
|
||||
// {
|
||||
// Primitive.TextureEntryFace teFace = sop.Shape.Textures.FaceTextures[i];
|
||||
//
|
||||
// UUID textureID;
|
||||
//
|
||||
// if (teFace != null)
|
||||
// textureID = teFace.TextureID;
|
||||
// else
|
||||
// textureID = sop.Shape.Textures.DefaultTexture.TextureID;
|
||||
//
|
||||
// binWriter.Write(textureID.GetBytes());
|
||||
// }
|
||||
//
|
||||
// block.TextureID = memStream.ToArray();
|
||||
// }
|
||||
// }
|
||||
|
||||
block.TextureID = new byte[0]; // TextureID ???
|
||||
block.SitName = Util.StringToBytes256(root.SitName);
|
||||
block.OwnerMask = root.OwnerMask;
|
||||
|
||||
@@ -145,6 +145,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
stat => stat.Value = m_udpServer.UdpSends,
|
||||
StatVerbosity.Debug));
|
||||
|
||||
StatsManager.RegisterStat(
|
||||
new Stat(
|
||||
"OutgoingPacketsResentCount",
|
||||
"Number of packets resent because a client did not acknowledge receipt",
|
||||
"",
|
||||
"",
|
||||
"clientstack",
|
||||
scene.Name,
|
||||
StatType.Pull,
|
||||
MeasuresOfInterest.AverageChangeOverTime,
|
||||
stat => stat.Value = m_udpServer.PacketsResentCount,
|
||||
StatVerbosity.Debug));
|
||||
|
||||
StatsManager.RegisterStat(
|
||||
new Stat(
|
||||
"AverageUDPProcessTime",
|
||||
@@ -298,6 +311,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public Socket Server { get { return null; } }
|
||||
|
||||
/// <summary>
|
||||
/// Record how many packets have been resent
|
||||
/// </summary>
|
||||
internal int PacketsResentCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Record how many packets have been sent
|
||||
/// </summary>
|
||||
internal int PacketsSentCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Record how many inbound packets could not be recognized as LLUDP packets.
|
||||
/// </summary>
|
||||
@@ -866,44 +889,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return x == m_location;
|
||||
}
|
||||
|
||||
public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
|
||||
{
|
||||
// CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
|
||||
if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
|
||||
allowSplitting = false;
|
||||
|
||||
if (allowSplitting && packet.HasVariableBlocks)
|
||||
{
|
||||
byte[][] datas = packet.ToBytesMultiple();
|
||||
int packetCount = datas.Length;
|
||||
|
||||
if (packetCount < 1)
|
||||
m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
|
||||
|
||||
for (int i = 0; i < packetCount; i++)
|
||||
{
|
||||
byte[] data = datas[i];
|
||||
m_scene.ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
if (client is LLClientView)
|
||||
SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] data = packet.ToBytes();
|
||||
m_scene.ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
if (client is LLClientView)
|
||||
SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
// public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
|
||||
// {
|
||||
// // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
|
||||
// if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
|
||||
// allowSplitting = false;
|
||||
//
|
||||
// if (allowSplitting && packet.HasVariableBlocks)
|
||||
// {
|
||||
// byte[][] datas = packet.ToBytesMultiple();
|
||||
// int packetCount = datas.Length;
|
||||
//
|
||||
// if (packetCount < 1)
|
||||
// m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
|
||||
//
|
||||
// for (int i = 0; i < packetCount; i++)
|
||||
// {
|
||||
// byte[] data = datas[i];
|
||||
// m_scene.ForEachClient(
|
||||
// delegate(IClientAPI client)
|
||||
// {
|
||||
// if (client is LLClientView)
|
||||
// SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// byte[] data = packet.ToBytes();
|
||||
// m_scene.ForEachClient(
|
||||
// delegate(IClientAPI client)
|
||||
// {
|
||||
// if (client is LLClientView)
|
||||
// SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Start the process of sending a packet to the client.
|
||||
@@ -923,6 +946,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
|
||||
allowSplitting = false;
|
||||
|
||||
bool packetQueued = false;
|
||||
|
||||
if (allowSplitting && packet.HasVariableBlocks)
|
||||
{
|
||||
byte[][] datas = packet.ToBytesMultiple();
|
||||
@@ -934,18 +959,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
for (int i = 0; i < packetCount; i++)
|
||||
{
|
||||
byte[] data = datas[i];
|
||||
SendPacketData(udpClient, data, packet.Type, category, method);
|
||||
|
||||
if (!SendPacketData(udpClient, data, packet.Type, category, method))
|
||||
packetQueued = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] data = packet.ToBytes();
|
||||
SendPacketData(udpClient, data, packet.Type, category, method);
|
||||
packetQueued = SendPacketData(udpClient, data, packet.Type, category, method);
|
||||
}
|
||||
|
||||
PacketPool.Instance.ReturnPacket(packet);
|
||||
|
||||
m_dataPresentEvent.Set();
|
||||
if (packetQueued)
|
||||
m_dataPresentEvent.Set();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -959,7 +987,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// The method to call if the packet is not acked by the client. If null, then a standard
|
||||
/// resend of the packet is done.
|
||||
/// </param>
|
||||
public void SendPacketData(
|
||||
/// <returns>true if the data was sent immediately, false if it was queued for sending</returns>
|
||||
public bool SendPacketData(
|
||||
LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category, UnackedPacketMethod method)
|
||||
{
|
||||
int dataLength = data.Length;
|
||||
@@ -1032,7 +1061,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// packet so that it isn't sent before a queued update packet.
|
||||
bool requestQueue = type == PacketType.KillObject;
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
|
||||
{
|
||||
SendPacketFinal(outgoingPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
#endregion Queue or Send
|
||||
}
|
||||
@@ -1213,6 +1248,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
else
|
||||
{
|
||||
Interlocked.Increment(ref udpClient.PacketsResent);
|
||||
|
||||
// We're not going to worry about interlock yet since its not currently critical that this total count
|
||||
// is 100% correct
|
||||
PacketsResentCount++;
|
||||
}
|
||||
|
||||
#endregion Sequence Number Assignment
|
||||
@@ -1220,6 +1259,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// Stats tracking
|
||||
Interlocked.Increment(ref udpClient.PacketsSent);
|
||||
|
||||
// We're not going to worry about interlock yet since its not currently critical that this total count
|
||||
// is 100% correct
|
||||
PacketsSentCount++;
|
||||
|
||||
// Put the UDP payload on the wire
|
||||
AsyncBeginSend(buffer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user