Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

LSLKeyTest
Diva Canto 2016-06-13 18:04:50 -07:00
commit 467de7a2f0
3 changed files with 110 additions and 111 deletions

View File

@ -51,33 +51,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// A shim around LLUDPServer that implements the IClientNetworkServer interface
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLUDPServerShim")]
public sealed class LLUDPServerShim : INonSharedRegionModule
public class LLUDPServerShim : INonSharedRegionModule
{
private bool m_Enabled = true;
private IConfigSource m_Config;
LLUDPServer m_udpServer;
protected IConfigSource m_Config;
protected LLUDPServer m_udpServer;
#region INonSharedRegionModule
public string Name
public virtual string Name
{
get { return "LLUDPServerShim"; }
}
public Type ReplaceableInterface
public virtual Type ReplaceableInterface
{
get { return null; }
}
public void Initialise(IConfigSource source)
public virtual void Initialise(IConfigSource source)
{
m_Config = source;
}
public void Close()
public virtual void Close()
{
}
public void AddRegion(Scene scene)
public virtual void AddRegion(Scene scene)
{
uint port = (uint)scene.RegionInfo.InternalEndPoint.Port;
@ -88,23 +87,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddScene(scene);
}
public void RemoveRegion(Scene scene)
public virtual void RemoveRegion(Scene scene)
{
Stop();
}
public void RegionLoaded(Scene scene)
public virtual void RegionLoaded(Scene scene)
{
Start();
}
#endregion
public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
public virtual void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
{
m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager);
}
public void AddScene(IScene scene)
public virtual void AddScene(IScene scene)
{
m_udpServer.AddScene(scene);
@ -228,17 +227,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
StatVerbosity.Debug));
}
public bool HandlesRegion(Location x)
public virtual bool HandlesRegion(Location x)
{
return m_udpServer.HandlesRegion(x);
}
public void Start()
public virtual void Start()
{
m_udpServer.Start();
}
public void Stop()
public virtual void Stop()
{
m_udpServer.Stop();
}
@ -257,7 +256,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public const int MTU = 1400;
/// <summary>Number of forced client logouts due to no receipt of packets before timeout.</summary>
public int ClientLogoutsDueToNoReceives { get; private set; }
public int ClientLogoutsDueToNoReceives { get; protected set; }
/// <summary>
/// Default packet debug level given to new clients
@ -284,12 +283,12 @@ 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>();
//protected OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
private OpenSim.Framework.BlockingQueue<IncomingPacket> packetInbox = new OpenSim.Framework.BlockingQueue<IncomingPacket>();
protected OpenSim.Framework.BlockingQueue<IncomingPacket> packetInbox = new OpenSim.Framework.BlockingQueue<IncomingPacket>();
/// <summary>Bandwidth throttle for this UDP server</summary>
public TokenBucket Throttle { get; private set; }
public TokenBucket Throttle { get; protected set; }
/// <summary>Per client throttle rates enforced by this server</summary>
/// <remarks>
@ -297,43 +296,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// The other rates (resend, asset, etc.) are the defaults for a new client and can be changed (and usually
/// do get changed immediately). They do not need to sum to the total.
/// </remarks>
public ThrottleRates ThrottleRates { get; private set; }
public ThrottleRates ThrottleRates { get; protected set; }
/// <summary>Manages authentication for agent circuits</summary>
private AgentCircuitManager m_circuitManager;
protected AgentCircuitManager m_circuitManager;
/// <summary>Reference to the scene this UDP server is attached to</summary>
public Scene Scene { get; private set; }
public Scene Scene { get; protected set; }
/// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary>
private Location m_location;
protected Location m_location;
/// <summary>The size of the receive buffer for the UDP socket. This value
/// is passed up to the operating system and used in the system networking
/// stack. Use zero to leave this value as the default</summary>
private int m_recvBufferSize;
protected int m_recvBufferSize;
/// <summary>Flag to process packets asynchronously or synchronously</summary>
private bool m_asyncPacketHandling;
protected bool m_asyncPacketHandling;
/// <summary>Tracks whether or not a packet was sent each round so we know
/// whether or not to sleep</summary>
private bool m_packetSent;
protected bool m_packetSent;
/// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary>
private int m_elapsedMSSinceLastStatReport = 0;
protected int m_elapsedMSSinceLastStatReport = 0;
/// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary>
private int m_tickLastOutgoingPacketHandler;
protected int m_tickLastOutgoingPacketHandler;
/// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary>
private int m_elapsedMSOutgoingPacketHandler;
protected int m_elapsedMSOutgoingPacketHandler;
/// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary>
private int m_elapsed100MSOutgoingPacketHandler;
protected int m_elapsed100MSOutgoingPacketHandler;
/// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary>
private int m_elapsed500MSOutgoingPacketHandler;
protected int m_elapsed500MSOutgoingPacketHandler;
/// <summary>Flag to signal when clients should check for resends</summary>
protected bool m_resendUnacked;
@ -344,7 +343,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Flag to signal when clients should send pings</summary>
protected bool m_sendPing;
private int m_animationSequenceNumber;
protected int m_animationSequenceNumber;
public int NextAnimationSequenceNumber
{
@ -359,7 +358,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
protected ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
/// <summary>
/// Event used to signal when queued packets are available for sending.
@ -369,25 +368,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// 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);
// protected AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
private Pool<IncomingPacket> m_incomingPacketPool;
protected Pool<IncomingPacket> m_incomingPacketPool;
/// <summary>
/// Stat for number of packets in the main pool awaiting use.
/// </summary>
private Stat m_poolCountStat;
protected Stat m_poolCountStat;
/// <summary>
/// Stat for number of packets in the inbound packet pool awaiting use.
/// </summary>
private Stat m_incomingPacketPoolStat;
protected Stat m_incomingPacketPoolStat;
private int m_defaultRTO = 0;
private int m_maxRTO = 0;
private int m_ackTimeout = 0;
private int m_pausedAckTimeout = 0;
private bool m_disableFacelights = false;
protected int m_defaultRTO = 0;
protected int m_maxRTO = 0;
protected int m_ackTimeout = 0;
protected int m_pausedAckTimeout = 0;
protected bool m_disableFacelights = false;
public Socket Server { get { return null; } }
@ -409,28 +408,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// Record how many inbound packets could not be recognized as LLUDP packets.
/// </summary>
public int IncomingMalformedPacketCount { get; private set; }
public int IncomingMalformedPacketCount { get; protected set; }
/// <summary>
/// Record how many inbound packets could not be associated with a simulator circuit.
/// </summary>
public int IncomingOrphanedPacketCount { get; private set; }
public int IncomingOrphanedPacketCount { get; protected set; }
/// <summary>
/// Record current outgoing client for monitoring purposes.
/// </summary>
private IClientAPI m_currentOutgoingClient;
protected IClientAPI m_currentOutgoingClient;
/// <summary>
/// Recording current incoming client for monitoring purposes.
/// </summary>
private IClientAPI m_currentIncomingClient;
protected IClientAPI m_currentIncomingClient;
/// <summary>
/// Queue some low priority but potentially high volume async requests so that they don't overwhelm available
/// threadpool threads.
/// </summary>
public JobEngine IpahEngine { get; private set; }
public JobEngine IpahEngine { get; protected set; }
/// <summary>
/// Run queue empty processing within a single persistent thread.
@ -440,7 +439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// connection schedule its own job in the threadpool which causes performance problems when there are many
/// connections.
/// </remarks>
public JobEngine OqrEngine { get; private set; }
public JobEngine OqrEngine { get; protected set; }
public LLUDPServer(
IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port,
@ -662,7 +661,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// If the outgoing UDP thread times out, then return client that was being processed to help with debugging.
/// </summary>
/// <returns></returns>
private string GetWatchdogIncomingAlarmData()
protected string GetWatchdogIncomingAlarmData()
{
return string.Format(
"Client is {0}",
@ -673,7 +672,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// If the outgoing UDP thread times out, then return client that was being processed to help with debugging.
/// </summary>
/// <returns></returns>
private string GetWatchdogOutgoingAlarmData()
protected string GetWatchdogOutgoingAlarmData()
{
return string.Format(
"Client is {0}",
@ -1237,7 +1236,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
}
private void RecordMalformedInboundPacket(IPEndPoint endPoint)
protected void RecordMalformedInboundPacket(IPEndPoint endPoint)
{
// if (m_malformedCount < 100)
// m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString());
@ -1666,7 +1665,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion BinaryStats
private void HandleUseCircuitCode(object o)
protected void HandleUseCircuitCode(object o)
{
IPEndPoint endPoint = null;
IClientAPI client = null;
@ -1775,7 +1774,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
/*
private void HandleCompleteMovementIntoRegion(object o)
protected void HandleCompleteMovementIntoRegion(object o)
{
IPEndPoint endPoint = null;
IClientAPI client = null;
@ -1895,7 +1894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </remarks>
/// <param name="remoteEndpoint"></param>
/// <param name="sequenceNumber"></param>
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
protected void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
{
PacketAckPacket ack = new PacketAckPacket();
ack.Header.Reliable = false;
@ -1919,7 +1918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AsyncBeginSend(buffer);
}
private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo)
protected bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo)
{
UUID agentID = useCircuitCode.CircuitCode.ID;
UUID sessionID = useCircuitCode.CircuitCode.SessionID;
@ -1989,7 +1988,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </remarks>
/// <param name='client'></param>
/// <param name='timeoutTicks'></param>
private void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks)
protected void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks)
{
lock (client.CloseSyncLock)
{
@ -2010,7 +2009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
client.Close(true,true);
}
private void IncomingPacketHandler()
protected void IncomingPacketHandler()
{
Thread.CurrentThread.Priority = ThreadPriority.Highest;
IncomingPacket incomingPacket;
@ -2052,7 +2051,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Watchdog.RemoveThread();
}
private void OutgoingPacketHandler()
protected void OutgoingPacketHandler()
{
Thread.CurrentThread.Priority = ThreadPriority.Highest;
@ -2181,27 +2180,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Emergency Monitoring
// Alternative packet handler fuull of instrumentation
// Handy for hunting bugs
private Stopwatch watch1 = new Stopwatch();
private Stopwatch watch2 = new Stopwatch();
protected Stopwatch watch1 = new Stopwatch();
protected Stopwatch watch2 = new Stopwatch();
private float avgProcessingTicks = 0;
private float avgResendUnackedTicks = 0;
private float avgSendAcksTicks = 0;
private float avgSendPingTicks = 0;
private float avgDequeueTicks = 0;
private long nticks = 0;
private long nticksUnack = 0;
private long nticksAck = 0;
private long nticksPing = 0;
private int npacksSent = 0;
private int npackNotSent = 0;
protected float avgProcessingTicks = 0;
protected float avgResendUnackedTicks = 0;
protected float avgSendAcksTicks = 0;
protected float avgSendPingTicks = 0;
protected float avgDequeueTicks = 0;
protected long nticks = 0;
protected long nticksUnack = 0;
protected long nticksAck = 0;
protected long nticksPing = 0;
protected int npacksSent = 0;
protected int npackNotSent = 0;
/// <summary>
/// Number of inbound packets processed since startup.
/// </summary>
public long IncomingPacketsProcessed { get; private set; }
public long IncomingPacketsProcessed { get; protected set; }
private void MonitoredClientOutgoingPacketHandler(IClientAPI client)
protected void MonitoredClientOutgoingPacketHandler(IClientAPI client)
{
nticks++;
watch1.Start();
@ -2296,7 +2295,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion
private void ProcessInPacket(IncomingPacket incomingPacket)
protected void ProcessInPacket(IncomingPacket incomingPacket)
{
Packet packet = incomingPacket.Packet;
LLClientView client = incomingPacket.Client;

View File

@ -45,18 +45,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const int DEBUG_CHANNEL = 2147483647;
protected const int DEBUG_CHANNEL = 2147483647;
private bool m_enabled = true;
private int m_saydistance = 20;
private int m_shoutdistance = 100;
private int m_whisperdistance = 10;
private List<Scene> m_scenes = new List<Scene>();
private List<string> FreezeCache = new List<string>();
private string m_adminPrefix = "";
internal object m_syncy = new object();
protected bool m_enabled = true;
protected int m_saydistance = 20;
protected int m_shoutdistance = 100;
protected int m_whisperdistance = 10;
protected List<Scene> m_scenes = new List<Scene>();
protected List<string> FreezeCache = new List<string>();
protected string m_adminPrefix = "";
protected object m_syncy = new object();
internal IConfig m_config;
protected IConfig m_config;
#region ISharedRegionModule Members
public virtual void Initialise(IConfigSource config)
@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
{
}
public Type ReplaceableInterface
public virtual Type ReplaceableInterface
{
get { return null; }
}
@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
client.OnChatFromClient += OnChatFromClient;
}
protected OSChatMessage FixPositionOfChatMessage(OSChatMessage c)
protected virtual OSChatMessage FixPositionOfChatMessage(OSChatMessage c)
{
ScenePresence avatar;
Scene scene = (Scene)c.Scene;
@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
}
static private Vector3 CenterOfRegion = new Vector3(128, 128, 30);
static protected Vector3 CenterOfRegion = new Vector3(128, 128, 30);
public virtual void OnChatBroadcast(Object sender, OSChatMessage c)
{
@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
}
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
public virtual void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
{
System.Threading.Timer Timer;
if (flags == 0)
@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
}
}
private void OnEndParcelFrozen(object avatar)
protected virtual void OnEndParcelFrozen(object avatar)
{
UUID target = (UUID)avatar;
FreezeCache.Remove(target.ToString());
@ -467,9 +467,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
}
#region SimulatorFeaturesRequest
static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange;
protected static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange;
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
protected virtual void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
{
OSD extras = new OSDMap();
if (features.ContainsKey("OpenSimExtras"))

View File

@ -45,22 +45,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private static readonly ILog m_log = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private Timer m_logTimer = new Timer(10000);
private List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
private string m_restUrl;
protected Timer m_logTimer = new Timer(10000);
protected List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
protected string m_restUrl;
/// <value>
/// Is this module enabled?
/// </value>
private bool m_enabled = false;
protected bool m_enabled = false;
private readonly List<Scene> m_scenes = new List<Scene>();
protected readonly List<Scene> m_scenes = new List<Scene>();
#region Region Module interface
private IMessageTransferModule m_TransferModule = null;
protected IMessageTransferModule m_TransferModule = null;
public void Initialise(IConfigSource config)
public virtual void Initialise(IConfigSource config)
{
if (config.Configs["Messaging"] != null)
{
@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
m_logTimer.Elapsed += LogTimerElapsed;
}
public void AddRegion(Scene scene)
public virtual void AddRegion(Scene scene)
{
if (!m_enabled)
return;
@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
public void RegionLoaded(Scene scene)
public virtual void RegionLoaded(Scene scene)
{
if (!m_enabled)
return;
@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
public void RemoveRegion(Scene scene)
public virtual void RemoveRegion(Scene scene)
{
if (!m_enabled)
return;
@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
void OnClientConnect(IClientCore client)
protected virtual void OnClientConnect(IClientCore client)
{
IClientIM clientIM;
if (client.TryGet(out clientIM))
@ -134,27 +134,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
public void PostInitialise()
public virtual void PostInitialise()
{
}
public void Close()
public virtual void Close()
{
}
public string Name
public virtual string Name
{
get { return "InstantMessageModule"; }
}
public Type ReplaceableInterface
public virtual Type ReplaceableInterface
{
get { return null; }
}
#endregion
public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
byte dialog = im.dialog;
@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
///
/// </summary>
/// <param name="msg"></param>
private void OnGridInstantMessage(GridInstantMessage msg)
protected virtual void OnGridInstantMessage(GridInstantMessage msg)
{
// Just call the Text IM handler above
// This event won't be raised unless we have that agent,
@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
OnInstantMessage(null, msg);
}
private void LogInstantMesssage(GridInstantMessage im)
protected virtual void LogInstantMesssage(GridInstantMessage im)
{
if (m_logData.Count < 20)
{
@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
private void LogTimerElapsed(object source, ElapsedEventArgs e)
protected virtual void LogTimerElapsed(object source, ElapsedEventArgs e)
{
lock (m_logData)
{