From f5f7ca47ea7a27fb7f82367cc7a4e04e11cb5155 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Oct 2011 21:31:22 +0100 Subject: Bring LindenUDP.Tests back from the dead. No tests are running. Code drift means that most of this stuff doesn't compile but the structure is still useful. --- .../Linden/UDP/Tests/TestLLUDPServer.cs | 79 ++++++++++++---------- 1 file changed, 44 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs index f98586d..dd7999a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs @@ -29,7 +29,9 @@ using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; +using Nini.Config; using OpenMetaverse.Packets; +using OpenSim.Framework; namespace OpenSim.Region.ClientStack.LindenUDP.Tests { @@ -39,42 +41,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// public class TestLLUDPServer : LLUDPServer { + public TestLLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) + : base(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager) + {} + /// /// The chunks of data to pass to the LLUDPServer when it calls EndReceive /// protected Queue m_chunksToLoad = new Queue(); - protected override void BeginReceive() - { - if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException) - { - ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); - reusedEpSender = tuple.Sender; - throw new SocketException(); - } - } +// protected override void BeginReceive() +// { +// if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException) +// { +// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); +// reusedEpSender = tuple.Sender; +// throw new SocketException(); +// } +// } - protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender) - { - numBytes = 0; - - //m_log.Debug("Queue size " + m_chunksToLoad.Count); - - if (m_chunksToLoad.Count <= 0) - return false; - - ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); - RecvBuffer = tuple.Data; - numBytes = tuple.Data.Length; - epSender = tuple.Sender; - - return true; - } +// protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender) +// { +// numBytes = 0; +// +// //m_log.Debug("Queue size " + m_chunksToLoad.Count); +// +// if (m_chunksToLoad.Count <= 0) +// return false; +// +// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); +// RecvBuffer = tuple.Data; +// numBytes = tuple.Data.Length; +// epSender = tuple.Sender; +// +// return true; +// } - public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) - { - // Don't do anything just yet - } +// public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) +// { +// // Don't do anything just yet +// } /// /// Signal that this chunk should throw an exception on Socket.BeginReceive() @@ -112,8 +118,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// public void ReceiveData(IAsyncResult result) { - while (m_chunksToLoad.Count > 0) - OnReceivedData(result); + // Doesn't work the same way anymore +// while (m_chunksToLoad.Count > 0) +// OnReceivedData(result); } /// @@ -123,10 +130,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// public bool HasCircuit(uint circuitCode) { - lock (clientCircuits_reverse) - { - return clientCircuits_reverse.ContainsKey(circuitCode); - } +// lock (clientCircuits_reverse) +// { +// return clientCircuits_reverse.ContainsKey(circuitCode); +// } + + return true; } } -- cgit v1.1