aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Statistics/StatsManager.cs17
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs175
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs9
5 files changed, 105 insertions, 108 deletions
diff --git a/OpenSim/Framework/Statistics/StatsManager.cs b/OpenSim/Framework/Statistics/StatsManager.cs
index 43159ef..436ce2f 100644
--- a/OpenSim/Framework/Statistics/StatsManager.cs
+++ b/OpenSim/Framework/Statistics/StatsManager.cs
@@ -34,14 +34,12 @@ namespace OpenSim.Framework.Statistics
34 { 34 {
35 private static AssetStatsCollector assetStats; 35 private static AssetStatsCollector assetStats;
36 private static UserStatsCollector userStats; 36 private static UserStatsCollector userStats;
37 private static SimExtraStatsCollector simExtraStats; 37 private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
38 38
39 public static AssetStatsCollector AssetStats { get { return assetStats; } } 39 public static AssetStatsCollector AssetStats { get { return assetStats; } }
40 public static UserStatsCollector UserStats { get { return userStats; } } 40 public static UserStatsCollector UserStats { get { return userStats; } }
41 public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } 41 public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
42 42
43 private StatsManager() {}
44
45 /// <summary> 43 /// <summary>
46 /// Start collecting statistics related to assets. 44 /// Start collecting statistics related to assets.
47 /// Should only be called once. 45 /// Should only be called once.
@@ -63,16 +61,5 @@ namespace OpenSim.Framework.Statistics
63 61
64 return userStats; 62 return userStats;
65 } 63 }
66
67 /// <summary>
68 /// Start collecting extra sim statistics apart from those collected for the client.
69 /// Should only be called once.
70 /// </summary>
71 public static SimExtraStatsCollector StartCollectingSimExtraStats()
72 {
73 simExtraStats = new SimExtraStatsCollector();
74
75 return simExtraStats;
76 }
77 } 64 }
78} 65} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 045e8d2..9a0fa70 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -223,8 +223,6 @@ namespace OpenSim
223 223
224 base.StartupSpecific(); 224 base.StartupSpecific();
225 225
226 m_stats = StatsManager.StartCollectingSimExtraStats();
227
228 // Create a ModuleLoader instance 226 // Create a ModuleLoader instance
229 m_moduleLoader = new ModuleLoader(m_config.Source); 227 m_moduleLoader = new ModuleLoader(m_config.Source);
230 228
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index a292a6c..58a3b1c 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;
@@ -1244,7 +1246,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1244 Watchdog.RemoveThread(); 1246 Watchdog.RemoveThread();
1245 } 1247 }
1246 1248
1247 private void ClientOutgoingPacketHandler(IClientAPI client) 1249 protected void ClientOutgoingPacketHandler(IClientAPI client)
1248 { 1250 {
1249 m_currentOutgoingClient = client; 1251 m_currentOutgoingClient = client;
1250 1252
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
index 1321470..45d0e2a 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>