From 1a71a3a56776bc1d91f9da031a295fd4a0023e87 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sun, 21 Sep 2008 16:58:14 +0000
Subject: * Fix http://opensimulator.org/mantis/view.php?id=2189 * Allow a grid
mode region simulator to properly shutdown even if the grid service is
offline
---
OpenSim/Framework/Communications/IGridServices.cs | 6 +++++
.../ClientStack/LindenUDP/LLPacketHandler.cs | 2 ++
.../Region/Communications/OGS1/OGS1GridServices.cs | 30 ++++++++++++++++++----
.../Scenes/SceneCommunicationService.cs | 13 +++++++++-
4 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index f6a2885..177009d 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -47,6 +47,12 @@ namespace OpenSim.Framework.Communications
/// Thrown if region registration failed
RegionCommsListener RegisterRegion(RegionInfo regionInfos);
+ ///
+ /// Deregister a region with the grid service.
+ ///
+ ///
+ ///
+ /// Thrown if region deregistration failed
bool DeregisterRegion(RegionInfo regionInfo);
///
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index eddee10..d885e3b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -96,6 +96,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// A list of the packets we haven't acked yet
//
private Dictionary m_PendingAcks = new Dictionary();
+
// Dictionary of the packets that need acks from the client.
//
private class AckData
@@ -109,6 +110,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public Packet Packet;
public Object Identifier;
}
+
private Dictionary m_NeedAck =
new Dictionary();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 45d0931..537947b 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -141,11 +141,11 @@ namespace OpenSim.Region.Communications.OGS1
SendParams.Add(GridParams);
// Send Request
+ XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
XmlRpcResponse GridResp;
+
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 initial status of the region before confirming registration.
GridResp = GridReq.Send(serversInfo.GridURL, 90000);
@@ -154,7 +154,9 @@ namespace OpenSim.Region.Communications.OGS1
{
Exception e2
= 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);
throw(e2);
@@ -193,6 +195,7 @@ namespace OpenSim.Region.Communications.OGS1
return m_localBackend.RegisterRegion(regionInfo);
}
+ // see IGridServices
public bool DeregisterRegion(RegionInfo regionInfo)
{
Hashtable GridParams = new Hashtable();
@@ -205,7 +208,24 @@ namespace OpenSim.Region.Communications.OGS1
// Send Request
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 griddatahash = GridRespData;
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 887a8da..c95068b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -135,7 +135,18 @@ namespace OpenSim.Region.Environment.Scenes
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
regionCommsHost.OnCloseAgentConnection -= CloseConnection;
regionCommsHost.OnGetLandData -= FetchLandData;
- m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
+
+ try
+ {
+ 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;
}
}
--
cgit v1.1