Formatting cleanup.

This commit is contained in:
Jeff Ames
2009-10-01 01:00:09 +09:00
parent 33515c75e4
commit ee205e7e81
223 changed files with 875 additions and 930 deletions

View File

@@ -87,9 +87,9 @@ namespace OpenSim.Region.ClientStack
public IClientNetworkServer CreateServer(
IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port,
AgentCircuitManager authenticateClass)
{
{
return CreateServer(
_listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass);
_listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass);
}
/// <summary>
@@ -104,11 +104,11 @@ namespace OpenSim.Region.ClientStack
/// </param>
/// <param name="assetCache"></param>
/// <param name="authenticateClass"></param>
/// <returns></returns>
/// <returns></returns>
public IClientNetworkServer CreateServer(
IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource,
AgentCircuitManager authenticateClass)
{
{
if (plugin != null)
{
IClientNetworkServer server =

View File

@@ -32,7 +32,7 @@ namespace OpenSim.Region.ClientStack
///
/// At the moment this is very incomplete - other tweakable settings could be added. This is also somewhat LL client
/// oriented right now.
/// </summary>
/// </summary>
public class ClientStackUserSettings
{
/// <summary>

View File

@@ -31,7 +31,7 @@ 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 bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// Take action depending on the type and contents of an received packet.
/// </summary>
/// <param name="item"></param>
/// <param name="item"></param>
void ProcessInPacket(LLQueItem item);
void ProcessOutPacket(LLQueItem item);

View File

@@ -127,7 +127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
m_asset = asset;
m_asset = asset;
}
RunUpdate();
}
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
try
{
Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize);
client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2);
client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2);
}
catch (Exception)
{

View File

@@ -2332,7 +2332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return itemBlock;
}
public void SendBulkUpdateInventory(InventoryNodeBase node)
public void SendBulkUpdateInventory(InventoryNodeBase node)
{
if (node is InventoryItemBase)
SendBulkUpdateInventoryItem((InventoryItemBase)node);
@@ -2937,7 +2937,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else if (m_avatarTerseUpdates.Count == 1)
{
lock (m_avatarTerseUpdateTimer)
m_avatarTerseUpdateTimer.Start();
m_avatarTerseUpdateTimer.Start();
}
}
}

View File

@@ -143,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TextureThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 4000, userSettings.ClientThrottleMultipler);
// Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second.
// Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second.
ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings;
@@ -410,7 +410,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
SendQueue.Enqueue(qpack);
TotalThrottle.AddBytes(qpack.Length);
ResendThrottle.AddBytes(qpack.Length);
@@ -470,7 +470,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
SendQueue.Enqueue(qpack);
TotalThrottle.AddBytes(qpack.Length);
TextureThrottle.AddBytes(qpack.Length);
qchanged = true;

View File

