aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-13 16:53:19 -0700
committerJohn Hurliman2009-10-13 16:53:19 -0700
commit395a8680c3633ca131e7481f765517311ef51710 (patch)
treee9c3634c3c37e6595b7743da88b236c12fc81422 /OpenSim/Region/ClientStack/LindenUDP
parent* Rewrote ClientManager to remove Lindenisms from OpenSim core, improve perfo... (diff)
downloadopensim-SC_OLD-395a8680c3633ca131e7481f765517311ef51710.zip
opensim-SC_OLD-395a8680c3633ca131e7481f765517311ef51710.tar.gz
opensim-SC_OLD-395a8680c3633ca131e7481f765517311ef51710.tar.bz2
opensim-SC_OLD-395a8680c3633ca131e7481f765517311ef51710.tar.xz
* Fixed a bug where clients were being added to ClientManager twice
* Changed the ClientManager interface to reduce potential errors with duplicate or mismatched keys * Added IClientAPI.RemoteEndPoint, which can (hopefully) eventually replace IClientAPI.CircuitCode * Changed the order of operations during client shutdown
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs36
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs44
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs9
3 files changed, 41 insertions, 48 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 86d0112..aecb362 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -411,38 +411,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
411 "[CLIENT]: Close has been called for {0} attached to scene {1}", 411 "[CLIENT]: Close has been called for {0} attached to scene {1}",
412 Name, m_scene.RegionInfo.RegionName); 412 Name, m_scene.RegionInfo.RegionName);
413 413
414 // Remove ourselves from the scene 414 // Send the STOP packet
415 m_scene.ClientManager.Remove(m_agentId, m_udpClient.RemoteEndPoint); 415 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
416 OutPacket(disable, ThrottleOutPacketType.Unknown);
417
418 IsActive = false;
416 419
420 // Shutdown the image manager
417 if (m_imageManager != null) 421 if (m_imageManager != null)
418 {
419 m_imageManager.Close(); 422 m_imageManager.Close();
420 m_imageManager = null;
421 }
422
423 if (m_udpServer != null)
424 {
425 m_udpServer.Flush();
426 }
427 423
424 // Fire the callback for this connection closing
428 if (OnConnectionClosed != null) 425 if (OnConnectionClosed != null)
429 OnConnectionClosed(this); 426 OnConnectionClosed(this);
430 427
431 CloseCleanup(); 428 // Flush all of the packets out of the UDP server for this client
432 } 429 if (m_udpServer != null)
430 m_udpServer.Flush(m_udpClient);
433 431
434 private void CloseCleanup() 432 // Remove ourselves from the scene
435 {
436 m_scene.RemoveClient(AgentId); 433 m_scene.RemoveClient(AgentId);
434 m_scene.ClientManager.Remove(this);
437 435
438 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 436 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
437 //GC.Collect();
439 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); 438 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
440 439
441 // Send the STOP packet 440 // FIXME: Is this still necessary?
442 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 441 //Thread.Sleep(2000);
443 OutPacket(disable, ThrottleOutPacketType.Unknown);
444
445 Thread.Sleep(2000);
446 442
447 // Shut down timers. Thread Context of this method is murky. Lock all timers 443 // Shut down timers. Thread Context of this method is murky. Lock all timers
448 if (m_avatarTerseUpdateTimer.Enabled) 444 if (m_avatarTerseUpdateTimer.Enabled)
@@ -459,8 +455,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
459 // We need to do this over grid communications 455 // We need to do this over grid communications
460 //m_scene.CloseAllAgents(CircuitCode); 456 //m_scene.CloseAllAgents(CircuitCode);
461 457
462 IsActive = false;
463
464 m_avatarTerseUpdateTimer.Dispose(); 458 m_avatarTerseUpdateTimer.Dispose();
465 m_primTerseUpdateTimer.Dispose(); 459 m_primTerseUpdateTimer.Dispose();
466 m_primFullUpdateTimer.Dispose(); 460 m_primFullUpdateTimer.Dispose();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 343f537..8469ba6 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -167,39 +167,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
167 J2KImage imagereq; 167 J2KImage imagereq;
168 int numCollected = 0; 168 int numCollected = 0;
169 169
170 //lock (m_syncRoot) 170 m_lastloopprocessed = DateTime.Now.Ticks;
171 //{ 171
172 m_lastloopprocessed = DateTime.Now.Ticks; 172 // This can happen during Close()
173 173 if (m_client == null)
174 // This can happen during Close() 174 return false;
175 if (m_client == null) 175
176 return false; 176 while ((imagereq = GetHighestPriorityImage()) != null)
177 177 {
178 while ((imagereq = GetHighestPriorityImage()) != null) 178 if (imagereq.IsDecoded == true)
179 { 179 {
180 if (imagereq.IsDecoded == true) 180 ++numCollected;
181 {
182 ++numCollected;
183 181
184 if (imagereq.SendPackets(m_client, maxpack)) 182 if (imagereq.SendPackets(m_client, maxpack))
185 { 183 {
186 // Send complete. Destroy any knowledge of this transfer 184 // Send complete. Destroy any knowledge of this transfer
187 RemoveImageFromQueue(imagereq); 185 RemoveImageFromQueue(imagereq);
188 }
189 } 186 }
190
191 if (numCollected == count)
192 break;
193 } 187 }
194 //} 188
189 if (numCollected == count)
190 break;
191 }
195 192
196 return m_priorityQueue.Count > 0; 193 return m_priorityQueue.Count > 0;
197 } 194 }
198 195
199 //Faux destructor 196 /// <summary>
197 /// Faux destructor
198 /// </summary>
200 public void Close() 199 public void Close()
201 { 200 {
202 m_shuttingdown = true; 201 m_shuttingdown = true;
202 m_priorityQueue = null;
203 m_j2kDecodeModule = null; 203 m_j2kDecodeModule = null;
204 m_assetCache = null; 204 m_assetCache = null;
205 m_client = null; 205 m_client = null;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 8ec143a..22c275c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -390,7 +390,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
390 } 390 }
391 } 391 }
392 392
393 public void Flush() 393 public void Flush(LLUDPClient udpClient)
394 { 394 {
395 // FIXME: Implement? 395 // FIXME: Implement?
396 } 396 }
@@ -645,15 +645,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
645 client.OnLogout += LogoutHandler; 645 client.OnLogout += LogoutHandler;
646 client.OnConnectionClosed += ConnectionClosedHandler; 646 client.OnConnectionClosed += ConnectionClosedHandler;
647 647
648 m_scene.ClientManager.Add(agentID, remoteEndPoint, client);
649
650 // Start the IClientAPI 648 // Start the IClientAPI
651 m_scene.ClientManager.Add(agentID, remoteEndPoint, client); 649 m_scene.ClientManager.Add(client);
652 client.Start(); 650 client.Start();
653 } 651 }
654 else 652 else
655 { 653 {
656 m_log.Debug("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from " + udpClient.AgentID); 654 m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}",
655 udpClient.AgentID, remoteEndPoint, circuitCode);
657 } 656 }
658 } 657 }
659 658