diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
4 files changed, 133 insertions, 133 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index 90b3ede..1b8535c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | |||
@@ -39,7 +39,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
39 | public sealed class IncomingPacket | 39 | public sealed class IncomingPacket |
40 | { | 40 | { |
41 | /// <summary>Client this packet came from</summary> | 41 | /// <summary>Client this packet came from</summary> |
42 | public LLUDPClient Client; | 42 | public LLClientView Client; |
43 | |||
43 | /// <summary>Packet data that has been received</summary> | 44 | /// <summary>Packet data that has been received</summary> |
44 | public Packet Packet; | 45 | public Packet Packet; |
45 | 46 | ||
@@ -48,7 +49,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
48 | /// </summary> | 49 | /// </summary> |
49 | /// <param name="client">Reference to the client this packet came from</param> | 50 | /// <param name="client">Reference to the client this packet came from</param> |
50 | /// <param name="packet">Packet data</param> | 51 | /// <param name="packet">Packet data</param> |
51 | public IncomingPacket(LLUDPClient client, Packet packet) | 52 | public IncomingPacket(LLClientView client, Packet packet) |
52 | { | 53 | { |
53 | Client = client; | 54 | Client = client; |
54 | Packet = packet; | 55 | Packet = packet; |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3bdde3b..3c23dcf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -147,11 +147,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
147 | private int m_elapsed500MSOutgoingPacketHandler; | 147 | private int m_elapsed500MSOutgoingPacketHandler; |
148 | 148 | ||
149 | /// <summary>Flag to signal when clients should check for resends</summary> | 149 | /// <summary>Flag to signal when clients should check for resends</summary> |
150 | private bool m_resendUnacked; | 150 | protected bool m_resendUnacked; |
151 | |||
151 | /// <summary>Flag to signal when clients should send ACKs</summary> | 152 | /// <summary>Flag to signal when clients should send ACKs</summary> |
152 | private bool m_sendAcks; | 153 | protected bool m_sendAcks; |
154 | |||
153 | /// <summary>Flag to signal when clients should send pings</summary> | 155 | /// <summary>Flag to signal when clients should send pings</summary> |
154 | private bool m_sendPing; | 156 | protected bool m_sendPing; |
155 | 157 | ||
156 | private int m_defaultRTO = 0; | 158 | private int m_defaultRTO = 0; |
157 | private int m_maxRTO = 0; | 159 | private int m_maxRTO = 0; |
@@ -537,8 +539,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
537 | SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false, null); | 539 | SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false, null); |
538 | } | 540 | } |
539 | 541 | ||
540 | public void HandleUnacked(LLUDPClient udpClient) | 542 | public void HandleUnacked(LLClientView client) |
541 | { | 543 | { |
544 | LLUDPClient udpClient = client.UDPClient; | ||
545 | |||
542 | if (!udpClient.IsConnected) | 546 | if (!udpClient.IsConnected) |
543 | return; | 547 | return; |
544 | 548 | ||
@@ -551,12 +555,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
551 | if (udpClient.IsPaused) | 555 | if (udpClient.IsPaused) |
552 | timeoutTicks = m_pausedAckTimeout; | 556 | timeoutTicks = m_pausedAckTimeout; |
553 | 557 | ||
554 | if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) | 558 | if (!client.IsLoggingOut && |
559 | (Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) | ||
555 | { | 560 | { |
556 | m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); | 561 | m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); |
557 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | 562 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); |
563 | RemoveClient(client); | ||
558 | 564 | ||
559 | RemoveClient(udpClient); | ||
560 | return; | 565 | return; |
561 | } | 566 | } |
562 | 567 | ||
@@ -879,7 +884,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
879 | #endregion Ping Check Handling | 884 | #endregion Ping Check Handling |
880 | 885 | ||
881 | // Inbox insertion | 886 | // Inbox insertion |
882 | packetInbox.Enqueue(new IncomingPacket(udpClient, packet)); | 887 | packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); |
883 | } | 888 | } |
884 | 889 | ||
885 | #region BinaryStats | 890 | #region BinaryStats |
@@ -1105,21 +1110,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1105 | return client; | 1110 | return client; |
1106 | } | 1111 | } |
1107 | 1112 | ||
1108 | private void RemoveClient(LLUDPClient udpClient) | 1113 | private void RemoveClient(IClientAPI client) |
1109 | { | 1114 | { |
1110 | // Remove this client from the scene | 1115 | client.IsLoggingOut = true; |
1111 | IClientAPI client; | 1116 | Util.FireAndForget(o => client.Close()); |
1112 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) | ||
1113 | { | ||
1114 | client.IsLoggingOut = true; | ||
1115 | client.Close(false); | ||
1116 | } | ||
1117 | else | ||
1118 | { | ||
1119 | m_log.WarnFormat( | ||
1120 | "[LLUDPSERVER]: Tried to remove client with id {0} but not such client in {1}", | ||
1121 | udpClient.AgentID, m_scene.RegionInfo.RegionName); | ||
1122 | } | ||
1123 | } | 1117 | } |
1124 | 1118 | ||
1125 | private void IncomingPacketHandler() | 1119 | private void IncomingPacketHandler() |
@@ -1246,7 +1240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1246 | Watchdog.RemoveThread(); | 1240 | Watchdog.RemoveThread(); |
1247 | } | 1241 | } |
1248 | 1242 | ||
1249 | private void ClientOutgoingPacketHandler(IClientAPI client) | 1243 | protected void ClientOutgoingPacketHandler(IClientAPI client) |
1250 | { | 1244 | { |
1251 | m_currentOutgoingClient = client; | 1245 | m_currentOutgoingClient = client; |
1252 | 1246 | ||
@@ -1254,12 +1248,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1254 | { | 1248 | { |
1255 | if (client is LLClientView) | 1249 | if (client is LLClientView) |
1256 | { | 1250 | { |
1257 | LLUDPClient udpClient = ((LLClientView)client).UDPClient; | 1251 | LLClientView llClient = (LLClientView)client; |
1252 | LLUDPClient udpClient = llClient.UDPClient; | ||
1258 | 1253 | ||
1259 | if (udpClient.IsConnected) | 1254 | if (udpClient.IsConnected) |
1260 | { | 1255 | { |
1261 | if (m_resendUnacked) | 1256 | if (m_resendUnacked) |
1262 | HandleUnacked(udpClient); | 1257 | HandleUnacked(llClient); |
1263 | 1258 | ||
1264 | if (m_sendAcks) | 1259 | if (m_sendAcks) |
1265 | SendAcks(udpClient); | 1260 | SendAcks(udpClient); |
@@ -1308,7 +1303,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1308 | { | 1303 | { |
1309 | if (client is LLClientView) | 1304 | if (client is LLClientView) |
1310 | { | 1305 | { |
1311 | LLUDPClient udpClient = ((LLClientView)client).UDPClient; | 1306 | LLClientView llClient = (LLClientView)client; |
1307 | LLUDPClient udpClient = llClient.UDPClient; | ||
1312 | 1308 | ||
1313 | if (udpClient.IsConnected) | 1309 | if (udpClient.IsConnected) |
1314 | { | 1310 | { |
@@ -1317,7 +1313,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1317 | nticksUnack++; | 1313 | nticksUnack++; |
1318 | watch2.Start(); | 1314 | watch2.Start(); |
1319 | 1315 | ||
1320 | HandleUnacked(udpClient); | 1316 | HandleUnacked(llClient); |
1321 | 1317 | ||
1322 | watch2.Stop(); | 1318 | watch2.Stop(); |
1323 | avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); | 1319 | avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); |
@@ -1388,22 +1384,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1388 | 1384 | ||
1389 | #endregion | 1385 | #endregion |
1390 | 1386 | ||
1391 | private void ProcessInPacket(object state) | 1387 | private void ProcessInPacket(IncomingPacket incomingPacket) |
1392 | { | 1388 | { |
1393 | IncomingPacket incomingPacket = (IncomingPacket)state; | ||
1394 | Packet packet = incomingPacket.Packet; | 1389 | Packet packet = incomingPacket.Packet; |
1395 | LLUDPClient udpClient = incomingPacket.Client; | 1390 | LLClientView client = incomingPacket.Client; |
1396 | IClientAPI client; | ||
1397 | 1391 | ||
1398 | // Sanity check | 1392 | if (client.IsActive) |
1399 | if (packet == null || udpClient == null) | ||
1400 | { | ||
1401 | m_log.WarnFormat("[LLUDPSERVER]: Processing a packet with incomplete state. Packet=\"{0}\", UDPClient=\"{1}\"", | ||
1402 | packet, udpClient); | ||
1403 | } | ||
1404 | |||
1405 | // Make sure this client is still alive | ||
1406 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) | ||
1407 | { | 1393 | { |
1408 | m_currentIncomingClient = client; | 1394 | m_currentIncomingClient = client; |
1409 | 1395 | ||
@@ -1421,8 +1407,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1421 | catch (Exception e) | 1407 | catch (Exception e) |
1422 | { | 1408 | { |
1423 | // Don't let a failure in an individual client thread crash the whole sim. | 1409 | // Don't let a failure in an individual client thread crash the whole sim. |
1424 | m_log.ErrorFormat("[LLUDPSERVER]: Client packet handler for {0} for packet {1} threw an exception", udpClient.AgentID, packet.Type); | 1410 | m_log.Error( |
1425 | m_log.Error(e.Message, e); | 1411 | string.Format( |
1412 | "[LLUDPSERVER]: Client packet handler for {0} for packet {1} threw ", | ||
1413 | client.Name, packet.Type), | ||
1414 | e); | ||
1426 | } | 1415 | } |
1427 | finally | 1416 | finally |
1428 | { | 1417 | { |
@@ -1433,15 +1422,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1433 | { | 1422 | { |
1434 | m_log.DebugFormat( | 1423 | m_log.DebugFormat( |
1435 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", | 1424 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", |
1436 | packet.Type, udpClient.AgentID, m_scene.RegionInfo.RegionName); | 1425 | packet.Type, client.Name, m_scene.RegionInfo.RegionName); |
1437 | } | 1426 | } |
1438 | } | 1427 | } |
1439 | 1428 | ||
1440 | protected void LogoutHandler(IClientAPI client) | 1429 | protected void LogoutHandler(IClientAPI client) |
1441 | { | 1430 | { |
1442 | client.SendLogoutPacket(); | 1431 | client.SendLogoutPacket(); |
1443 | if (client.IsActive) | 1432 | if (!client.IsLoggingOut) |
1444 | RemoveClient(((LLClientView)client).UDPClient); | 1433 | RemoveClient(client); |
1445 | } | 1434 | } |
1446 | } | 1435 | } |
1447 | } | 1436 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index 1321470..109a8e1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs | |||
@@ -45,6 +45,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class BasicCircuitTests | 46 | public class BasicCircuitTests |
47 | { | 47 | { |
48 | private Scene m_scene; | ||
49 | private TestLLUDPServer m_udpServer; | ||
50 | |||
48 | [TestFixtureSetUp] | 51 | [TestFixtureSetUp] |
49 | public void FixtureInit() | 52 | public void FixtureInit() |
50 | { | 53 | { |
@@ -61,83 +64,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
61 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | 64 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; |
62 | } | 65 | } |
63 | 66 | ||
64 | // /// <summary> | 67 | [SetUp] |
65 | // /// Add a client for testing | 68 | public void SetUp() |
66 | // /// </summary> | 69 | { |
67 | // /// <param name="scene"></param> | 70 | m_scene = new SceneHelpers().SetupScene(); |
68 | // /// <param name="testLLUDPServer"></param> | 71 | } |
69 | // /// <param name="testPacketServer"></param> | ||
70 | // /// <param name="acm">Agent circuit manager used in setting up the stack</param> | ||
71 | // protected void SetupStack( | ||
72 | // IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, | ||
73 | // out AgentCircuitManager acm) | ||
74 | // { | ||
75 | // IConfigSource configSource = new IniConfigSource(); | ||
76 | // ClientStackUserSettings userSettings = new ClientStackUserSettings(); | ||
77 | // testLLUDPServer = new TestLLUDPServer(); | ||
78 | // acm = new AgentCircuitManager(); | ||
79 | // | ||
80 | // uint port = 666; | ||
81 | // testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); | ||
82 | // testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); | ||
83 | // testLLUDPServer.LocalScene = scene; | ||
84 | // } | ||
85 | |||
86 | // /// <summary> | ||
87 | // /// Set up a client for tests which aren't concerned with this process itself and where only one client is being | ||
88 | // /// tested | ||
89 | // /// </summary> | ||
90 | // /// <param name="circuitCode"></param> | ||
91 | // /// <param name="epSender"></param> | ||
92 | // /// <param name="testLLUDPServer"></param> | ||
93 | // /// <param name="acm"></param> | ||
94 | // protected void AddClient( | ||
95 | // uint circuitCode, EndPoint epSender, TestLLUDPServer testLLUDPServer, AgentCircuitManager acm) | ||
96 | // { | ||
97 | // UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
98 | // UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); | ||
99 | // | ||
100 | // AddClient(circuitCode, epSender, myAgentUuid, mySessionUuid, testLLUDPServer, acm); | ||
101 | // } | ||
102 | |||
103 | // /// <summary> | ||
104 | // /// Set up a client for tests which aren't concerned with this process itself | ||
105 | // /// </summary> | ||
106 | // /// <param name="circuitCode"></param> | ||
107 | // /// <param name="epSender"></param> | ||
108 | // /// <param name="agentId"></param> | ||
109 | // /// <param name="sessionId"></param> | ||
110 | // /// <param name="testLLUDPServer"></param> | ||
111 | // /// <param name="acm"></param> | ||
112 | // protected void AddClient( | ||
113 | // uint circuitCode, EndPoint epSender, UUID agentId, UUID sessionId, | ||
114 | // TestLLUDPServer testLLUDPServer, AgentCircuitManager acm) | ||
115 | // { | ||
116 | // AgentCircuitData acd = new AgentCircuitData(); | ||
117 | // acd.AgentID = agentId; | ||
118 | // acd.SessionID = sessionId; | ||
119 | // | ||
120 | // UseCircuitCodePacket uccp = new UseCircuitCodePacket(); | ||
121 | // | ||
122 | // UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock | ||
123 | // = new UseCircuitCodePacket.CircuitCodeBlock(); | ||
124 | // uccpCcBlock.Code = circuitCode; | ||
125 | // uccpCcBlock.ID = agentId; | ||
126 | // uccpCcBlock.SessionID = sessionId; | ||
127 | // uccp.CircuitCode = uccpCcBlock; | ||
128 | // | ||
129 | // acm.AddNewCircuit(circuitCode, acd); | ||
130 | // | ||
131 | // testLLUDPServer.LoadReceive(uccp, epSender); | ||
132 | // testLLUDPServer.ReceiveData(null); | ||
133 | // } | ||
134 | 72 | ||
135 | /// <summary> | 73 | /// <summary> |
136 | /// Build an object name packet for test purposes | 74 | /// Build an object name packet for test purposes |
137 | /// </summary> | 75 | /// </summary> |
138 | /// <param name="objectLocalId"></param> | 76 | /// <param name="objectLocalId"></param> |
139 | /// <param name="objectName"></param> | 77 | /// <param name="objectName"></param> |
140 | protected ObjectNamePacket BuildTestObjectNamePacket(uint objectLocalId, string objectName) | 78 | private ObjectNamePacket BuildTestObjectNamePacket(uint objectLocalId, string objectName) |
141 | { | 79 | { |
142 | ObjectNamePacket onp = new ObjectNamePacket(); | 80 | ObjectNamePacket onp = new ObjectNamePacket(); |
143 | ObjectNamePacket.ObjectDataBlock odb = new ObjectNamePacket.ObjectDataBlock(); | 81 | ObjectNamePacket.ObjectDataBlock odb = new ObjectNamePacket.ObjectDataBlock(); |
@@ -148,6 +86,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
148 | 86 | ||
149 | return onp; | 87 | return onp; |
150 | } | 88 | } |
89 | |||
90 | private void AddUdpServer() | ||
91 | { | ||
92 | AddUdpServer(new IniConfigSource()); | ||
93 | } | ||
94 | |||
95 | private void AddUdpServer(IniConfigSource configSource) | ||
96 | { | ||
97 | uint port = 0; | ||
98 | AgentCircuitManager acm = m_scene.AuthenticateHandler; | ||
99 | |||
100 | m_udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, false, configSource, acm); | ||
101 | m_udpServer.AddScene(m_scene); | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Used by tests that aren't testing this stage. | ||
106 | /// </summary> | ||
107 | private ScenePresence AddClient() | ||
108 | { | ||
109 | UUID myAgentUuid = TestHelpers.ParseTail(0x1); | ||
110 | UUID mySessionUuid = TestHelpers.ParseTail(0x2); | ||
111 | uint myCircuitCode = 123456; | ||
112 | IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); | ||
113 | |||
114 | UseCircuitCodePacket uccp = new UseCircuitCodePacket(); | ||
115 | |||
116 | UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock | ||
117 | = new UseCircuitCodePacket.CircuitCodeBlock(); | ||
118 | uccpCcBlock.Code = myCircuitCode; | ||
119 | uccpCcBlock.ID = myAgentUuid; | ||
120 | uccpCcBlock.SessionID = mySessionUuid; | ||
121 | uccp.CircuitCode = uccpCcBlock; | ||
122 | |||
123 | byte[] uccpBytes = uccp.ToBytes(); | ||
124 | UDPPacketBuffer upb = new UDPPacketBuffer(testEp, uccpBytes.Length); | ||
125 | upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor. | ||
126 | Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length); | ||
127 | |||
128 | AgentCircuitData acd = new AgentCircuitData(); | ||
129 | acd.AgentID = myAgentUuid; | ||
130 | acd.SessionID = mySessionUuid; | ||
131 | |||
132 | m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd); | ||
133 | |||
134 | m_udpServer.PacketReceived(upb); | ||
135 | |||
136 | return m_scene.GetScenePresence(myAgentUuid); | ||
137 | } | ||
151 | 138 | ||
152 | /// <summary> | 139 | /// <summary> |
153 | /// Test adding a client to the stack | 140 | /// Test adding a client to the stack |
@@ -158,19 +145,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
158 | TestHelpers.InMethod(); | 145 | TestHelpers.InMethod(); |
159 | // XmlConfigurator.Configure(); | 146 | // XmlConfigurator.Configure(); |
160 | 147 | ||
161 | TestScene scene = new SceneHelpers().SetupScene(); | 148 | AddUdpServer(); |
162 | uint myCircuitCode = 123456; | 149 | |
163 | UUID myAgentUuid = TestHelpers.ParseTail(0x1); | 150 | UUID myAgentUuid = TestHelpers.ParseTail(0x1); |
164 | UUID mySessionUuid = TestHelpers.ParseTail(0x2); | 151 | UUID mySessionUuid = TestHelpers.ParseTail(0x2); |
152 | uint myCircuitCode = 123456; | ||
165 | IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); | 153 | IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); |
166 | 154 | ||
167 | uint port = 0; | ||
168 | AgentCircuitManager acm = scene.AuthenticateHandler; | ||
169 | |||
170 | TestLLUDPServer llUdpServer | ||
171 | = new TestLLUDPServer(IPAddress.Any, ref port, 0, false, new IniConfigSource(), acm); | ||
172 | llUdpServer.AddScene(scene); | ||
173 | |||
174 | UseCircuitCodePacket uccp = new UseCircuitCodePacket(); | 155 | UseCircuitCodePacket uccp = new UseCircuitCodePacket(); |
175 | 156 | ||
176 | UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock | 157 | UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock |
@@ -185,26 +166,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
185 | upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor. | 166 | upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor. |
186 | Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length); | 167 | Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length); |
187 | 168 | ||
188 | llUdpServer.PacketReceived(upb); | 169 | m_udpServer.PacketReceived(upb); |
189 | 170 | ||
190 | // Presence shouldn't exist since the circuit manager doesn't know about this circuit for authentication yet | 171 | // Presence shouldn't exist since the circuit manager doesn't know about this circuit for authentication yet |
191 | Assert.That(scene.GetScenePresence(myAgentUuid), Is.Null); | 172 | Assert.That(m_scene.GetScenePresence(myAgentUuid), Is.Null); |
192 | 173 | ||
193 | AgentCircuitData acd = new AgentCircuitData(); | 174 | AgentCircuitData acd = new AgentCircuitData(); |
194 | acd.AgentID = myAgentUuid; | 175 | acd.AgentID = myAgentUuid; |
195 | acd.SessionID = mySessionUuid; | 176 | acd.SessionID = mySessionUuid; |
196 | 177 | ||
197 | acm.AddNewCircuit(myCircuitCode, acd); | 178 | m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd); |
198 | 179 | ||
199 | llUdpServer.PacketReceived(upb); | 180 | m_udpServer.PacketReceived(upb); |
200 | 181 | ||
201 | // Should succeed now | 182 | // Should succeed now |
202 | ScenePresence sp = scene.GetScenePresence(myAgentUuid); | 183 | ScenePresence sp = m_scene.GetScenePresence(myAgentUuid); |
203 | Assert.That(sp.UUID, Is.EqualTo(myAgentUuid)); | 184 | Assert.That(sp.UUID, Is.EqualTo(myAgentUuid)); |
204 | 185 | ||
205 | Assert.That(llUdpServer.PacketsSent.Count, Is.EqualTo(1)); | 186 | Assert.That(m_udpServer.PacketsSent.Count, Is.EqualTo(1)); |
206 | 187 | ||
207 | Packet packet = llUdpServer.PacketsSent[0]; | 188 | Packet packet = m_udpServer.PacketsSent[0]; |
208 | Assert.That(packet, Is.InstanceOf(typeof(PacketAckPacket))); | 189 | Assert.That(packet, Is.InstanceOf(typeof(PacketAckPacket))); |
209 | 190 | ||
210 | PacketAckPacket ackPacket = packet as PacketAckPacket; | 191 | PacketAckPacket ackPacket = packet as PacketAckPacket; |
@@ -212,6 +193,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
212 | Assert.That(ackPacket.Packets[0].ID, Is.EqualTo(0)); | 193 | Assert.That(ackPacket.Packets[0].ID, Is.EqualTo(0)); |
213 | } | 194 | } |
214 | 195 | ||
196 | [Test] | ||
197 | public void TestLogoutClientDueToAck() | ||
198 | { | ||
199 | TestHelpers.InMethod(); | ||
200 | // TestHelpers.EnableLogging(); | ||
201 | |||
202 | IniConfigSource ics = new IniConfigSource(); | ||
203 | IConfig config = ics.AddConfig("ClientStack.LindenUDP"); | ||
204 | config.Set("AckTimeout", -1); | ||
205 | AddUdpServer(ics); | ||
206 | |||
207 | ScenePresence sp = AddClient(); | ||
208 | m_udpServer.ClientOutgoingPacketHandler(sp.ControllingClient, true, false, false); | ||
209 | |||
210 | ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID); | ||
211 | Assert.That(spAfterAckTimeout, Is.Null); | ||
212 | |||
213 | // TestHelpers.DisableLogging(); | ||
214 | } | ||
215 | |||
215 | // /// <summary> | 216 | // /// <summary> |
216 | // /// Test removing a client from the stack | 217 | // /// Test removing a client from the stack |
217 | // /// </summary> | 218 | // /// </summary> |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs index 0302385..27b9e5b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs | |||
@@ -59,6 +59,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
59 | PacketsSent.Add(packet); | 59 | PacketsSent.Add(packet); |
60 | } | 60 | } |
61 | 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 | |||
62 | //// /// <summary> | 71 | //// /// <summary> |
63 | //// /// The chunks of data to pass to the LLUDPServer when it calls EndReceive | 72 | //// /// The chunks of data to pass to the LLUDPServer when it calls EndReceive |
64 | //// /// </summary> | 73 | //// /// </summary> |