aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-23 06:44:43 +0000
committerMelanie Thielker2008-11-23 06:44:43 +0000
commited300f21f0256e4990a91fec79927b723223fa98 (patch)
tree392abaa1b95eaf07b1129c275060028c821c3279
parentPlumb in the presence notifications and region shutdown/restart messages (diff)
downloadopensim-SC_OLD-ed300f21f0256e4990a91fec79927b723223fa98.zip
opensim-SC_OLD-ed300f21f0256e4990a91fec79927b723223fa98.tar.gz
opensim-SC_OLD-ed300f21f0256e4990a91fec79927b723223fa98.tar.bz2
opensim-SC_OLD-ed300f21f0256e4990a91fec79927b723223fa98.tar.xz
05:24:49 - [PRESENCE]: Logging off 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb because the region they were in has gone
Or, in other words, a region crash/restart no longer messes up presence.
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs1
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs30
-rw-r--r--OpenSim/Grid/UserServer/Main.cs18
-rw-r--r--OpenSim/Grid/UserServer/MessageServersConnector.cs53
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs4
5 files changed, 105 insertions, 1 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 5568f73..0e03df1 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -90,6 +90,7 @@ namespace OpenSim.Grid.MessagingServer
90 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); 90 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
91 m_httpServer.AddXmlRPCHandler("region_startup", msgsvc.RegionStartup); 91 m_httpServer.AddXmlRPCHandler("region_startup", msgsvc.RegionStartup);
92 m_httpServer.AddXmlRPCHandler("region_shutdown", msgsvc.RegionShutdown); 92 m_httpServer.AddXmlRPCHandler("region_shutdown", msgsvc.RegionShutdown);
93 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
93 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); 94 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
94 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); 95 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
95 96
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index a4e54c7..a8ee9d5 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -666,5 +666,35 @@ namespace OpenSim.Grid.MessagingServer
666 response.Value = result; 666 response.Value = result;
667 return response; 667 return response;
668 } 668 }
669
670 public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request)
671 {
672 Hashtable requestData = (Hashtable)request.Params[0];
673 Hashtable result = new Hashtable();
674 result["success"] = "FALSE";
675
676 UUID regionID;
677 if (UUID.TryParse((string)requestData["regionid"], out regionID))
678 {
679 m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID);
680 result["success"] = "TRUE";
681
682 foreach (UserPresenceData up in m_presences.Values)
683 {
684 if(up.regionData.UUID == regionID)
685 {
686 if (up.OnlineYN)
687 {
688 m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID);
689 ProcessLogOff(up.agentData.AgentID);
690 }
691 }
692 }
693 }
694
695 XmlRpcResponse response = new XmlRpcResponse();
696 response.Value = result;
697 return response;
698 }
669 } 699 }
670} 700}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index f894ca0..4e397aa 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -464,12 +464,30 @@ namespace OpenSim.Grid.UserServer
464 464
465 public void HandleRegionStartup(UUID regionID) 465 public void HandleRegionStartup(UUID regionID)
466 { 466 {
467 // This might seem strange, that we send this back to the
468 // server it came from. But there is method to the madness.
469 // There can be multiple user servers on the same database,
470 // and each can have multiple messaging servers. So, we send
471 // it to all known user servers, who send it to all known
472 // message servers. That way, we should be able to finally
473 // update presence to all regions and thereby all friends
474 //
467 m_userManager.HandleRegionStartup(regionID); 475 m_userManager.HandleRegionStartup(regionID);
476 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
468 } 477 }
469 478
470 public void HandleRegionShutdown(UUID regionID) 479 public void HandleRegionShutdown(UUID regionID)
471 { 480 {
481 // This might seem strange, that we send this back to the
482 // server it came from. But there is method to the madness.
483 // There can be multiple user servers on the same database,
484 // and each can have multiple messaging servers. So, we send
485 // it to all known user servers, who send it to all known
486 // message servers. That way, we should be able to finally
487 // update presence to all regions and thereby all friends
488 //
472 m_userManager.HandleRegionShutdown(regionID); 489 m_userManager.HandleRegionShutdown(regionID);
490 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
473 } 491 }
474 } 492 }
475} 493}
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs
index 6659617..6da67d7 100644
--- a/OpenSim/Grid/UserServer/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs
@@ -259,6 +259,25 @@ namespace OpenSim.Grid.UserServer
259 } 259 }
260 } 260 }
261 261
262 private void TellMessageServersAboutRegionShutdownInternal(UUID regionID)
263 {
264 lock (MessageServers)
265 {
266 if (MessageServers.Count > 0)
267 {
268 m_log.Info("[MSGCONNECTOR]: Sending region down notice to registered message servers");
269 }
270 else
271 {
272// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
273 }
274 foreach (MessageServerInfo serv in MessageServers.Values)
275 {
276 NotifyMessageServerAboutRegionShutdown(serv,regionID);
277 }
278 }
279 }
280
262 public void TellMessageServersAboutUserLogoff(UUID agentID) 281 public void TellMessageServersAboutUserLogoff(UUID agentID)
263 { 282 {
264 PresenceNotification notification = new PresenceNotification(); 283 PresenceNotification notification = new PresenceNotification();
@@ -269,6 +288,16 @@ namespace OpenSim.Grid.UserServer
269 m_NotifyQueue.Enqueue(notification); 288 m_NotifyQueue.Enqueue(notification);
270 } 289 }
271 290
291 public void TellMessageServersAboutRegionShutdown(UUID regionID)
292 {
293 PresenceNotification notification = new PresenceNotification();
294
295 notification.request = NotificationRequest.Shutdown;
296 notification.RegionID = regionID;
297
298 m_NotifyQueue.Enqueue(notification);
299 }
300
272 private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID) 301 private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID)
273 { 302 {
274 Hashtable reqparams = new Hashtable(); 303 Hashtable reqparams = new Hashtable();
@@ -289,6 +318,26 @@ namespace OpenSim.Grid.UserServer
289 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); 318 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
290 } 319 }
291 320
321 private void NotifyMessageServerAboutRegionShutdown(MessageServerInfo serv, UUID regionID)
322 {
323 Hashtable reqparams = new Hashtable();
324 reqparams["sendkey"] = serv.sendkey;
325 reqparams["regionid"] = regionID.ToString();
326 ArrayList SendParams = new ArrayList();
327 SendParams.Add(reqparams);
328
329 XmlRpcRequest GridReq = new XmlRpcRequest("process_region_shutdown", SendParams);
330 try
331 {
332 GridReq.Send(serv.URI, 6000);
333 }
334 catch (WebException)
335 {
336 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about region shutdown.");
337 }
338 m_log.Info("[REGION UPDOWN]: Notified : " + serv.URI + " about region state change");
339 }
340
292 private void NotifyMessageServerAboutUser(MessageServerInfo serv, 341 private void NotifyMessageServerAboutUser(MessageServerInfo serv,
293 UUID agentID, UUID sessionID, UUID RegionID, 342 UUID agentID, UUID sessionID, UUID RegionID,
294 ulong regionhandle, float positionX, float positionY, float positionZ, 343 ulong regionhandle, float positionX, float positionY, float positionZ,
@@ -331,7 +380,9 @@ namespace OpenSim.Grid.UserServer
331 PresenceNotification presence = m_NotifyQueue.Dequeue(); 380 PresenceNotification presence = m_NotifyQueue.Dequeue();
332 381
333 if (presence.request == NotificationRequest.Shutdown) 382 if (presence.request == NotificationRequest.Shutdown)
334 return; 383 {
384 TellMessageServersAboutRegionShutdownInternal(presence.RegionID);
385 }
335 386
336 if (presence.request == NotificationRequest.Login) 387 if (presence.request == NotificationRequest.Login)
337 { 388 {
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 04510b2..f8f9f39 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -790,6 +790,10 @@ namespace OpenSim.Grid.UserServer
790 userProfile.LastLogin = userAgent.LogoutTime; 790 userProfile.LastLogin = userAgent.LogoutTime;
791 791
792 CommitAgent(ref userProfile); 792 CommitAgent(ref userProfile);
793
794 handlerLogOffUser = OnLogOffUser;
795 if (handlerLogOffUser != null)
796 handlerLogOffUser(agentID);
793 } 797 }
794 } 798 }
795 } 799 }