aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs170
1 files changed, 0 insertions, 170 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
deleted file mode 100644
index 27b9e5b..0000000
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
+++ /dev/null
@@ -1,170 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Net.Sockets;
32using Nini.Config;
33using OpenMetaverse.Packets;
34using OpenSim.Framework;
35
36namespace OpenSim.Region.ClientStack.LindenUDP.Tests
37{
38 /// <summary>
39 /// This class enables regression testing of the LLUDPServer by allowing us to intercept outgoing data.
40 /// </summary>
41 public class TestLLUDPServer : LLUDPServer
42 {
43 public List<Packet> PacketsSent { get; private set; }
44
45 public TestLLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
46 : base(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager)
47 {
48 PacketsSent = new List<Packet>();
49 }
50
51 public override void SendAckImmediate(IPEndPoint remoteEndpoint, PacketAckPacket ack)
52 {
53 PacketsSent.Add(ack);
54 }
55
56 public override void SendPacket(
57 LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method)
58 {
59 PacketsSent.Add(packet);
60 }
61
62 public void ClientOutgoingPacketHandler(IClientAPI client, bool resendUnacked, bool sendAcks, bool sendPing)
63 {
64 m_resendUnacked = resendUnacked;
65 m_sendAcks = sendAcks;
66 m_sendPing = sendPing;
67
68 ClientOutgoingPacketHandler(client);
69 }
70
71//// /// <summary>
72//// /// The chunks of data to pass to the LLUDPServer when it calls EndReceive
73//// /// </summary>
74//// protected Queue<ChunkSenderTuple> m_chunksToLoad = new Queue<ChunkSenderTuple>();
75//
76//// protected override void BeginReceive()
77//// {
78//// if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException)
79//// {
80//// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
81//// reusedEpSender = tuple.Sender;
82//// throw new SocketException();
83//// }
84//// }
85//
86//// protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender)
87//// {
88//// numBytes = 0;
89////
90//// //m_log.Debug("Queue size " + m_chunksToLoad.Count);
91////
92//// if (m_chunksToLoad.Count <= 0)
93//// return false;
94////
95//// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
96//// RecvBuffer = tuple.Data;
97//// numBytes = tuple.Data.Length;
98//// epSender = tuple.Sender;
99////
100//// return true;
101//// }
102//
103//// public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
104//// {
105//// // Don't do anything just yet
106//// }
107//
108// /// <summary>
109// /// Signal that this chunk should throw an exception on Socket.BeginReceive()
110// /// </summary>
111// /// <param name="epSender"></param>
112// public void LoadReceiveWithBeginException(EndPoint epSender)
113// {
114// ChunkSenderTuple tuple = new ChunkSenderTuple(epSender);
115// tuple.BeginReceiveException = true;
116// m_chunksToLoad.Enqueue(tuple);
117// }
118//
119// /// <summary>
120// /// Load some data to be received by the LLUDPServer on the next receive call
121// /// </summary>
122// /// <param name="data"></param>
123// /// <param name="epSender"></param>
124// public void LoadReceive(byte[] data, EndPoint epSender)
125// {
126// m_chunksToLoad.Enqueue(new ChunkSenderTuple(data, epSender));
127// }
128//
129// /// <summary>
130// /// Load a packet to be received by the LLUDPServer on the next receive call
131// /// </summary>
132// /// <param name="packet"></param>
133// public void LoadReceive(Packet packet, EndPoint epSender)
134// {
135// LoadReceive(packet.ToBytes(), epSender);
136// }
137//
138// /// <summary>
139// /// Calls the protected asynchronous result method. This fires out all data chunks currently queued for send
140// /// </summary>
141// /// <param name="result"></param>
142// public void ReceiveData(IAsyncResult result)
143// {
144// // Doesn't work the same way anymore
145//// while (m_chunksToLoad.Count > 0)
146//// OnReceivedData(result);
147// }
148 }
149
150 /// <summary>
151 /// Record the data and sender tuple
152 /// </summary>
153 public class ChunkSenderTuple
154 {
155 public byte[] Data;
156 public EndPoint Sender;
157 public bool BeginReceiveException;
158
159 public ChunkSenderTuple(byte[] data, EndPoint sender)
160 {
161 Data = data;
162 Sender = sender;
163 }
164
165 public ChunkSenderTuple(EndPoint sender)
166 {
167 Sender = sender;
168 }
169 }
170}