* Tidy up OGS1GridServices

* Remove what should be unnecessary RemoteException catches when executing local backend calls
0.6.0-stable
Justin Clarke Casey 2008-09-20 19:55:49 +00:00
parent 23ea8f5221
commit 41728f8a33
1 changed files with 39 additions and 101 deletions

View File

@ -51,8 +51,9 @@ namespace OpenSim.Region.Communications.OGS1
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// FIXME: LocalBackEndServices should to be refactored into a separate common parent class rather than /// <summary>
// encapsulated. /// Encapsulate local backend services for manipulation of local regions
/// </summary>
private LocalBackEndServices m_localBackend = new LocalBackEndServices(); private LocalBackEndServices m_localBackend = new LocalBackEndServices();
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
@ -65,31 +66,24 @@ namespace OpenSim.Region.Communications.OGS1
public NetworkServersInfo serversInfo; public NetworkServersInfo serversInfo;
public BaseHttpServer httpServer; public BaseHttpServer httpServer;
public string _gdebugRegionName = String.Empty;
public string gdebugRegionName public string gdebugRegionName
{ {
get { return _gdebugRegionName; } get { return m_localBackend.gdebugRegionName; }
set { _gdebugRegionName = value; } set { m_localBackend.gdebugRegionName = value; }
} }
public string _rdebugRegionName = String.Empty;
public string rdebugRegionName public string rdebugRegionName
{ {
get { return _rdebugRegionName; } get { return _rdebugRegionName; }
set { _rdebugRegionName = value; } set { _rdebugRegionName = value; }
} }
private string _rdebugRegionName = String.Empty;
/// <summary>
/// Doesn't have any effect yet!
/// </summary>
public bool RegionLoginsEnabled public bool RegionLoginsEnabled
{ {
get { return m_regionLoginsEnabled; } get { return m_localBackend.RegionLoginsEnabled; }
set { m_regionLoginsEnabled = value; } set { m_localBackend.RegionLoginsEnabled = value; }
} }
private bool m_regionLoginsEnabled;
/// <summary> /// <summary>
/// Contructor. Adds "expect_user" and "check" xmlrpc method handlers /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers
@ -195,6 +189,7 @@ namespace OpenSim.Region.Communications.OGS1
"[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}", "[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}",
regionInfo.RegionName, serversInfo.GridURL); regionInfo.RegionName, serversInfo.GridURL);
} }
return m_localBackend.RegisterRegion(regionInfo); return m_localBackend.RegisterRegion(regionInfo);
} }
@ -223,7 +218,6 @@ namespace OpenSim.Region.Communications.OGS1
return false; return false;
} }
// What does DeregisterRegion() do?
return m_localBackend.DeregisterRegion(regionInfo); return m_localBackend.DeregisterRegion(regionInfo);
} }
@ -572,6 +566,7 @@ namespace OpenSim.Region.Communications.OGS1
param["ymax"] = maxY; param["ymax"] = maxY;
IList parameters = new ArrayList(); IList parameters = new ArrayList();
parameters.Add(param); parameters.Add(param);
try try
{ {
XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
@ -646,7 +641,7 @@ namespace OpenSim.Region.Communications.OGS1
XmlRpcResponse resp = new XmlRpcResponse(); XmlRpcResponse resp = new XmlRpcResponse();
if (!m_regionLoginsEnabled) if (!RegionLoginsEnabled)
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled",
@ -709,6 +704,7 @@ namespace OpenSim.Region.Communications.OGS1
public XmlRpcResponse LogOffUser(XmlRpcRequest request) public XmlRpcResponse LogOffUser(XmlRpcRequest request)
{ {
m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called"); m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called");
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
string message = (string)requestData["message"]; string message = (string)requestData["message"];
UUID agentID = UUID.Zero; UUID agentID = UUID.Zero;
@ -718,11 +714,8 @@ namespace OpenSim.Region.Communications.OGS1
ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message); m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message);
return new XmlRpcResponse(); return new XmlRpcResponse();
} }
@ -913,7 +906,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
remObject = null; remObject = null;
m_log.Info("[OGS1 GRID SERVICES]: " + m_log.Info("[OGS1 GRID SERVICES]: " +
gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + m_localBackend._gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
agentData.firstname + " " + agentData.lastname + " and got " + agentData.firstname + " " + agentData.lastname + " and got " +
retValue.ToString()); retValue.ToString());
@ -1029,7 +1022,9 @@ namespace OpenSim.Region.Communications.OGS1
m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found");
} }
remObject = null; remObject = null;
m_log.Info("[INTER]: " + gdebugRegionName + ": OGS1 tried to inform region I'm up");
m_log.Info(
"[INTER]: " + m_localBackend._gdebugRegionName + ": OGS1 tried to inform region I'm up");
return retValue; return retValue;
} }
@ -1472,31 +1467,22 @@ namespace OpenSim.Region.Communications.OGS1
{ {
//m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); //m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname);
try
{
return m_localBackend.IncomingChildAgent(regionHandle, agentData); return m_localBackend.IncomingChildAgent(regionHandle, agentData);
} }
catch (RemotingException)
{
//m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
}
public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle)
{ {
m_log.Info("[OGS1 GRID SERVICES]: " + m_log.Info(
gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X + "[OGS1 GRID SERVICES]: " +
m_localBackend._gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X +
"," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries");
RegionInfo nRegionInfo = new RegionInfo(); RegionInfo nRegionInfo = new RegionInfo();
nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT);
nRegionInfo.ExternalHostName = regionData.IPADDR; nRegionInfo.ExternalHostName = regionData.IPADDR;
nRegionInfo.RegionLocX = regionData.X; nRegionInfo.RegionLocX = regionData.X;
nRegionInfo.RegionLocY = regionData.Y; nRegionInfo.RegionLocY = regionData.Y;
try
{
lock (m_deadRegionCache) lock (m_deadRegionCache)
{ {
if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle))
@ -1508,27 +1494,12 @@ namespace OpenSim.Region.Communications.OGS1
return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle);
} }
catch (RemotingException e)
{
m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
}
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{ {
//m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update"); //m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update");
try
{
return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData);
} }
catch (RemotingException e)
{
m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
}
/// <summary> /// <summary>
/// ///
@ -1537,19 +1508,10 @@ namespace OpenSim.Region.Communications.OGS1
/// <param name="agentData"></param> /// <param name="agentData"></param>
/// <returns></returns> /// <returns></returns>
public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
// Is this necessary?
try
{ {
m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod);
return true; return true;
//m_localBackend.
}
catch (RemotingException e)
{
m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
} }
/// <summary> /// <summary>
@ -1560,43 +1522,19 @@ namespace OpenSim.Region.Communications.OGS1
/// <param name="position"></param> /// <param name="position"></param>
/// <returns></returns> /// <returns></returns>
public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
try
{ {
return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
} }
catch (RemotingException e)
{
m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
}
public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical)
{
try
{ {
return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical);
} }
catch (RemotingException e)
{
m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
}
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
try
{ {
return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
} }
catch (RemotingException)
{
m_log.Info("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to neighbour to tell it to close a child connection");
return false;
}
}
#endregion #endregion