diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs index dd7afd3..002b493 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs | |||
@@ -48,7 +48,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
48 | 48 | ||
49 | protected override void BeginReceive() | 49 | protected override void BeginReceive() |
50 | { | 50 | { |
51 | // Do nothing | 51 | if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException) |
52 | { | ||
53 | ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); | ||
54 | reusedEpSender = tuple.Sender; | ||
55 | throw new SocketException(); | ||
56 | } | ||
52 | } | 57 | } |
53 | 58 | ||
54 | protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender) | 59 | protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender) |
@@ -72,6 +77,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
72 | } | 77 | } |
73 | 78 | ||
74 | /// <summary> | 79 | /// <summary> |
80 | /// Signal that this chunk should throw an exception on Socket.BeginReceive() | ||
81 | /// </summary> | ||
82 | /// <param name="epSender"></param> | ||
83 | public void LoadReceiveWithBeginException(EndPoint epSender) | ||
84 | { | ||
85 | ChunkSenderTuple tuple = new ChunkSenderTuple(epSender); | ||
86 | tuple.BeginReceiveException = true; | ||
87 | m_chunksToLoad.Enqueue(tuple); | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
75 | /// Load some data to be received by the LLUDPServer on the next receive call | 91 | /// Load some data to be received by the LLUDPServer on the next receive call |
76 | /// </summary> | 92 | /// </summary> |
77 | /// <param name="data"></param> | 93 | /// <param name="data"></param> |
@@ -118,14 +134,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
118 | /// Record the data and sender tuple | 134 | /// Record the data and sender tuple |
119 | /// </summary> | 135 | /// </summary> |
120 | public class ChunkSenderTuple | 136 | public class ChunkSenderTuple |
121 | { | 137 | { |
122 | public byte[] Data; | 138 | public byte[] Data; |
123 | public EndPoint Sender; | 139 | public EndPoint Sender; |
140 | public bool BeginReceiveException; | ||
124 | 141 | ||
125 | public ChunkSenderTuple(byte[] data, EndPoint sender) | 142 | public ChunkSenderTuple(byte[] data, EndPoint sender) |
126 | { | 143 | { |
127 | Data = data; | 144 | Data = data; |
128 | Sender = sender; | 145 | Sender = sender; |
129 | } | 146 | } |
147 | |||
148 | public ChunkSenderTuple(EndPoint sender) | ||
149 | { | ||
150 | Sender = sender; | ||
151 | } | ||
130 | } | 152 | } |
131 | } \ No newline at end of file | 153 | } \ No newline at end of file |