* Allow a grid mode region simulator to properly shutdown even if the grid service is offline
0.6.0-stable
Justin Clarke Casey 2008-09-21 16:58:14 +00:00
parent f6071c030d
commit 1a71a3a567
4 changed files with 45 additions and 6 deletions

View File

@ -47,6 +47,12 @@ namespace OpenSim.Framework.Communications
/// <exception cref="System.Exception">Thrown if region registration failed</exception> /// <exception cref="System.Exception">Thrown if region registration failed</exception>
RegionCommsListener RegisterRegion(RegionInfo regionInfos); RegionCommsListener RegisterRegion(RegionInfo regionInfos);
/// <summary>
/// Deregister a region with the grid service.
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
/// <exception cref="System.Exception">Thrown if region deregistration failed</exception>
bool DeregisterRegion(RegionInfo regionInfo); bool DeregisterRegion(RegionInfo regionInfo);
/// <summary> /// <summary>

View File

@ -96,6 +96,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// A list of the packets we haven't acked yet // A list of the packets we haven't acked yet
// //
private Dictionary<uint,uint> m_PendingAcks = new Dictionary<uint,uint>(); private Dictionary<uint,uint> m_PendingAcks = new Dictionary<uint,uint>();
// Dictionary of the packets that need acks from the client. // Dictionary of the packets that need acks from the client.
// //
private class AckData private class AckData
@ -109,6 +110,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public Packet Packet; public Packet Packet;
public Object Identifier; public Object Identifier;
} }
private Dictionary<uint, AckData> m_NeedAck = private Dictionary<uint, AckData> m_NeedAck =
new Dictionary<uint, AckData>(); new Dictionary<uint, AckData>();

View File

@ -141,11 +141,11 @@ namespace OpenSim.Region.Communications.OGS1
SendParams.Add(GridParams); SendParams.Add(GridParams);
// Send Request // Send Request
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
XmlRpcResponse GridResp; XmlRpcResponse GridResp;
try try
{ {
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
// The timeout should always be significantly larger than the timeout for the grid server to request // The timeout should always be significantly larger than the timeout for the grid server to request
// the initial status of the region before confirming registration. // the initial status of the region before confirming registration.
GridResp = GridReq.Send(serversInfo.GridURL, 90000); GridResp = GridReq.Send(serversInfo.GridURL, 90000);
@ -154,7 +154,9 @@ namespace OpenSim.Region.Communications.OGS1
{ {
Exception e2 Exception e2
= new Exception( = new Exception(
String.Format("Unable to connect to grid at {0}. Grid service not running?", serversInfo.GridURL), String.Format(
"Unable to register region with grid at {0}. Grid service not running?",
serversInfo.GridURL),
e); e);
throw(e2); throw(e2);
@ -193,6 +195,7 @@ namespace OpenSim.Region.Communications.OGS1
return m_localBackend.RegisterRegion(regionInfo); return m_localBackend.RegisterRegion(regionInfo);
} }
// see IGridServices
public bool DeregisterRegion(RegionInfo regionInfo) public bool DeregisterRegion(RegionInfo regionInfo)
{ {
Hashtable GridParams = new Hashtable(); Hashtable GridParams = new Hashtable();
@ -205,7 +208,24 @@ namespace OpenSim.Region.Communications.OGS1
// Send Request // Send Request
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams);
XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000); XmlRpcResponse GridResp = null;
try
{
GridResp = GridReq.Send(serversInfo.GridURL, 10000);
}
catch (Exception e)
{
Exception e2
= new Exception(
String.Format(
"Unable to deregister region with grid at {0}. Grid service not running?",
serversInfo.GridURL),
e);
throw(e2);
}
Hashtable GridRespData = (Hashtable) GridResp.Value; Hashtable GridRespData = (Hashtable) GridResp.Value;
// Hashtable griddatahash = GridRespData; // Hashtable griddatahash = GridRespData;

View File

@ -135,7 +135,18 @@ namespace OpenSim.Region.Environment.Scenes
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
regionCommsHost.OnCloseAgentConnection -= CloseConnection; regionCommsHost.OnCloseAgentConnection -= CloseConnection;
regionCommsHost.OnGetLandData -= FetchLandData; regionCommsHost.OnGetLandData -= FetchLandData;
try
{
m_commsProvider.GridService.DeregisterRegion(m_regionInfo); m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
m_regionInfo.RegionName, e);
}
regionCommsHost = null; regionCommsHost = null;
} }
} }