@@ -48,11 +48,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// Tweakable user settings
/// </summary>
private ClientStackUserSettings m_userSettings;
private ClientStackUserSettings m_userSettings;
public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings)
{
m_userSettings = userSettings;
m_userSettings = userSettings;
m_networkHandler = networkHandler;
m_networkHandler.RegisterPacketServer(this);
@@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="proxyEP"></param>
/// <returns>
/// true if a new circuit was created, false if a circuit with the given circuit code already existed
/// </returns>
/// </returns>
public virtual bool AddNewClient(
EndPoint epSender, UseCircuitCodePacket useCircuit,
AuthenticateResponse sessionInfo, EndPoint proxyEP)

View File

@@ -26,7 +26,7 @@
*/
namespace OpenSim.Region.ClientStack.LindenUDP
{
{
public class LLPacketThrottle
{
private readonly int m_maxAllowableThrottle;
@@ -105,13 +105,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public int Throttle
{
get { return m_currentThrottle; }
get { return m_currentThrottle; }
set
{
if (value < m_minAllowableThrottle)
{
m_currentThrottle = m_minAllowableThrottle;
}
}
else if (value > m_maxAllowableThrottle)
{
m_currentThrottle = m_maxAllowableThrottle;

View File

@@ -166,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier");
if (config.Contains("client_socket_rcvbuf_size"))
m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size");
}
}
m_log.DebugFormat("[CLIENT]: client_throttle_multiplier = {0}", userSettings.ClientThrottleMultipler);
m_log.DebugFormat("[CLIENT]: client_socket_rcvbuf_size = {0}", (m_clientSocketReceiveBuffer != 0 ?
@@ -228,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_log.Debug("[CLIENT]: " + e);
}
}
}
if (proxyPortOffset != 0)
@@ -254,7 +254,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet != null)
{
if (packet.Type == PacketType.UseCircuitCode)
AddNewClient((UseCircuitCodePacket)packet, epSender, epProxy);
AddNewClient((UseCircuitCodePacket)packet, epSender, epProxy);
else
ProcessInPacket(packet, epSender);
}
@@ -290,7 +290,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
catch (Exception e)
{
m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e);
}
}
}
/// <summary>
@@ -299,7 +299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected virtual void BeginReceive()
{
m_socket.BeginReceiveFrom(
RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null);
RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null);
}
/// <summary>
@@ -322,7 +322,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// ENDLESS LOOP ON PURPOSE!
// Reset connection and get next UDP packet off the buffer
// If the UDP packet is part of the same stream, this will happen several hundreds of times before
// the next set of UDP data is for a valid client.
// the next set of UDP data is for a valid client.
try
{
@@ -347,7 +347,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_log.ErrorFormat("[CLIENT]: Exception thrown during BeginReceive(): {0}", ex);
}
}
}
}
/// <summary>
/// Close a client circuit. This is done in response to an exception on receive, and should not be called
@@ -363,12 +363,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_packetServer.CloseCircuit(circuit);
if (e != null)
if (e != null)
m_log.ErrorFormat(
"[CLIENT]: Closed circuit {0} {1} due to exception {2}", circuit, reusedEpSender, e);
"[CLIENT]: Closed circuit {0} {1} due to exception {2}", circuit, reusedEpSender, e);
}
}
}
}
/// <summary>
/// Finish the process of asynchronously receiving the next bit of raw data
@@ -410,7 +410,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_log.DebugFormat("[CLIENT]: ObjectDisposedException: Object {0} disposed.", e.ObjectName);
// Uhh, what object, and why? this needs better handling.
}
}
return hasReceivedOkay;
}
@@ -422,10 +422,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="epSender"></param>
/// <param name="epProxy"></param>
protected virtual void AddNewClient(UseCircuitCodePacket useCircuit, EndPoint epSender, EndPoint epProxy)
{
{
//Slave regions don't accept new clients
if (m_localScene.RegionStatus != RegionStatus.SlaveScene)
{
{
AuthenticateResponse sessionInfo;
bool isNewCircuit = false;
@@ -441,8 +441,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
lock (clientCircuits)
{
if (!clientCircuits.ContainsKey(epSender))
{
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
{
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
isNewCircuit = true;
}
}
@@ -461,9 +461,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//m_log.DebugFormat(
// "[CONNECTION SUCCESS]: Incoming client {0} (circuit code {1}) received and authenticated for {2}",
// useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code, m_localScene.RegionInfo.RegionName);
}
}
// useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code, m_localScene.RegionInfo.RegionName);
}
}
// Ack the UseCircuitCode packet
PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
@@ -605,7 +605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code);
return;
}
}
lock (clientCircuits)
{

View File

@@ -28,7 +28,7 @@
using OpenMetaverse;
namespace OpenSim.Region.ClientStack.LindenUDP
{
{
public class LLUtil
{
/// <summary>

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
catch
{
// I don't care, just leave log4net off
}
}
}
/// <summary>
@@ -63,20 +63,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
/// <param name="scene"></param>
/// <param name="testLLUDPServer"></param>
/// <param name="testPacketServer"></param>
/// <param name="acm">Agent circuit manager used in setting up the stack</param>
/// <param name="acm">Agent circuit manager used in setting up the stack</param>
protected void SetupStack(
IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
out AgentCircuitManager acm)
{
IConfigSource configSource = new IniConfigSource();
ClientStackUserSettings userSettings = new ClientStackUserSettings();
testLLUDPServer = new TestLLUDPServer();
testLLUDPServer = new TestLLUDPServer();
acm = new AgentCircuitManager();
uint port = 666;
uint port = 666;
testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
testLLUDPServer.LocalScene = scene;
testLLUDPServer.LocalScene = scene;
}
/// <summary>
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
acm.AddNewCircuit(circuitCode, acd);
testLLUDPServer.LoadReceive(uccp, epSender);
testLLUDPServer.LoadReceive(uccp, epSender);
testLLUDPServer.ReceiveData(null);
}
@@ -142,15 +142,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb };
onp.Header.Zerocoded = false;
return onp;
return onp;
}
/// <summary>
/// Test adding a client to the stack
/// </summary>
[Test, LongRunning]
[Test, LongRunning]
public void TestAddClient()
{
{
TestHelper.InMethod();
uint myCircuitCode = 123456;
@@ -177,7 +177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
testLLUDPServer.LoadReceive(uccp, testEp);
testLLUDPServer.LoadReceive(uccp, testEp);
testLLUDPServer.ReceiveData(null);
// Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet
@@ -185,8 +185,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
acm.AddNewCircuit(myCircuitCode, acd);
testLLUDPServer.LoadReceive(uccp, testEp);
testLLUDPServer.ReceiveData(null);
testLLUDPServer.LoadReceive(uccp, testEp);
testLLUDPServer.ReceiveData(null);
// Should succeed now
Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
@@ -196,24 +196,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
/// <summary>
/// Test removing a client from the stack
/// </summary>
[Test]
[Test]
public void TestRemoveClient()
{
TestHelper.InMethod();
uint myCircuitCode = 123457;
uint myCircuitCode = 123457;
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
AgentCircuitManager acm;
SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm);
testLLUDPServer.RemoveClientCircuit(myCircuitCode);
testLLUDPServer.RemoveClientCircuit(myCircuitCode);
Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
// Check that removing a non-existant circuit doesn't have any bad effects
testLLUDPServer.RemoveClientCircuit(101);
testLLUDPServer.RemoveClientCircuit(101);
Assert.IsFalse(testLLUDPServer.HasCircuit(101));
}
@@ -232,7 +232,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
AgentCircuitManager acm;
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
AddClient(myCircuitCode, testEp, testLLUDPServer, acm);
byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 };
@@ -270,17 +270,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
uint circuitCodeA = 130000;
EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
uint circuitCodeB = 130001;
EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
AgentCircuitManager acm;
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
@@ -293,7 +293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA));
Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
}
Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
}
}
}

