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.cs48
1 files changed, 38 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 7c531f3..8214045 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -92,6 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
92 92
93 private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>(); 93 private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>();
94 94
95 private bool m_SendLogoutPacketWhenClosing = true;
96
95 /* protected variables */ 97 /* protected variables */
96 98
97 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = 99 protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
@@ -368,6 +370,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
368 set { m_IsActive = value; } 370 set { m_IsActive = value; }
369 } 371 }
370 372
373 public bool SendLogoutPacketWhenClosing
374 {
375 set { m_SendLogoutPacketWhenClosing = value; }
376 }
377
371 /* METHODS */ 378 /* METHODS */
372 379
373 public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer, 380 public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
@@ -451,7 +458,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
451 if (!(shutdownCircuit)) 458 if (!(shutdownCircuit))
452 { 459 {
453 GC.Collect(); 460 GC.Collect();
454 m_clientThread.Abort(); 461
462 // Sends a KillPacket object, with which, the
463 // blockingqueue dequeues and sees it's a killpacket
464 // and terminates within the context of the client thread.
465 // This ensures that it's done from within the context
466 // of the client thread regardless of where Close() is called.
467 KillEndDone();
455 } 468 }
456 } 469 }
457 470
@@ -752,7 +765,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
752 ClientLoop(); 765 ClientLoop();
753 } 766 }
754 } 767 }
755 catch (Exception e) 768 catch (System.Exception e)
756 { 769 {
757 if (e is ThreadAbortException) 770 if (e is ThreadAbortException)
758 throw e; 771 throw e;
@@ -3740,6 +3753,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3740 m_PacketHandler.InPacket((Packet) NewPack); 3753 m_PacketHandler.InPacket((Packet) NewPack);
3741 } 3754 }
3742 3755
3756
3743 /// <summary> 3757 /// <summary>
3744 /// The dreaded OutPacket. This should only be called from within 3758 /// The dreaded OutPacket. This should only be called from within
3745 /// the ClientStack itself right now 3759 /// the ClientStack itself right now
@@ -6093,15 +6107,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6093 6107
6094 public void SendLogoutPacket() 6108 public void SendLogoutPacket()
6095 { 6109 {
6096 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply); 6110 // I know this is a bit of a hack, however there are times when you don't
6097 // TODO: don't create new blocks if recycling an old packet 6111 // want to send this, but still need to do the rest of the shutdown process
6098 logReply.AgentData.AgentID = AgentId; 6112 // this method gets called from the packet server.. which makes it practically
6099 logReply.AgentData.SessionID = SessionId; 6113 // impossible to do any other way.
6100 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
6101 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
6102 logReply.InventoryData[0].ItemID = LLUUID.Zero;
6103 6114
6104 OutPacket(logReply, ThrottleOutPacketType.Task); 6115 if (m_SendLogoutPacketWhenClosing)
6116 {
6117 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
6118 // TODO: don't create new blocks if recycling an old packet
6119 logReply.AgentData.AgentID = AgentId;
6120 logReply.AgentData.SessionID = SessionId;
6121 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
6122 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
6123 logReply.InventoryData[0].ItemID = LLUUID.Zero;
6124
6125 OutPacket(logReply, ThrottleOutPacketType.Task);
6126 }
6105 } 6127 }
6106 6128
6107 public void SendHealth(float health) 6129 public void SendHealth(float health)
@@ -6443,5 +6465,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6443 6465
6444 OutPacket(reply, ThrottleOutPacketType.Land); 6466 OutPacket(reply, ThrottleOutPacketType.Land);
6445 } 6467 }
6468
6469 public void KillEndDone()
6470 {
6471 KillPacket kp = new KillPacket();
6472 OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
6473 }
6446 } 6474 }
6447} 6475}