Beginning work on the new LLUDP implementation
parent
a528e7704c
commit
429a84f390
|
@ -29,9 +29,9 @@ using System;
|
|||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
[Flags]
|
||||
public enum ThrottleOutPacketType : int
|
||||
{
|
||||
Unknown = -1, // Also doubles as 'do not throttle'
|
||||
Resend = 0,
|
||||
Land = 1,
|
||||
Wind = 2,
|
||||
|
@ -39,11 +39,5 @@ namespace OpenSim.Framework
|
|||
Task = 4,
|
||||
Texture = 5,
|
||||
Asset = 6,
|
||||
Unknown = 7, // Also doubles as 'do not throttle'
|
||||
Back = 8,
|
||||
|
||||
TypeMask = 15, // The mask to mask off the flags
|
||||
|
||||
LowPriority = 128 // Additional flags
|
||||
}
|
||||
}
|
||||
|
|
|
@ -675,7 +675,7 @@ namespace OpenSim
|
|||
|
||||
if (foundClientServer)
|
||||
{
|
||||
m_clientServers[clientServerElement].Server.Close();
|
||||
m_clientServers[clientServerElement].NetworkStop();
|
||||
m_clientServers.RemoveAt(clientServerElement);
|
||||
}
|
||||
IScene scene;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.ClientStack
|
|||
IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource,
|
||||
AgentCircuitManager authenticateClass);
|
||||
|
||||
Socket Server { get; }
|
||||
void NetworkStop();
|
||||
bool HandlesRegion(Location x);
|
||||
void AddScene(IScene x);
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public interface ILLClientStackNetworkHandler
|
||||
{
|
||||
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
|
||||
void RemoveClientCircuit(uint circuitcode);
|
||||
void RegisterPacketServer(LLPacketServer server);
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
|
||||
public delegate void PacketDrop(Packet pack, Object id);
|
||||
public delegate void QueueEmpty(ThrottleOutPacketType queue);
|
||||
public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
|
||||
|
||||
/// <summary>
|
||||
/// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks,
|
||||
/// resends, pings, etc.)
|
||||
/// </summary>
|
||||
public interface ILLPacketHandler : IDisposable
|
||||
{
|
||||
event PacketStats OnPacketStats;
|
||||
event PacketDrop OnPacketDrop;
|
||||
event QueueEmpty OnQueueEmpty;
|
||||
SynchronizeClientHandler SynchronizeClient { set; }
|
||||
|
||||
int PacketsReceived { get; }
|
||||
int PacketsReceivedReported { get; }
|
||||
uint ResendTimeout { get; set; }
|
||||
bool ReliableIsImportant { get; set; }
|
||||
int MaxReliableResends { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initial handling of a received packet. It will be processed later in ProcessInPacket()
|
||||
/// </summary>
|
||||
/// <param name="packet"></param>
|
||||
void InPacket(Packet packet);
|
||||
|
||||
/// <summary>
|
||||
/// Take action depending on the type and contents of an received packet.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
void ProcessInPacket(LLQueItem item);
|
||||
|
||||
void ProcessOutPacket(LLQueItem item);
|
||||
void OutPacket(Packet NewPack,
|
||||
ThrottleOutPacketType throttlePacketType);
|
||||
void OutPacket(Packet NewPack,
|
||||
ThrottleOutPacketType throttlePacketType, Object id);
|
||||
LLPacketQueue PacketQueue { get; }
|
||||
void Flush();
|
||||
void Clear();
|
||||
ClientInfo GetClientInfo();
|
||||
void SetClientInfo(ClientInfo info);
|
||||
void AddImportantPacket(PacketType type);
|
||||
void RemoveImportantPacket(PacketType type);
|
||||
int GetQueueCount(ThrottleOutPacketType queue);
|
||||
}
|
||||
}
|
|
@ -197,8 +197,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_currentPacket = StartPacket;
|
||||
}
|
||||
|
||||
if ((m_imageManager != null) && (m_imageManager.Client != null) && (m_imageManager.Client.PacketHandler != null))
|
||||
if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0)
|
||||
if (m_imageManager != null && m_imageManager.Client != null)
|
||||
{
|
||||
if (m_imageManager.Client.IsThrottleEmpty(ThrottleOutPacketType.Texture))
|
||||
{
|
||||
//m_log.Debug("No textures queued, sending one packet to kickstart it");
|
||||
SendPacket(m_imageManager.Client);
|
||||
|
@ -206,6 +207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool SendFirstPacket(LLClientView client)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -172,7 +172,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_lastloopprocessed = DateTime.Now.Ticks;
|
||||
|
||||
// This can happen during Close()
|
||||
if (m_client == null || m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null)
|
||||
if (m_client == null)
|
||||
return false;
|
||||
|
||||
while ((imagereq = GetHighestPriorityImage()) != null)
|
||||
|
|
|
@ -39,7 +39,12 @@ using Timer=System.Timers.Timer;
|
|||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public class LLPacketHandler : ILLPacketHandler
|
||||
public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
|
||||
public delegate void PacketDrop(Packet pack, Object id);
|
||||
public delegate void QueueEmpty(ThrottleOutPacketType queue);
|
||||
public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
|
||||
|
||||
public class LLPacketHandler
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected readonly ILLClientStackNetworkHandler m_networkHandler;
|
||||
protected readonly LLUDPServer m_networkHandler;
|
||||
protected IScene m_scene;
|
||||
|
||||
/// <summary>
|
||||
|
@ -50,7 +50,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// </summary>
|
||||
private ClientStackUserSettings m_userSettings;
|
||||
|
||||
public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings)
|
||||
public LLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
|
||||
{
|
||||
m_userSettings = userSettings;
|
||||
m_networkHandler = networkHandler;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,8 +25,13 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using OpenMetaverse;
|
||||
|
||||
using ReaderWriterLockImpl = OpenMetaverse.ReaderWriterLockSlim;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public class LLUtil
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
|||
|
||||
TestClient testClient = new TestClient(agent, scene);
|
||||
|
||||
ILLPacketHandler packetHandler
|
||||
LLPacketHandler packetHandler
|
||||
= new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
|
||||
|
||||
packetHandler.InPacket(new AgentAnimationPacket());
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
|||
/// </summary>
|
||||
protected Dictionary<PacketType, int> m_packetsReceived = new Dictionary<PacketType, int>();
|
||||
|
||||
public TestLLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings)
|
||||
public TestLLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
|
||||
: base(networkHandler, userSettings)
|
||||
{}
|
||||
|
||||
|
|
Loading…
Reference in New Issue