aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-05 01:20:17 +0000
committerJustin Clarke Casey2008-06-05 01:20:17 +0000
commit1f605da7618d4c38a76bfc87215a7b5e791bbb0a (patch)
treecd4d0cb1f75b986d89681cc309094957711f8a49
parent* exprimental: Export and reimport all items within a prim except Objects (diff)
downloadopensim-SC-1f605da7618d4c38a76bfc87215a7b5e791bbb0a.zip
opensim-SC-1f605da7618d4c38a76bfc87215a7b5e791bbb0a.tar.gz
opensim-SC-1f605da7618d4c38a76bfc87215a7b5e791bbb0a.tar.bz2
opensim-SC-1f605da7618d4c38a76bfc87215a7b5e791bbb0a.tar.xz
* If a client thread crashes, make an attempt to notify the client and clean up the resources
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs62
1 files changed, 58 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 172288a..1044d8f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -734,9 +734,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
734 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); 734 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
735 735
736 // Don't let a failure in an individual client thread crash the whole sim. 736 // Don't let a failure in an individual client thread crash the whole sim.
737 // FIXME: could do more sophisticated cleanup since leaving client resources around may 737 m_log.ErrorFormat("[CLIENT]: Client thread for {0} {1} crashed. Logging them out. Exception {2}", Name, AgentId, e);
738 // cause instability for the region server over time. 738
739 m_log.ErrorFormat("[CLIENT]: Client thread for {0} {1} crashed. Exception {2}", Name, AgentId, e); 739 try
740 {
741 // Make an attempt to alert the user that their session has crashed
742 AgentAlertMessagePacket packet
743 = BuildAgentAlertPacket(
744 "Unfortunately the session for this client on the server has crashed.\n"
745 + "Any further actions taken will not be processed.\n"
746 + "Please relog", true);
747
748 ProcessOutPacket(packet);
749
750 // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to
751 // listeners yet, though.
752 Logout(this);
753 }
754 catch (Exception e2)
755 {
756 if (e2 is ThreadAbortException)
757 throw e2;
758
759 m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2);
760 }
740 } 761 }
741 } 762 }
742 763
@@ -1808,11 +1829,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1808 /// the AlertMessage packet).</param> 1829 /// the AlertMessage packet).</param>
1809 public void SendAgentAlertMessage(string message, bool modal) 1830 public void SendAgentAlertMessage(string message, bool modal)
1810 { 1831 {
1832 OutPacket(BuildAgentAlertPacket(message, modal), ThrottleOutPacketType.Task);
1833 }
1834
1835 /// <summary>
1836 /// Construct an agent alert packet
1837 /// </summary>
1838 /// <param name="message"></param>
1839 /// <param name="modal"></param>
1840 /// <returns></returns>
1841 protected AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal)
1842 {
1811 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); 1843 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
1812 alertPack.AgentData.AgentID = AgentId; 1844 alertPack.AgentData.AgentID = AgentId;
1813 alertPack.AlertData.Message = Helpers.StringToField(message); 1845 alertPack.AlertData.Message = Helpers.StringToField(message);
1814 alertPack.AlertData.Modal = modal; 1846 alertPack.AlertData.Modal = modal;
1815 OutPacket(alertPack, ThrottleOutPacketType.Task); 1847
1848 return alertPack;
1816 } 1849 }
1817 1850
1818 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, 1851 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
@@ -3265,8 +3298,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3265 return LLUUID.Zero; 3298 return LLUUID.Zero;
3266 } 3299 }
3267 3300
3301 /// <summary>
3302 /// Handler called when we receive a logout packet.
3303 /// </summary>
3304 /// <param name="client"></param>
3305 /// <param name="packet"></param>
3306 /// <returns></returns>
3268 protected virtual bool Logout(IClientAPI client, Packet packet) 3307 protected virtual bool Logout(IClientAPI client, Packet packet)
3269 { 3308 {
3309 return Logout(client);
3310 }
3311
3312 /// <summary>
3313 ///
3314 /// </summary>
3315 /// <param name="client">
3316 /// A <see cref="IClientAPI"/>
3317 /// </param>
3318 /// <returns>
3319 /// A <see cref="System.Boolean"/>
3320 /// </returns>
3321 protected virtual bool Logout(IClientAPI client)
3322 {
3270 m_log.Info("[CLIENT]: Got a logout request"); 3323 m_log.Info("[CLIENT]: Got a logout request");
3271 3324
3272 handlerLogout = OnLogout; 3325 handlerLogout = OnLogout;
@@ -5007,6 +5060,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5007 if (handlerUpdateInventoryItem != null) 5060 if (handlerUpdateInventoryItem != null)
5008 { 5061 {
5009 InventoryItemBase itemUpd = new InventoryItemBase(); 5062 InventoryItemBase itemUpd = new InventoryItemBase();
5063 itemUpd = null;
5010 itemUpd.ID = update.InventoryData[i].ItemID; 5064 itemUpd.ID = update.InventoryData[i].ItemID;
5011 itemUpd.Name = Util.FieldToString(update.InventoryData[i].Name); 5065 itemUpd.Name = Util.FieldToString(update.InventoryData[i].Name);
5012 itemUpd.Description = Util.FieldToString(update.InventoryData[i].Description); 5066 itemUpd.Description = Util.FieldToString(update.InventoryData[i].Description);