View File

@@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
[Test]
/// <summary>
/// More a placeholder, really
/// </summary>
/// </summary>
public void InPacketTest()
{
TestHelper.InMethod();
@@ -87,20 +87,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
/// <param name="scene"></param>
/// <param name="testLLUDPServer"></param>
/// <param name="testPacketServer"></param>
/// <param name="acm">Agent circuit manager used in setting up the stack</param>
/// <param name="acm">Agent circuit manager used in setting up the stack</param>
protected void SetupStack(
IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
out AgentCircuitManager acm)
{
IConfigSource configSource = new IniConfigSource();
ClientStackUserSettings userSettings = new ClientStackUserSettings();
testLLUDPServer = new TestLLUDPServer();
testLLUDPServer = new TestLLUDPServer();
acm = new AgentCircuitManager();
uint port = 666;
uint port = 666;
testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
testLLUDPServer.LocalScene = scene;
}
testLLUDPServer.LocalScene = scene;
}
}
}

View File

@@ -31,7 +31,7 @@ using OpenMetaverse.Packets;
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
public class TestLLPacketServer : LLPacketServer
{
{
/// <summary>
/// Record counts of packets received
/// </summary>
@@ -49,7 +49,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
m_packetsReceived[packet.Type]++;
else
m_packetsReceived[packet.Type] = 1;
}
}
public int GetTotalPacketsReceived()
{

View File

@@ -66,7 +66,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
RecvBuffer = tuple.Data;
numBytes = tuple.Data.Length;
epSender = tuple.Sender;
epSender = tuple.Sender;
return true;
}
@@ -114,7 +114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
while (m_chunksToLoad.Count > 0)
OnReceivedData(result);
}
}
/// <summary>
/// Has a circuit with the given code been established?
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
/// Record the data and sender tuple
/// </summary>
public class ChunkSenderTuple
{
{
public byte[] Data;
public EndPoint Sender;
public bool BeginReceiveException;

View File

@@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack
get { return m_commsManager; }
set { m_commsManager = value; }
}
protected CommunicationsManager m_commsManager;
protected CommunicationsManager m_commsManager;
protected StorageManager m_storageManager;
@@ -82,13 +82,13 @@ namespace OpenSim.Region.ClientStack
/// <param name="osSceneIdentifier">
/// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
/// </param>
/// <returns></returns>
/// <returns></returns>
protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
protected abstract StorageManager CreateStorageManager();
protected abstract ClientStackManager CreateClientStackManager();
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager);
AgentCircuitManager circuitManager);
protected override void StartupSpecific()
{

View File

@@ -26,12 +26,12 @@
*/
namespace OpenSim.Region.ClientStack
{
{
/// <summary>
/// Represent throttle settings for a client stack. These settings are in bytes per second
/// </summary>
public class ThrottleSettings
{
{
/// <summary>
/// Minimum bytes per second that the throttle can be set to.
/// </summary>
@@ -39,13 +39,13 @@ namespace OpenSim.Region.ClientStack
/// <summary>
/// Maximum bytes per second that the throttle can be set to.
/// </summary>
/// </summary>
public int Max;
/// <summary>
/// Current bytes per second that the throttle should be set to.
/// </summary>
public int Current;
/// </summary>
public int Current;
public ThrottleSettings(int min, int max, int current)
{