@@ -114,7 +114,7 @@ namespace LibreMetaverse.Voice
|
||||
{
|
||||
try
|
||||
{
|
||||
_Callback ??= OnDataReceived;
|
||||
if (_Callback == null) _Callback = new AsyncCallback(OnDataReceived);
|
||||
SocketPacket packet = new SocketPacket
|
||||
{
|
||||
TCPSocket = _TCPSocket
|
||||
|
||||
@@ -2361,7 +2361,10 @@ namespace OpenMetaverse
|
||||
|
||||
private void DelayedRequestSetAppearance()
|
||||
{
|
||||
RebakeScheduleTimer ??= new Timer(RebakeScheduleTimerTick);
|
||||
if (RebakeScheduleTimer == null)
|
||||
{
|
||||
RebakeScheduleTimer = new Timer(RebakeScheduleTimerTick);
|
||||
}
|
||||
try { RebakeScheduleTimer.Change(REBAKE_DELAY, Timeout.Infinite); }
|
||||
catch { }
|
||||
}
|
||||
|
||||
@@ -72,7 +72,10 @@ namespace OpenMetaverse.ImportExport
|
||||
try
|
||||
{
|
||||
// Create an instance of the XmlSerializer specifying type and namespace.
|
||||
Serializer ??= new XmlSerializer(typeof(COLLADA));
|
||||
if (Serializer == null)
|
||||
{
|
||||
Serializer = new XmlSerializer(typeof(COLLADA));
|
||||
}
|
||||
|
||||
this.FileName = filename;
|
||||
|
||||
|
||||
@@ -1330,20 +1330,33 @@ namespace OpenMetaverse
|
||||
|
||||
#region Sanity Check loginParams
|
||||
|
||||
loginParams.Options ??= new List<string>();
|
||||
loginParams.Password ??= string.Empty;
|
||||
if (loginParams.Options == null)
|
||||
loginParams.Options = new List<string>();
|
||||
|
||||
// *HACK: Convert the password to MD5 if it isn't already.
|
||||
// Don't worry. I hate this more than you do.
|
||||
if (loginParams.Password == null)
|
||||
loginParams.Password = string.Empty;
|
||||
|
||||
// *HACK: Convert the password to MD5 if it isn't already
|
||||
if (loginParams.Password.Length != 35 && !loginParams.Password.StartsWith("$1$"))
|
||||
loginParams.Password = Utils.MD5(loginParams.Password);
|
||||
|
||||
loginParams.ViewerDigest ??= string.Empty;
|
||||
loginParams.Version ??= string.Empty;
|
||||
loginParams.UserAgent ??= Settings.USER_AGENT;
|
||||
loginParams.Platform ??= string.Empty;
|
||||
loginParams.PlatformVersion ??= string.Empty;
|
||||
loginParams.MAC ??= string.Empty;
|
||||
if (loginParams.ViewerDigest == null)
|
||||
loginParams.ViewerDigest = string.Empty;
|
||||
|
||||
if (loginParams.Version == null)
|
||||
loginParams.Version = string.Empty;
|
||||
|
||||
if (loginParams.UserAgent == null)
|
||||
loginParams.UserAgent = Settings.USER_AGENT;
|
||||
|
||||
if (loginParams.Platform == null)
|
||||
loginParams.Platform = string.Empty;
|
||||
|
||||
if (loginParams.PlatformVersion == null)
|
||||
loginParams.PlatformVersion = string.Empty;
|
||||
|
||||
if (loginParams.MAC == null)
|
||||
loginParams.MAC = string.Empty;
|
||||
|
||||
if (string.IsNullOrEmpty(loginParams.Channel))
|
||||
{
|
||||
@@ -1371,7 +1384,10 @@ namespace OpenMetaverse
|
||||
}
|
||||
}
|
||||
|
||||
loginParams.Author ??= string.Empty;
|
||||
if (loginParams.Author == null)
|
||||
{
|
||||
loginParams.Author = string.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// TODO: Allow a user callback to be defined for handling the cert
|
||||
|
||||
@@ -36,7 +36,7 @@ using OpenMetaverse.Interfaces;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
|
||||
namespace OpenMetaverse
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// NetworkManager is responsible for managing the network layer of
|
||||
/// OpenMetaverse. It tracks all the server connections, serializes
|
||||
@@ -463,14 +463,14 @@ namespace OpenMetaverse
|
||||
{
|
||||
Logger.DebugLog("simulator object was null, using first found connected simulator", Client);
|
||||
simulator = Client.Network.Simulators[0];
|
||||
}
|
||||
}
|
||||
if (simulator != null)
|
||||
{
|
||||
simulator.SendPacket(packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("simulator", "SendPacket");
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("simulator", "SendPacket");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,34 +479,34 @@ namespace OpenMetaverse
|
||||
/// </summary>
|
||||
/// <param name="packet">Incoming packet to process</param>
|
||||
public void EnqueueIncoming(IncomingPacket packet)
|
||||
{
|
||||
if (_packetInbox != null)
|
||||
{
|
||||
if (_packetInbox.Writer.TryWrite(packet))
|
||||
Interlocked.Increment(ref _packetInboxCount);
|
||||
{
|
||||
if (_packetInbox != null)
|
||||
{
|
||||
if (_packetInbox.Writer.TryWrite(packet))
|
||||
Interlocked.Increment(ref _packetInboxCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetInbox", "EnqueueIncoming");
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetInbox", "EnqueueIncoming");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// adds a debug message when you try to access a network item
|
||||
/// while they are still null
|
||||
/// </summary>
|
||||
/// <param name="source">what</param>
|
||||
/// <param name="function">where</param>
|
||||
protected void NetworkInvaildWarning(string source,string function)
|
||||
{
|
||||
long now = DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||
long dif = lastpacketwarning - now;
|
||||
if (dif > 10)
|
||||
{
|
||||
lastpacketwarning = now;
|
||||
Logger.Log(source+" is null (Are we disconnected?) - from: "+ function,
|
||||
Helpers.LogLevel.Debug);
|
||||
}
|
||||
protected void NetworkInvaildWarning(string source,string function)
|
||||
{
|
||||
long now = DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||
long dif = lastpacketwarning - now;
|
||||
if (dif > 10)
|
||||
{
|
||||
lastpacketwarning = now;
|
||||
Logger.Log(source+" is null (Are we disconnected?) - from: "+ function,
|
||||
Helpers.LogLevel.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -515,14 +515,14 @@ namespace OpenMetaverse
|
||||
/// <param name="packet">Incoming packet to process</param>
|
||||
public void EnqueueOutgoing(OutgoingPacket packet)
|
||||
{
|
||||
if (_packetOutbox != null)
|
||||
{
|
||||
if (_packetOutbox.Writer.TryWrite(packet))
|
||||
if (_packetOutbox != null)
|
||||
{
|
||||
if (_packetOutbox.Writer.TryWrite(packet))
|
||||
Interlocked.Increment(ref _packetOutboxCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetOutbox", "EnqueueOutgoing");
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetOutbox", "EnqueueOutgoing");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,8 +607,12 @@ namespace OpenMetaverse
|
||||
// Attempt to establish a connection to the simulator
|
||||
if (simulator.Connect(setDefault))
|
||||
{
|
||||
DisconnectTimer ??= new Timer(DisconnectTimer_Elapsed, null,
|
||||
Client.Settings.SIMULATOR_TIMEOUT, Client.Settings.SIMULATOR_TIMEOUT);
|
||||
if (DisconnectTimer == null)
|
||||
{
|
||||
// Start a timer that checks if we've been disconnected
|
||||
DisconnectTimer = new Timer(DisconnectTimer_Elapsed, null,
|
||||
Client.Settings.SIMULATOR_TIMEOUT, Client.Settings.SIMULATOR_TIMEOUT);
|
||||
}
|
||||
|
||||
if (setDefault)
|
||||
{
|
||||
@@ -785,9 +789,9 @@ namespace OpenMetaverse
|
||||
|
||||
if (simulatorsCount == 0) Shutdown(DisconnectType.SimShutdown);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("simulator", "DisconnectSim");
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("simulator", "DisconnectSim");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -909,73 +913,73 @@ namespace OpenMetaverse
|
||||
|
||||
private async Task OutgoingPacketHandler()
|
||||
{
|
||||
if (_packetOutbox != null)
|
||||
{
|
||||
var reader = _packetOutbox.Reader;
|
||||
|
||||
// FIXME: This is kind of ridiculous. Port the HTB code from Simian over ASAP!
|
||||
var stopwatch = new System.Diagnostics.Stopwatch();
|
||||
|
||||
while (await reader.WaitToReadAsync() && Connected)
|
||||
{
|
||||
while (reader.TryRead(out var outgoingPacket))
|
||||
{
|
||||
Interlocked.Decrement(ref _packetOutboxCount);
|
||||
|
||||
var simulator = outgoingPacket.Simulator;
|
||||
|
||||
stopwatch.Stop();
|
||||
if (stopwatch.ElapsedMilliseconds < 10)
|
||||
{
|
||||
//Logger.DebugLog(String.Format("Rate limiting, last packet was {0}ms ago", ms));
|
||||
Thread.Sleep(10 - (int)stopwatch.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
simulator.SendPacketFinal(outgoingPacket);
|
||||
stopwatch.Start();
|
||||
}
|
||||
if (_packetOutbox != null)
|
||||
{
|
||||
var reader = _packetOutbox.Reader;
|
||||
|
||||
// FIXME: This is kind of ridiculous. Port the HTB code from Simian over ASAP!
|
||||
var stopwatch = new System.Diagnostics.Stopwatch();
|
||||
|
||||
while (await reader.WaitToReadAsync() && Connected)
|
||||
{
|
||||
while (reader.TryRead(out var outgoingPacket))
|
||||
{
|
||||
Interlocked.Decrement(ref _packetOutboxCount);
|
||||
|
||||
var simulator = outgoingPacket.Simulator;
|
||||
|
||||
stopwatch.Stop();
|
||||
if (stopwatch.ElapsedMilliseconds < 10)
|
||||
{
|
||||
//Logger.DebugLog(String.Format("Rate limiting, last packet was {0}ms ago", ms));
|
||||
Thread.Sleep(10 - (int)stopwatch.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
simulator.SendPacketFinal(outgoingPacket);
|
||||
stopwatch.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetOutbox", "OutgoingPacketHandler");
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetOutbox", "OutgoingPacketHandler");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async Task IncomingPacketHandler()
|
||||
{
|
||||
if (_packetInbox != null)
|
||||
{
|
||||
var reader = _packetInbox.Reader;
|
||||
|
||||
while (await reader.WaitToReadAsync() && Connected)
|
||||
{
|
||||
while (reader.TryRead(out var incomingPacket))
|
||||
{
|
||||
Interlocked.Decrement(ref _packetInboxCount);
|
||||
|
||||
var packet = incomingPacket.Packet;
|
||||
var simulator = incomingPacket.Simulator;
|
||||
|
||||
if (packet == null) continue;
|
||||
|
||||
// Skip blacklisted packets
|
||||
if (UDPBlacklist.Contains(packet.Type.ToString()))
|
||||
{
|
||||
Logger.Log($"Discarding Blacklisted packet {packet.Type} from {simulator.IPEndPoint}",
|
||||
Helpers.LogLevel.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fire the callback(s), if any
|
||||
PacketEvents.RaiseEvent(packet.Type, packet, simulator);
|
||||
}
|
||||
if (_packetInbox != null)
|
||||
{
|
||||
var reader = _packetInbox.Reader;
|
||||
|
||||
while (await reader.WaitToReadAsync() && Connected)
|
||||
{
|
||||
while (reader.TryRead(out var incomingPacket))
|
||||
{
|
||||
Interlocked.Decrement(ref _packetInboxCount);
|
||||
|
||||
var packet = incomingPacket.Packet;
|
||||
var simulator = incomingPacket.Simulator;
|
||||
|
||||
if (packet == null) continue;
|
||||
|
||||
// Skip blacklisted packets
|
||||
if (UDPBlacklist.Contains(packet.Type.ToString()))
|
||||
{
|
||||
Logger.Log($"Discarding Blacklisted packet {packet.Type} from {simulator.IPEndPoint}",
|
||||
Helpers.LogLevel.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fire the callback(s), if any
|
||||
PacketEvents.RaiseEvent(packet.Type, packet, simulator);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetInbox", "IncomingPacketHandler");
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkInvaildWarning("_packetInbox", "IncomingPacketHandler");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2853,7 +2853,8 @@ namespace OpenMetaverse
|
||||
{
|
||||
if (simulator.ObjectsPrimitives.Dictionary.ContainsKey(findPrim.LocalID))
|
||||
{
|
||||
simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties ??= new Primitive.ObjectProperties();
|
||||
if (simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties == null)
|
||||
simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties = new Primitive.ObjectProperties();
|
||||
simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties.SetFamilyProperties(props);
|
||||
}
|
||||
}
|
||||
@@ -2888,7 +2889,7 @@ namespace OpenMetaverse
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a great place for a summary. Good job, dummy.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="capsKey"></param>
|
||||
/// <param name="message"></param>
|
||||
|
||||
@@ -294,7 +294,8 @@ namespace OpenMetaverse.Rendering
|
||||
Skeleton = skeleton;
|
||||
LodMeshes = new SortedList<int, object>();
|
||||
|
||||
Skeleton ??= LindenSkeleton.Load();
|
||||
if (Skeleton == null)
|
||||
Skeleton = LindenSkeleton.Load();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -67,7 +67,8 @@ namespace OpenMetaverse.Rendering
|
||||
/// <returns>A valid recursive skeleton</returns>
|
||||
public static LindenSkeleton Load(string fileName)
|
||||
{
|
||||
fileName ??= System.IO.Path.Combine(Settings.RESOURCE_DIR, "avatar_skeleton.xml");
|
||||
if (fileName == null)
|
||||
fileName = System.IO.Path.Combine(Settings.RESOURCE_DIR, "avatar_skeleton.xml");
|
||||
|
||||
LindenSkeleton result;
|
||||
|
||||
|
||||
@@ -587,11 +587,13 @@ namespace OpenMetaverse
|
||||
|
||||
#region Start Timers
|
||||
|
||||
// Timer for sending out queued packet acknowledgments
|
||||
AckTimer ??= new Timer(AckTimer_Elapsed, null, Settings.NETWORK_TICK_INTERVAL, Timeout.Infinite);
|
||||
// Timer for sending out queued packet acknowledgements
|
||||
if (AckTimer == null)
|
||||
AckTimer = new Timer(AckTimer_Elapsed, null, Settings.NETWORK_TICK_INTERVAL, Timeout.Infinite);
|
||||
|
||||
// Timer for recording simulator connection statistics
|
||||
StatsTimer ??= new Timer(StatsTimer_Elapsed, null, 1000, 1000);
|
||||
if (StatsTimer == null)
|
||||
StatsTimer = new Timer(StatsTimer_Elapsed, null, 1000, 1000);
|
||||
|
||||
// Timer for periodically pinging the simulator
|
||||
if (PingTimer == null && Client.Settings.SEND_PINGS)
|
||||
@@ -1392,7 +1394,10 @@ namespace OpenMetaverse
|
||||
{
|
||||
lock (SimulatorDataPools)
|
||||
{
|
||||
InactiveSimReaper ??= new Timer(RemoveOldSims, null, TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3));
|
||||
if (InactiveSimReaper == null)
|
||||
{
|
||||
InactiveSimReaper = new Timer(RemoveOldSims, null, TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3));
|
||||
}
|
||||
var pool = GetSimulatorData(sim.Handle);
|
||||
if (pool.ActiveClients < 1) pool.ActiveClients = 1; else pool.ActiveClients++;
|
||||
pool.InactiveSince = DateTime.MaxValue;
|
||||
|
||||
@@ -174,11 +174,15 @@ namespace OpenMetaverse
|
||||
if (_Running)
|
||||
return;
|
||||
|
||||
downloadMaster ??= new Thread(DownloadThread)
|
||||
if (downloadMaster == null)
|
||||
{
|
||||
Name = "TexturePipeline",
|
||||
IsBackground = true
|
||||
};
|
||||
// Instantiate master thread that manages the request pool
|
||||
downloadMaster = new Thread(DownloadThread)
|
||||
{
|
||||
Name = "TexturePipeline",
|
||||
IsBackground = true
|
||||
};
|
||||
}
|
||||
|
||||
_Running = true;
|
||||
|
||||
|
||||
@@ -50,7 +50,10 @@ namespace GridProxy
|
||||
//bool externalPlugin = false;
|
||||
this.Args = args;
|
||||
|
||||
proxyConfig ??= new ProxyConfig("GridProxy", "Austin Jennings / Andrew Ortman", args, true);
|
||||
if (proxyConfig == null)
|
||||
{
|
||||
proxyConfig = new ProxyConfig("GridProxy", "Austin Jennings / Andrew Ortman", args, true);
|
||||
}
|
||||
proxy = new Proxy(proxyConfig);
|
||||
|
||||
// add delegates for login
|
||||
|
||||
Reference in New Issue
Block a user