bad merge?

This commit is contained in:
UbitUmarov
2015-09-01 14:54:35 +01:00
406 changed files with 62562 additions and 8067 deletions

View File

@@ -241,7 +241,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Handlers for incoming packets</summary>
//PacketEventDictionary packetEvents = new PacketEventDictionary();
/// <summary>Incoming packets that are awaiting handling</summary>
private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
//private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>();
/// <summary>Bandwidth throttle for this UDP server</summary>
public TokenBucket Throttle { get; private set; }
@@ -299,14 +301,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Flag to signal when clients should send pings</summary>
protected bool m_sendPing;
private int m_animationSequenceNumber;
public int NextAnimationSequenceNumber
{
get
{
m_animationSequenceNumber++;
if (m_animationSequenceNumber > 2147482624)
m_animationSequenceNumber = 1;
return m_animationSequenceNumber;
}
}
private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
/// <summary>
/// Event used to signal when queued packets are available for sending.
/// </summary>
/// <remarks>
/// This allows the outbound loop to only operate when there is data to send rather than continuously polling.
/// Some data is sent immediately and not queued. That data would not trigger this event.
/// WRONG use. May be usefull in future revision
/// </remarks>
private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
// private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
private Pool<IncomingPacket> m_incomingPacketPool;
@@ -388,16 +408,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Measure the resolution of Environment.TickCount
TickCountResolution = 0f;
for (int i = 0; i < 5; i++)
for (int i = 0; i < 10; i++)
{
int start = Environment.TickCount;
int now = start;
while (now == start)
now = Environment.TickCount;
TickCountResolution += (float)(now - start) * 0.2f;
TickCountResolution += (float)(now - start) * 0.1f;
}
m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
TickCountResolution = (float)Math.Ceiling(TickCountResolution);
m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
#endregion Environment.TickCount Measurement
@@ -405,6 +425,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int sceneThrottleBps = 0;
bool usePools = false;
IConfig config = configSource.Configs["ClientStack.LindenUDP"];
if (config != null)
{
@@ -451,6 +473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
#endregion BinaryStats
<<<<<<< HEAD
// FIXME: Can't add info here because don't know scene yet.
// m_throttle
// = new TokenBucket(
@@ -458,8 +481,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Throttle = new TokenBucket("server throttle bucket", null, 0, sceneThrottleBps);
=======
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f);
>>>>>>> avn/ubitvar
ThrottleRates = new ThrottleRates(configSource);
Random rnd = new Random(Util.EnvironmentTickCount());
m_animationSequenceNumber = rnd.Next(11474826);
if (usePools)
EnablePools();
}
@@ -755,8 +784,151 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (UsePools)
EnablePoolStats();
<<<<<<< HEAD
LLUDPServerCommands commands = new LLUDPServerCommands(MainConsole.Instance, this);
commands.Register();
=======
MainConsole.Instance.Commands.AddCommand(
"Debug", false, "debug lludp packet",
"debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
"Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n"
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
+ "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
+ "If level <= 0 then no packets are logged.\n"
+ "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
+ "In this case, you cannot also specify an avatar name.\n"
+ "If an avatar name is given then only packets from that avatar are logged.",
HandlePacketCommand);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"debug lludp start",
"debug lludp start <in|out|all>",
"Control LLUDP packet processing.",
"No effect if packet processing has already started.\n"
+ "in - start inbound processing.\n"
+ "out - start outbound processing.\n"
+ "all - start in and outbound processing.\n",
HandleStartCommand);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"debug lludp stop",
"debug lludp stop <in|out|all>",
"Stop LLUDP packet processing.",
"No effect if packet processing has already stopped.\n"
+ "in - stop inbound processing.\n"
+ "out - stop outbound processing.\n"
+ "all - stop in and outbound processing.\n",
HandleStopCommand);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"debug lludp pool",
"debug lludp pool <on|off>",
"Turn object pooling within the lludp component on or off.",
HandlePoolCommand);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"debug lludp status",
"debug lludp status",
"Return status of LLUDP packet processing.",
HandleStatusCommand);
/* disabled
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"debug lludp toggle agentupdate",
"debug lludp toggle agentupdate",
"Toggle whether agentupdate packets are processed or simply discarded.",
HandleAgentUpdateCommand);
*/
}
private void HandlePacketCommand(string module, string[] args)
{
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
return;
bool setAsDefaultLevel = false;
OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null);
List<string> filteredArgs = optionSet.Parse(args);
string name = null;
if (filteredArgs.Count == 6)
{
if (!setAsDefaultLevel)
{
name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]);
}
else
{
MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level");
return;
}
}
if (filteredArgs.Count > 3)
{
int newDebug;
if (int.TryParse(filteredArgs[3], out newDebug))
{
if (setAsDefaultLevel)
{
DefaultClientPacketDebugLevel = newDebug;
MainConsole.Instance.OutputFormat(
"Debug packet debug for new clients set to {0} in {1}", DefaultClientPacketDebugLevel, m_scene.Name);
}
else
{
m_scene.ForEachScenePresence(sp =>
{
if (name == null || sp.Name == name)
{
MainConsole.Instance.OutputFormat(
"Packet debug for {0} ({1}) set to {2} in {3}",
sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name);
sp.ControllingClient.DebugPacketLevel = newDebug;
}
});
}
}
else
{
MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [<first-name> <last-name>]");
}
}
}
private void HandleStartCommand(string module, string[] args)
{
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
return;
if (args.Length != 4)
{
MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
return;
}
string subCommand = args[3];
if (subCommand == "in" || subCommand == "all")
StartInbound();
if (subCommand == "out" || subCommand == "all")
StartOutbound();
>>>>>>> avn/ubitvar
}
public bool HandlesRegion(Location x)
@@ -864,8 +1036,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
PacketPool.Instance.ReturnPacket(packet);
if (packetQueued)
m_dataPresentEvent.Set();
/// WRONG use. May be usefull in future revision
// if (packetQueued)
// m_dataPresentEvent.Set();
}
/// <summary>
@@ -936,6 +1109,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Queue or Send
bool highPriority = false;
if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0)
{
category = (ThrottleOutPacketType)((int)category & 127);
highPriority = true;
}
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
// If we were not provided a method for handling unacked, use the UDPServer default method
@@ -945,6 +1126,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
// continue to display the deleted object until relog. Therefore, we need to always queue a kill object
// packet so that it isn't sent before a queued update packet.
<<<<<<< HEAD
bool forceQueue = (type == PacketType.KillObject);
// if (type == PacketType.ImprovedTerseObjectUpdate)
@@ -956,15 +1138,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// else
// {
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forceQueue))
=======
bool requestQueue = type == PacketType.KillObject;
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
>>>>>>> avn/ubitvar
{
SendPacketFinal(outgoingPacket);
return true;
}
<<<<<<< HEAD
else
{
return false;
}
// }
=======
return false;
>>>>>>> avn/ubitvar
#endregion Queue or Send
}
@@ -1005,6 +1196,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pc.PingID.OldestUnacked = 0;
SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null);
udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount();
}
public void CompletePing(LLUDPClient udpClient, byte pingID)
@@ -1102,7 +1294,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int dataLength = buffer.DataLength;
// NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here
if (!isZerocoded)
if (!isZerocoded && !isResend && outgoingPacket.UnackedMethod == null)
{
// Keep appending ACKs until there is no room left in the buffer or there are
// no more ACKs to append
@@ -1268,35 +1460,76 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Packet to Client Mapping
// UseCircuitCode handling
if (packet.Type == PacketType.UseCircuitCode)
// If there is already a client for this endpoint, don't process UseCircuitCode
IClientAPI client = null;
if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
{
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the
// buffer.
object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
// UseCircuitCode handling
if (packet.Type == PacketType.UseCircuitCode)
{
// And if there is a UseCircuitCode pending, also drop it
lock (m_pendingCache)
{
if (m_pendingCache.Contains(endPoint))
return;
<<<<<<< HEAD
Util.FireAndForget(HandleUseCircuitCode, array, "LLUDPServer.HandleUseCircuitCode");
=======
m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60);
}
>>>>>>> avn/ubitvar
return;
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the
// buffer.
object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
Util.FireAndForget(HandleUseCircuitCode, array);
return;
}
}
else if (packet.Type == PacketType.CompleteAgentMovement)
// If this is a pending connection, enqueue, don't process yet
lock (m_pendingCache)
{
// Send ack straight away to let the viewer know that we got it.
SendAckImmediate(endPoint, packet.Header.Sequence);
Queue<UDPPacketBuffer> queue;
if (m_pendingCache.TryGetValue(endPoint, out queue))
{
//m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type);
queue.Enqueue(buffer);
return;
}
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the
// buffer.
object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
/*
else if (packet.Type == PacketType.CompleteAgentMovement)
{
// Send ack straight away to let the viewer know that we got it.
SendAckImmediate(endPoint, packet.Header.Sequence);
<<<<<<< HEAD
Util.FireAndForget(
HandleCompleteMovementIntoRegion, array, "LLUDPServer.HandleCompleteMovementIntoRegion");
=======
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the
// buffer.
object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
>>>>>>> avn/ubitvar
return;
Util.FireAndForget(HandleCompleteMovementIntoRegion, array);
return;
}
*/
}
// Determine which agent this packet came from
<<<<<<< HEAD
IClientAPI client;
if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
=======
if (client == null || !(client is LLClientView))
>>>>>>> avn/ubitvar
{
//m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
@@ -1313,7 +1546,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
udpClient = ((LLClientView)client).UDPClient;
if (!udpClient.IsConnected)
{
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName);
return;
}
#endregion Packet to Client Mapping
@@ -1416,6 +1652,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length);
#endregion BinaryStats
<<<<<<< HEAD
if (packet.Type == PacketType.AgentUpdate)
{
if (DiscardInboundAgentUpdates)
@@ -1434,6 +1671,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return;
}
}
=======
// AgentUpdate mess removed from here
>>>>>>> avn/ubitvar
#region Ping Check Handling
@@ -1444,7 +1684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// We don't need to do anything else with ping checks
StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
CompletePing(udpClient, startPing.PingID.PingID);
if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000)
{
udpClient.SendPacketStats();
@@ -1454,7 +1694,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else if (packet.Type == PacketType.CompletePingCheck)
{
// We don't currently track client ping times
int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS);
int c = udpClient.m_pingMS;
c = 800 * c + 200 * t;
c /= 1000;
udpClient.m_pingMS = c;
return;
}
@@ -1474,7 +1718,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
incomingPacket = new IncomingPacket((LLClientView)client, packet);
}
packetInbox.Enqueue(incomingPacket);
// if (incomingPacket.Packet.Type == PacketType.AgentUpdate ||
// incomingPacket.Packet.Type == PacketType.ChatFromViewer)
if (incomingPacket.Packet.Type == PacketType.ChatFromViewer)
packetInbox.EnqueueHigh(incomingPacket);
else
packetInbox.EnqueueLow(incomingPacket);
}
#region BinaryStats
@@ -1591,7 +1841,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
try
{
// DateTime startTime = DateTime.Now;
// DateTime startTime = DateTime.Now;
object[] array = (object[])o;
endPoint = (IPEndPoint)array[0];
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
@@ -1603,6 +1853,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AuthenticateResponse sessionInfo;
if (IsClientAuthorized(uccp, out sessionInfo))
{
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
// Begin the process of adding the client to the simulator
client
= AddClient(
@@ -1611,16 +1863,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
uccp.CircuitCode.SessionID,
endPoint,
sessionInfo);
// This will be true if the client is new, e.g. not
// an existing child agent, and there is no circuit data
if (client != null && aCircuit == null)
{
m_scene.CloseAgent(client.AgentId, true);
return;
}
// Now we know we can handle more data
Thread.Sleep(200);
// Obtain the pending queue and remove it from the cache
Queue<UDPPacketBuffer> queue = null;
lock (m_pendingCache)
{
if (!m_pendingCache.TryGetValue(endPoint, out queue))
{
m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present");
return;
}
m_pendingCache.Remove(endPoint);
}
m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count);
// Reinject queued packets
while (queue.Count > 0)
{
UDPPacketBuffer buf = queue.Dequeue();
PacketReceived(buf);
}
queue = null;
// Send ack straight away to let the viewer know that the connection is active.
// The client will be null if it already exists (e.g. if on a region crossing the client sends a use
// circuit code to the existing child agent. This is not particularly obvious.
SendAckImmediate(endPoint, uccp.Header.Sequence);
// We only want to send initial data to new clients, not ones which are being converted from child to root.
if (client != null)
{
<<<<<<< HEAD
AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
=======
>>>>>>> avn/ubitvar
bool tp = (aCircuit.teleportFlags > 0);
// Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
if (!tp && !client.SceneAgent.SentInitialDataToClient)
@@ -1632,9 +1923,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Don't create clients for unauthorized requesters.
m_log.WarnFormat(
"[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}",
<<<<<<< HEAD
uccp.CircuitCode.ID, Scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
}
=======
uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
lock (m_pendingCache)
m_pendingCache.Remove(endPoint);
}
>>>>>>> avn/ubitvar
// m_log.DebugFormat(
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
@@ -1651,8 +1950,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
e.StackTrace);
}
}
private void HandleCompleteMovementIntoRegion(object o)
/*
private void HandleCompleteMovementIntoRegion(object o)
{
IPEndPoint endPoint = null;
IClientAPI client = null;
@@ -1761,6 +2060,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
e.StackTrace);
}
}
*/
/// <summary>
/// Send an ack immediately to the given endpoint.
@@ -1818,6 +2118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
{
IClientAPI client = null;
bool createNew = false;
// We currently synchronize this code across the whole scene to avoid issues such as
// http://opensimulator.org/mantis/view.php?id=5365 However, once locking per agent circuit can be done
@@ -1826,7 +2127,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (!Scene.TryGetClient(agentID, out client))
{
<<<<<<< HEAD
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
=======
createNew = true;
}
else
{
if (client.SceneAgent == null)
{
m_scene.CloseAgent(agentID, true);
createNew = true;
}
}
if (createNew)
{
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
>>>>>>> avn/ubitvar
client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
client.OnLogout += LogoutHandler;
@@ -1856,15 +2174,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
ClientLogoutsDueToNoReceives++;
<<<<<<< HEAD
m_log.WarnFormat(
"[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
=======
if (client.SceneAgent != null)
{
m_log.WarnFormat(
"[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name);
>>>>>>> avn/ubitvar
if (!client.SceneAgent.IsChildAgent)
client.Kick("Simulator logged you out due to connection timeout.");
if (!client.SceneAgent.IsChildAgent)
client.Kick("Simulator logged you out due to connection timeout.");
}
}
<<<<<<< HEAD
Scene.CloseAgent(client.AgentId, true);
=======
if (!m_scene.CloseAgent(client.AgentId, true))
client.Close(true,true);
>>>>>>> avn/ubitvar
}
private void IncomingPacketHandler()
@@ -1877,6 +2209,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
while (IsRunningInbound)
{
m_scene.ThreadAlive(1);
try
{
IncomingPacket incomingPacket = null;
@@ -1899,7 +2232,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_incomingPacketPool.ReturnObject(incomingPacket);
}
}
catch (Exception ex)
catch(Exception ex)
{
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
}
@@ -1928,6 +2261,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
while (base.IsRunningOutbound)
{
m_scene.ThreadAlive(2);
try
{
m_packetSent = false;
@@ -1986,13 +2320,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// If nothing was sent, sleep for the minimum amount of time before a
// token bucket could get more tokens
//if (!m_packetSent)
// Thread.Sleep((int)TickCountResolution);
//
// Instead, now wait for data present to be explicitly signalled. Evidence so far is that with
// modern mono it reduces CPU base load since there is no more continuous polling.
if (!m_packetSent)
m_dataPresentEvent.WaitOne(100);
Thread.Sleep((int)TickCountResolution);
// .... wrong core code removed
Watchdog.UpdateThread();
}
@@ -2163,8 +2496,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Packet packet = incomingPacket.Packet;
LLClientView client = incomingPacket.Client;
if (client.IsActive)
{
// if (client.IsActive)
// {
m_currentIncomingClient = client;
try
@@ -2191,6 +2524,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_currentIncomingClient = null;
}
<<<<<<< HEAD
}
else
{
@@ -2198,6 +2532,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
packet.Type, client.Name, Scene.RegionInfo.RegionName);
}
=======
// }
// else
// {
// m_log.DebugFormat(
// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
// packet.Type, client.Name, m_scene.RegionInfo.RegionName);
// }
>>>>>>> avn/ubitvar
IncomingPacketsProcessed++;
}