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.
0.6.1-post-fixes
Melanie Thielker 2008-11-23 06:44:43 +00:00
parent cbd0221870
commit ed300f21f0
5 changed files with 105 additions and 1 deletions

View File

@ -90,6 +90,7 @@ namespace OpenSim.Grid.MessagingServer
m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
m_httpServer.AddXmlRPCHandler("region_startup", msgsvc.RegionStartup); m_httpServer.AddXmlRPCHandler("region_startup", msgsvc.RegionStartup);
m_httpServer.AddXmlRPCHandler("region_shutdown", msgsvc.RegionShutdown); m_httpServer.AddXmlRPCHandler("region_shutdown", msgsvc.RegionShutdown);
m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);

View File

@ -666,5 +666,35 @@ namespace OpenSim.Grid.MessagingServer
response.Value = result; response.Value = result;
return response; return response;
} }
public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request)
{
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable result = new Hashtable();
result["success"] = "FALSE";
UUID regionID;
if (UUID.TryParse((string)requestData["regionid"], out regionID))
{
m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID);
result["success"] = "TRUE";
foreach (UserPresenceData up in m_presences.Values)
{
if(up.regionData.UUID == regionID)
{
if (up.OnlineYN)
{
m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID);
ProcessLogOff(up.agentData.AgentID);
}
}
}
}
XmlRpcResponse response = new XmlRpcResponse();
response.Value = result;
return response;
}
} }
} }

View File

@ -464,12 +464,30 @@ namespace OpenSim.Grid.UserServer
public void HandleRegionStartup(UUID regionID) public void HandleRegionStartup(UUID regionID)
{ {
// This might seem strange, that we send this back to the
// server it came from. But there is method to the madness.
// There can be multiple user servers on the same database,
// and each can have multiple messaging servers. So, we send
// it to all known user servers, who send it to all known
// message servers. That way, we should be able to finally
// update presence to all regions and thereby all friends
//
m_userManager.HandleRegionStartup(regionID); m_userManager.HandleRegionStartup(regionID);
m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
} }
public void HandleRegionShutdown(UUID regionID) public void HandleRegionShutdown(UUID regionID)
{ {
// This might seem strange, that we send this back to the
// server it came from. But there is method to the madness.
// There can be multiple user servers on the same database,
// and each can have multiple messaging servers. So, we send
// it to all known user servers, who send it to all known
// message servers. That way, we should be able to finally
// update presence to all regions and thereby all friends
//
m_userManager.HandleRegionShutdown(regionID); m_userManager.HandleRegionShutdown(regionID);
m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
} }
} }
} }

View File

@ -259,6 +259,25 @@ namespace OpenSim.Grid.UserServer
} }
} }
private void TellMessageServersAboutRegionShutdownInternal(UUID regionID)
{
lock (MessageServers)
{
if (MessageServers.Count > 0)
{
m_log.Info("[MSGCONNECTOR]: Sending region down notice to registered message servers");
}
else
{
// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
}
foreach (MessageServerInfo serv in MessageServers.Values)
{
NotifyMessageServerAboutRegionShutdown(serv,regionID);
}
}
}
public void TellMessageServersAboutUserLogoff(UUID agentID) public void TellMessageServersAboutUserLogoff(UUID agentID)
{ {
PresenceNotification notification = new PresenceNotification(); PresenceNotification notification = new PresenceNotification();
@ -269,6 +288,16 @@ namespace OpenSim.Grid.UserServer
m_NotifyQueue.Enqueue(notification); m_NotifyQueue.Enqueue(notification);
} }
public void TellMessageServersAboutRegionShutdown(UUID regionID)
{
PresenceNotification notification = new PresenceNotification();
notification.request = NotificationRequest.Shutdown;
notification.RegionID = regionID;
m_NotifyQueue.Enqueue(notification);
}
private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID) private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID)
{ {
Hashtable reqparams = new Hashtable(); Hashtable reqparams = new Hashtable();
@ -289,6 +318,26 @@ namespace OpenSim.Grid.UserServer
m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
} }
private void NotifyMessageServerAboutRegionShutdown(MessageServerInfo serv, UUID regionID)
{
Hashtable reqparams = new Hashtable();
reqparams["sendkey"] = serv.sendkey;
reqparams["regionid"] = regionID.ToString();
ArrayList SendParams = new ArrayList();
SendParams.Add(reqparams);
XmlRpcRequest GridReq = new XmlRpcRequest("process_region_shutdown", SendParams);
try
{
GridReq.Send(serv.URI, 6000);
}
catch (WebException)
{
m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about region shutdown.");
}
m_log.Info("[REGION UPDOWN]: Notified : " + serv.URI + " about region state change");
}
private void NotifyMessageServerAboutUser(MessageServerInfo serv, private void NotifyMessageServerAboutUser(MessageServerInfo serv,
UUID agentID, UUID sessionID, UUID RegionID, UUID agentID, UUID sessionID, UUID RegionID,
ulong regionhandle, float positionX, float positionY, float positionZ, ulong regionhandle, float positionX, float positionY, float positionZ,
@ -331,7 +380,9 @@ namespace OpenSim.Grid.UserServer
PresenceNotification presence = m_NotifyQueue.Dequeue(); PresenceNotification presence = m_NotifyQueue.Dequeue();
if (presence.request == NotificationRequest.Shutdown) if (presence.request == NotificationRequest.Shutdown)
return; {
TellMessageServersAboutRegionShutdownInternal(presence.RegionID);
}
if (presence.request == NotificationRequest.Login) if (presence.request == NotificationRequest.Login)
{ {

View File

@ -790,6 +790,10 @@ namespace OpenSim.Grid.UserServer
userProfile.LastLogin = userAgent.LogoutTime; userProfile.LastLogin = userAgent.LogoutTime;
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
handlerLogOffUser = OnLogOffUser;
if (handlerLogOffUser != null)
handlerLogOffUser(agentID);
} }
} }
} }