From 412dd1260b4241c48e04eca6f9ce55a26f28dc51 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Tue, 13 Jan 2009 23:27:48 +0000
Subject: * Add a second logoffuser message with the region secret. * This
 ensures that the user will be logged off successfully by a properly
 permissioned user server

---
 OpenSim/Grid/UserServer/UserLoginService.cs | 33 ++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

(limited to 'OpenSim/Grid')

diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 267b2a0..f19e564 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Grid.UserServer
             Hashtable SimParams = new Hashtable();
             SimParams["agent_id"] = theUser.ID.ToString();
             SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString();
-            //SimParams["region_secret"] = SimInfo.regionSecret;
+            SimParams["region_secret2"] = SimInfo.regionSecret;
             //m_log.Info(SimInfo.regionSecret);
             SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
             SimParams["message"] = message;
@@ -135,6 +135,37 @@ namespace OpenSim.Grid.UserServer
                 m_log.Error("[LOGIN]: Error telling region to logout user!");
             }
 
+            // Prepare notification
+            SimParams = new Hashtable();
+            SimParams["agent_id"] = theUser.ID.ToString();
+            SimParams["region_secret"] = SimInfo.regionSecret;
+            //m_log.Info(SimInfo.regionSecret);
+            SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
+            SimParams["message"] = message;
+            SendParams = new ArrayList();
+            SendParams.Add(SimParams);
+
+            m_log.InfoFormat(
+                "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
+                SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
+                theUser.FirstName + " " + theUser.SurName);
+
+            try
+            {
+                XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
+                XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
+
+                if (GridResp.IsFault)
+                {
+                    m_log.ErrorFormat(
+                        "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
+                        SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
+                }
+            }
+            catch (Exception)
+            {
+                m_log.Error("[LOGIN]: Error telling region to logout user!");
+            }
             //base.LogOffUser(theUser);
         }
 
-- 
cgit v1.1