aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs77
1 files changed, 23 insertions, 54 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index bc9cfcf..86d0112 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -403,39 +403,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
403 #region Client Methods 403 #region Client Methods
404 404
405 /// <summary> 405 /// <summary>
406 /// Close down the client view. This *must* be the last method called, since the last # 406 /// Shut down the client view
407 /// statement of CloseCleanup() aborts the thread.
408 /// </summary> 407 /// </summary>
409 /// <param name="shutdownCircuit"></param> 408 public void Close()
410 public void Close(bool shutdownCircuit)
411 { 409 {
412 m_log.DebugFormat( 410 m_log.DebugFormat(
413 "[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}", 411 "[CLIENT]: Close has been called for {0} attached to scene {1}",
414 shutdownCircuit, Name, m_scene.RegionInfo.RegionName); 412 Name, m_scene.RegionInfo.RegionName);
413
414 // Remove ourselves from the scene
415 m_scene.ClientManager.Remove(m_agentId, m_udpClient.RemoteEndPoint);
415 416
416 if (m_imageManager != null) 417 if (m_imageManager != null)
418 {
417 m_imageManager.Close(); 419 m_imageManager.Close();
420 m_imageManager = null;
421 }
418 422
419 if (m_udpServer != null) 423 if (m_udpServer != null)
420 m_udpServer.Flush();
421
422 // raise an event on the packet server to Shutdown the circuit
423 // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup
424 // here otherwise we'll end up calling it twice.
425 // FIXME: In truth, I might be wrong but this whole business of calling this method twice (with different args) looks
426 // horribly tangly. Hopefully it should be possible to greatly simplify it.
427 if (shutdownCircuit)
428 { 424 {
429 if (OnConnectionClosed != null) 425 m_udpServer.Flush();
430 OnConnectionClosed(this);
431 }
432 else
433 {
434 CloseCleanup(shutdownCircuit);
435 } 426 }
427
428 if (OnConnectionClosed != null)
429 OnConnectionClosed(this);
430
431 CloseCleanup();
436 } 432 }
437 433
438 private void CloseCleanup(bool shutdownCircuit) 434 private void CloseCleanup()
439 { 435 {
440 m_scene.RemoveClient(AgentId); 436 m_scene.RemoveClient(AgentId);
441 437
@@ -459,43 +455,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
459 lock (m_primFullUpdateTimer) 455 lock (m_primFullUpdateTimer)
460 m_primFullUpdateTimer.Stop(); 456 m_primFullUpdateTimer.Stop();
461 457
462 // This is just to give the client a reasonable chance of
463 // flushing out all it's packets. There should probably
464 // be a better mechanism here
465
466 // We can't reach into other scenes and close the connection 458 // We can't reach into other scenes and close the connection
467 // We need to do this over grid communications 459 // We need to do this over grid communications
468 //m_scene.CloseAllAgents(CircuitCode); 460 //m_scene.CloseAllAgents(CircuitCode);
469 461
470 // If we're not shutting down the circuit, then this is the last time we'll go here.
471 // If we are shutting down the circuit, the UDP Server will come back here with
472 // ShutDownCircuit = false
473 if (!(shutdownCircuit))
474 {
475 GC.Collect();
476 m_imageManager = null;
477 // Sends a KillPacket object, with which, the
478 // blockingqueue dequeues and sees it's a killpacket
479 // and terminates within the context of the client thread.
480 // This ensures that it's done from within the context
481 // of the client thread regardless of where Close() is called.
482 KillEndDone();
483 }
484
485 IsActive = false; 462 IsActive = false;
486 463
487 m_avatarTerseUpdateTimer.Close(); 464 m_avatarTerseUpdateTimer.Dispose();
488 m_primTerseUpdateTimer.Close(); 465 m_primTerseUpdateTimer.Dispose();
489 m_primFullUpdateTimer.Close(); 466 m_primFullUpdateTimer.Dispose();
490 467
491 //m_udpServer.OnPacketStats -= PopulateStats; 468 // Disable UDP handling for this client
492 m_udpClient.Shutdown(); 469 m_udpClient.Shutdown();
493
494 // wait for thread stoped
495 // m_clientThread.Join();
496
497 // delete circuit code
498 //m_networkServer.CloseClient(this);
499 } 470 }
500 471
501 public void Kick(string message) 472 public void Kick(string message)
@@ -10225,7 +10196,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10225 10196
10226 public void KillEndDone() 10197 public void KillEndDone()
10227 { 10198 {
10228 m_udpClient.Shutdown();
10229 } 10199 }
10230 10200
10231 #region IClientCore 10201 #region IClientCore
@@ -10268,15 +10238,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10268 { 10238 {
10269 Kick(reason); 10239 Kick(reason);
10270 Thread.Sleep(1000); 10240 Thread.Sleep(1000);
10271 Close(true); 10241 Close();
10272 } 10242 }
10273 10243
10274 public void Disconnect() 10244 public void Disconnect()
10275 { 10245 {
10276 Close(true); 10246 Close();
10277 } 10247 }
10278 10248
10279
10280 #endregion 10249 #endregion
10281 10250
10282 public void RefreshGroupMembership() 10251 public void RefreshGroupMembership()