THE BIG ANTI-REMOTING SCHLEP -- StartRemoting is no more. Sims in older versions will have a hard time communicating with sims on this release and later, especially if they haven't transitioned to RESTComms at all.

There's still some cleanup to do on assorted data structures, but the main functional change here is that sims no longer listen on remoting ports.
GenericGridServerConcept
diva 2009-02-20 03:39:50 +00:00
parent 7d4846462b
commit 33330297d6
17 changed files with 6 additions and 2632 deletions

View File

@ -59,12 +59,6 @@ namespace OpenSim.Framework.Communications
}
protected IGridServices m_gridService;
public IInterRegionCommunications InterRegion
{
get { return m_interRegion; }
}
protected IInterRegionCommunications m_interRegion;
public UserProfileCacheService UserProfileCacheService
{
get { return m_userProfileCacheService; }

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
using OpenMetaverse;
namespace OpenSim.Framework.Communications
{
public interface IInterRegionCommunications
{
string rdebugRegionName { get; set; }
bool CheckRegion(string address, uint port);
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod);
bool RegionUp(SerializableRegionInfo region, ulong regionhandle);
bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying);
bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying);
bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId);
bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID);
bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID);
}
}

View File

@ -95,7 +95,7 @@ namespace OpenSim
m_commsManager = new HGCommunicationsStandalone(m_networkServersInfo, m_httpServer, m_assetCache,
userService, userService, inventoryService, gridService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile);
userService, userService, inventoryService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile);
inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService;
HGServices = gridService;

View File

@ -274,7 +274,7 @@ namespace OpenSim
m_commsManager
= new CommunicationsLocal(
m_networkServersInfo, m_httpServer, m_assetCache, userService, userService,
inventoryService, backendService, backendService, userService,
inventoryService, backendService, userService,
libraryRootFolder, m_configSettings.DumpAssetsToFile);
// set up XMLRPC handler for client's initial login request message

View File

@ -56,7 +56,6 @@ namespace OpenSim.Region.Communications.Hypergrid
// From constructor at CommunicationsOGS1
HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService);
m_gridService = gridInterComms;
m_interRegion = gridInterComms;
m_osw = gridInterComms;
// The HG InventoryService always uses secure handlers

View File

@ -44,9 +44,8 @@ namespace OpenSim.Region.Communications.Hypergrid
IUserService userService,
IUserAdminService userServiceAdmin,
LocalInventoryService inventoryService,
IInterRegionCommunications interRegionService,
HGGridServices gridService, IMessagingService messageService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, userService, userServiceAdmin, inventoryService, interRegionService, gridService, messageService, libraryRootFolder, dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, userService, userServiceAdmin, inventoryService, gridService, messageService, libraryRootFolder, dumpAssetsToFile)
{
gridService.UserProfileCache = m_userProfileCacheService;
m_assetCache = assetCache;

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Communications.Hypergrid
/// hyperlinks, as well as processing all the inter-region comms between a region and
/// an hyperlinked region.
/// </summary>
public class HGGridServices : IGridServices, IInterRegionCommunications, IHyperlink
public class HGGridServices : IGridServices, IHyperlink
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -777,80 +777,6 @@ namespace OpenSim.Region.Communications.Hypergrid
return resp;
}
#region IInterRegionCommunications interface
public virtual bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) { return false; }
public virtual bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) { return false; }
public virtual bool CheckRegion(string address, uint port) { return false; }
public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { return false; }
public virtual bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) {
// Remote region
RegionInfo regInfo = null;
ulong remoteHandle = 0;
try
{
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
try
{
remoteHandle = Convert.ToUInt64(regInfo.regionSecret);
}
catch
{
m_log.Warn("[HGrid]: Invalid remote region with handle " + regInfo.regionSecret);
return false;
}
//Console.WriteLine("XXX---- Sending Expectavatarcrossing into : " + remoteHandle);
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
remObject.ExpectAvatarCrossing(remoteHandle, agentID.Guid, new sLLVector3(position),
isFlying);
}
else
{
m_log.Warn("[HGrid]: Remoting object not found");
}
remObject = null;
return retValue;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
//NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
// NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch
{
// NoteDeadRegion(regionHandle);
return false;
}
}
public virtual bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) { return false; }
public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData)
{
CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
@ -887,260 +813,6 @@ namespace OpenSim.Region.Communications.Hypergrid
return true;
}
public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
// If we're here, it's because regionHandle is a remote, non-grided region
m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle);
RegionInfo regInfo = GetHyperlinkRegion(regionHandle);
if (regInfo == null)
return false;
//ulong realHandle = regionHandle;
if (!SendUserInformation(regInfo, agentData))
{
m_log.Warn("[HGrid]: Failed to inform remote region of user.");
//return false;
}
try
{
// ... and then
m_log.Debug("[HGrid]: Region is hyperlink.");
bool retValue = false;
try
{
regionHandle = Convert.ToUInt64(regInfo.regionSecret);
}
catch (Exception)
{
m_log.Warn("[HGrid]: Invalid hyperlink region.");
return false;
}
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
sAgentCircuitData sag = new sAgentCircuitData(agentData);
//CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
//// May need to change agent's name
//if (IsLocalUser(uinfo))
//{
// sag.firstname = agentData.firstname + "." + agentData.lastname;
// sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
//}
retValue = remObject.InformRegionOfChildAgent(regionHandle, sag);
}
else
{
m_log.Warn("[HGrid]: remoting object not found");
}
remObject = null;
m_log.Info("[HGrid]: tried to InformRegionOfChildAgent for " +
agentData.firstname + " " + agentData.lastname + " and got " +
retValue.ToString());
// Remove the info from this region
//if (m_knownRegions.ContainsKey(uinfo.UserProfile.ID))
// m_knownRegions.Remove(uinfo.UserProfile.ID);
return retValue;
}
catch (RemotingException e)
{
//NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
//NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
//NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
//NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
//NoteDeadRegion(regionHandle);
if (regInfo != null)
{
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
}
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
}
public virtual bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) { return false; }
public virtual bool RegionUp(SerializableRegionInfo region, ulong regionhandle) {
ulong realHandle = FindRegionHandle(regionhandle);
if (realHandle == regionhandle) // something wrong, not remote region
return false;
SerializableRegionInfo regInfo = null;
try
{
// You may ask why this is in here...
// The region asking the grid services about itself..
// And, surprisingly, the reason is.. it doesn't know
// it's own remoting port! How special.
RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);
region = new SerializableRegionInfo(RequestNeighbourInfo(realHandle));
region.RemotingAddress = region.ExternalHostName;
region.RemotingPort = NetworkServersInfo.RemotingListenerPort;
region.HttpPort = serversInfo.HttpListenerPort;
regInfo = new SerializableRegionInfo(RequestNeighbourInfo(regionhandle));
if (regInfo != null)
{
// If we're not trying to remote to ourselves.
if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.RegionUp(regiondata, realHandle);
}
else
{
m_log.Warn("[HGrid]: remoting object not found");
}
remObject = null;
m_log.Info(
"[HGrid]: tried to inform region I'm up");
return retValue;
}
else
{
// We're trying to inform ourselves via remoting.
// This is here because we're looping over the listeners before we get here.
// Odd but it should work.
return true;
}
}
return false;
}
catch (RemotingException e)
{
m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
" - Is this neighbor up?");
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
m_log.Warn("[HGrid]: Socket Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
" - Is this neighbor up?");
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
m_log.Debug(e.ToString());
return false;
}
}
public virtual bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) { return false; }
public virtual List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online)
{
return new List<UUID>();
}
public virtual bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID)
{
return true;
}
#endregion
#region Methods triggered by calls from external instances

View File

@ -71,9 +71,6 @@ namespace OpenSim.Region.Communications.Hypergrid
: base(servers_info, httpServe, asscache, sman)
{
m_remoteBackend = new OGS1GridServices(servers_info, httpServe);
// Let's deregister this, so we can handle it here first
InterRegionSingleton.Instance.OnChildAgent -= m_remoteBackend.IncomingChildAgent;
InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
m_userProfileCache = userv;
}
@ -158,125 +155,6 @@ namespace OpenSim.Region.Communications.Hypergrid
#endregion
#region IInterRegionCommunications interface
public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId)
{
return m_remoteBackend.AcknowledgeAgentCrossed(regionHandle, agentId);
}
public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID)
{
return m_remoteBackend.AcknowledgePrimCrossed(regionHandle, primID);
}
public override bool CheckRegion(string address, uint port)
{
return m_remoteBackend.CheckRegion(address, port);
}
public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
return m_remoteBackend.ChildAgentUpdate(regionHandle, cAgentData);
}
public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
if (base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying))
return true;
return m_remoteBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
}
public override bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying)
{
return m_remoteBackend.ExpectPrimCrossing(regionHandle, primID, position, isFlying);
}
public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
CachedUserInfo user = m_userProfileCache.GetUserDetails(agentData.AgentID);
if (IsLocalUser(user))
{
Console.WriteLine("XXX Home User XXX");
if (IsHyperlinkRegion(regionHandle))
{
Console.WriteLine("XXX Going Hyperlink XXX");
return base.InformRegionOfChildAgent(regionHandle, agentData);
}
else
{
// non-hypergrid case
Console.WriteLine("XXX Going local-grid region XXX");
return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData);
}
}
// Foregin users
Console.WriteLine("XXX Foreign User XXX");
if (IsLocalRegion(regionHandle)) // regions on the same instance
{
Console.WriteLine("XXX Going onInstance region XXX");
return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData);
}
if (IsHyperlinkRegion(regionHandle)) // hyperlinked regions
{
Console.WriteLine("XXX Going Hyperlink XXX");
return base.InformRegionOfChildAgent(regionHandle, agentData);
}
else
{
// foreign user going to a non-local region on the same grid
// We need to inform that region about this user before
// proceeding to the normal backend process.
Console.WriteLine("XXX Going local-grid region XXX");
RegionInfo regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
// For now, don't test if this succeeds/fails; until someone complains, this is a feature :-)
InformRegionOfUser(regInfo, agentData);
return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData);
}
}
public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
return m_remoteBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod);
}
public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle)
{
if (m_remoteBackend.RegionUp(region, regionhandle))
return true;
return base.RegionUp(region, regionhandle);
}
public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
return m_remoteBackend.TellRegionToCloseChildConnection(regionHandle, agentID);
}
#endregion
#region Methods triggered by calls from external instances
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
AdjustUserInformation(agentData);
m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);
return m_remoteBackend.IncomingChildAgent(regionHandle, agentData);
}
#endregion
}
}

View File

@ -84,7 +84,6 @@ namespace OpenSim.Region.Communications.Hypergrid
httpServer.AddXmlRPCHandler("check", PingCheckReply);
httpServer.AddXmlRPCHandler("land_data", LandData);
StartRemoting();
}
#region IGridServices interface
@ -256,683 +255,5 @@ namespace OpenSim.Region.Communications.Hypergrid
#endregion
#region Remoting
/// <summary>
/// Start listening for .net remoting calls from other regions.
/// </summary>
private void StartRemoting()
{
m_log.Info("[HGrid]: Start remoting...");
TcpChannel ch;
try
{
ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort);
ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this.
}
catch (Exception ex)
{
m_log.Error("[HGrid]: Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + ".");
throw (ex);
}
WellKnownServiceTypeEntry wellType =
new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions",
WellKnownObjectMode.Singleton);
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing;
InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate;
InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection;
}
#endregion
#region IInterRegionCommunications interface (Methods called by regions in this instance)
public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
int failures = 0;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionHandle))
{
failures = m_deadRegionCache[regionHandle];
}
}
if (failures <= 3)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData);
}
else
{
m_log.Warn("[HGrid]: remoting object not found");
}
remObject = null;
return retValue;
}
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat("[HGrid]: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
}
else
{
//m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString());
return false;
}
}
/// <summary>
/// Inform a region that a child agent will be on the way from a client.
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData))
{
return true;
}
return base.InformRegionOfChildAgent(regionHandle, agentData);
}
// UGLY!
public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle)
{
if (m_localBackend.RegionUp(region, regionhandle))
return true;
return base.RegionUp(region, regionhandle);
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
int failures = 0;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionHandle))
{
failures = m_deadRegionCache[regionHandle];
}
}
if (failures <= 1)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
try
{
regionHandle = Convert.ToUInt64(regInfo.regionSecret);
}
catch (Exception)
{
m_log.Warn("[HGrid]: Invalid hyperlink region.");
return false;
}
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
m_log.Debug("[HGrid]: Inform region of prim crossing: " + regInfo.RemotingAddress + ":" + regInfo.RemotingPort);
retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod);
}
else
{
m_log.Warn("[HGrid]: Remoting object not found");
}
remObject = null;
return retValue;
}
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0}", e);
return false;
}
}
else
{
return false;
}
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
RegionInfo[] regions = m_regionsOnInstance.ToArray();
bool banned = false;
bool localregion = false;
for (int i = 0; i < regions.Length; i++)
{
if (regions[i] != null)
{
if (regions[i].RegionHandle == regionHandle)
{
localregion = true;
if (regions[i].EstateSettings.IsBanned(agentID))
{
banned = true;
break;
}
}
}
}
if (banned)
return false;
if (localregion)
return m_localBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
return base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
}
public override bool ExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position),
isPhysical);
}
else
{
m_log.Warn("[HGrid]: Remoting object not found");
}
remObject = null;
return retValue;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[HGrid]: {0}", e);
return false;
}
}
public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
m_log.Debug("[HGrid]: TellRegion " + regionHandle + " ToCloseChildConnection for " + agentID);
RegionInfo regInfo = null;
try
{
if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
// bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
// retValue =
remObject.TellRegionToCloseChildConnection(regionHandle, agentID.Guid);
}
else
{
m_log.Warn("[HGrid]: Remoting object not found");
}
remObject = null;
return true;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
//m_log.Debug(e.ToString());
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGridS]: Socket Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
" - Is this neighbor up?");
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (WebException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[HGrid]: WebException exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
// This line errors with a Null Reference Exception.. Why? @.@
//m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
// ":" + regInfo.RemotingPort +
//"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one");
m_log.DebugFormat("[HGrid]: {0}", e);
return false;
}
}
public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId)
{
return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId);
}
public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primId)
{
return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId);
}
#endregion
#region Methods triggered by calls from external instances
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
AdjustUserInformation(agentData);
m_log.Info("[HGrid]: " + gdebugRegionName + ": Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);
return m_localBackend.IncomingChildAgent(regionHandle, agentData);
}
public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle)
{
m_log.Info(
"[HGrid]: " +
m_localBackend._gdebugRegionName + "Incoming HGrid RegionUpReport: " + "(" + regionData.X +
"," + regionData.Y + "). Giving this region a fresh set of 'dead' tries");
RegionInfo nRegionInfo = new RegionInfo();
nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT);
nRegionInfo.ExternalHostName = regionData.IPADDR;
nRegionInfo.RegionLocX = regionData.X;
nRegionInfo.RegionLocY = regionData.Y;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle))
{
m_deadRegionCache.Remove(nRegionInfo.RegionHandle);
}
}
return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle);
}
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
//m_log.Info("[INTER]: Incoming HGrid Child Agent Data Update");
return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData);
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
m_log.Debug("[HGrid]: Incoming Prim");
m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod);
return true;
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
}
public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical)
{
return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical);
}
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
}
int timeOut = 10; //10 seconds
/// <summary>
/// Check that a region is available for TCP comms. This is necessary for .NET remoting between regions.
/// </summary>
/// <param name="address"></param>
/// <param name="port"></param>
/// <param name="retry"></param>
/// <returns></returns>
public bool CheckRegion(string address, uint port, bool retry)
{
bool available = false;
bool timed_out = true;
IPAddress ia;
IPAddress.TryParse(address, out ia);
IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port);
AsyncCallback callback = delegate(IAsyncResult iar)
{
Socket s = (Socket)iar.AsyncState;
try
{
s.EndConnect(iar);
available = true;
timed_out = false;
}
catch (Exception e)
{
m_log.DebugFormat(
"[HGrid]: Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace);
}
s.Close();
};
try
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket);
ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
}
catch (Exception e)
{
m_log.DebugFormat(
"[HGrid]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace);
return false;
}
if (timed_out)
{
m_log.DebugFormat(
"[HGrid]: socket [{0}] timed out ({1}) waiting to obtain a connection.",
m_EndPoint, timeOut * 1000);
if (retry)
{
return CheckRegion(address, port, false);
}
}
return available;
}
public override bool CheckRegion(string address, uint port)
{
return CheckRegion(address, port, true);
}
public void NoteDeadRegion(ulong regionhandle)
{
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionhandle))
{
m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1;
}
else
{
m_deadRegionCache.Add(regionhandle, 1);
}
}
}
#endregion
}
}

View File

@ -41,7 +41,6 @@ namespace OpenSim.Region.Communications.Local
IUserService userService,
IUserAdminService userServiceAdmin,
LocalInventoryService inventoryService,
IInterRegionCommunications interRegionService,
IGridServices gridService, IMessagingService messageService,
LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
@ -53,7 +52,6 @@ namespace OpenSim.Region.Communications.Local
m_userAdminService = userServiceAdmin;
m_avatarService = (IAvatarService)userService;
m_gridService = gridService;
m_interRegion = interRegionService;
m_messageService = messageService;
}
}

View File

@ -36,7 +36,7 @@ using OpenSim.Framework.Communications;
namespace OpenSim.Region.Communications.Local
{
public class LocalBackEndServices : IGridServices, IInterRegionCommunications
public class LocalBackEndServices : IGridServices
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -244,46 +244,6 @@ namespace OpenSim.Region.Communications.Local
return mapBlocks;
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(agentID);
}
return false;
}
public virtual bool RegionUp(SerializableRegionInfo sregion, ulong regionhandle)
{
RegionInfo region = new RegionInfo(sregion);
//region.RegionLocX = sregion.X;
//region.RegionLocY = sregion.Y;
//region.SetEndPoint(sregion.IPADDR, sregion.PORT);
//sregion);
if (m_regionListeners.ContainsKey(regionhandle))
{
return m_regionListeners[regionhandle].TriggerRegionUp(region);
}
return false;
}
public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
m_regionListeners[regionHandle].TriggerChildAgentUpdate(cAgentData);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
return true;
}
return false;
}
// This function is only here to keep this class in line with the Grid Interface.
// It never gets called.
public virtual Dictionary<string, string> GetGridSettings()
@ -303,124 +263,6 @@ namespace OpenSim.Region.Communications.Local
m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
}
public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
{
if (m_regionListeners.ContainsKey(regionhandle))
{
return m_regionListeners[regionhandle].TriggerRegionUp(region);
}
return false;
}
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return m_regionListeners[regionHandle].TriggerChildAgentUpdate(cAgentData);
}
return false;
}
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(agentID);
}
return false;
}
/// <summary>
/// Tell a region to expect a new client connection.
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
// TODO: should change from agentCircuitData
{
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
if (m_regionListeners.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
m_regionListeners[regionHandle].TriggerExpectUser(agentData);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
return true;
}
return false;
}
/// <summary>
/// Tell a region to expect the crossing in of a new prim.
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="primID"></param>
/// <param name="objData"></param>
/// <param name="XMLMethod"></param>
/// <returns></returns>
public bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
m_regionListeners[regionHandle].TriggerExpectPrim(primID, objData, XMLMethod);
return true;
}
return false;
}
/// <summary>
/// Tell a region to get prepare for an avatar to cross into it.
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(agentID, position, isFlying);
return true;
}
return false;
}
public bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
m_regionListeners[regionHandle].TriggerExpectPrimCrossing(primID, position, isPhysical);
return true;
}
return false;
}
public bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return true;
}
return false;
}
public bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return true;
}
return false;
}
/// <summary>
/// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
@ -474,14 +316,6 @@ namespace OpenSim.Region.Communications.Local
}
}
public void TriggerExpectPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
m_regionListeners[regionHandle].TriggerExpectPrim(primID, objData, XMLMethod);
}
}
public void PingCheckReply(Hashtable respData)
{
foreach (ulong region in m_regions.Keys)
@ -495,40 +329,6 @@ namespace OpenSim.Region.Communications.Local
}
}
public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(agentID, position, isFlying);
}
return false;
}
public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return
m_regionListeners[regionHandle].TriggerExpectPrimCrossing(primID, position, isPhysical);
}
return false;
}
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
// m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
if (m_regionListeners.ContainsKey(regionHandle))
{
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname);
TriggerExpectUser(regionHandle, agentData);
return true;
}
return false;
}
public LandData RequestLandData (ulong regionHandle, uint x, uint y)
{
@ -560,20 +360,5 @@ namespace OpenSim.Region.Communications.Local
return regions;
}
public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online)
{
// if we get to here, something is wrong: We are in standalone mode, but have users that are not on our server?
m_log.WarnFormat("[INTERREGION STANDALONE] Did find {0} users on a region not on our server: {1} ???",
friends.Count, destRegionHandle);
return new List<UUID>();
}
public bool TriggerTerminateFriend (ulong regionHandle, UUID agentID, UUID exFriendID)
{
// if we get to here, something is wrong: We are in standalone mode, but have users that are not on our server?
m_log.WarnFormat("[INTERREGION STANDALONE] Did find user {0} on a region not on our server: {1} ???",
agentID, regionHandle);
return true;
}
}
}

View File

@ -41,7 +41,6 @@ namespace OpenSim.Region.Communications.OGS1
{
OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
m_gridService = gridInterComms;
m_interRegion = gridInterComms;
if (serversInfo.secureInventoryServer)
{

View File

@ -31,9 +31,6 @@ using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Security.Authentication;
using log4net;
using Nwc.XmlRpc;
@ -45,7 +42,7 @@ using OpenSim.Region.Communications.Local;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1GridServices : IGridServices, IInterRegionCommunications
public class OGS1GridServices : IGridServices
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -99,7 +96,6 @@ namespace OpenSim.Region.Communications.OGS1
httpServer.AddXmlRPCHandler("check", PingCheckReply);
httpServer.AddXmlRPCHandler("land_data", LandData);
StartRemoting();
}
// see IGridServices
@ -716,913 +712,6 @@ namespace OpenSim.Region.Communications.OGS1
return new XmlRpcResponse();
}
#region m_interRegion Comms
/// <summary>
/// Start listening for .net remoting calls from other regions.
/// </summary>
private void StartRemoting()
{
TcpChannel ch;
try
{
ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort);
ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this.
}
catch (Exception ex)
{
m_log.Error("[OGS1 GRID SERVICES]: Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + ".");
throw (ex);
}
WellKnownServiceTypeEntry wellType =
new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions",
WellKnownObjectMode.Singleton);
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing;
InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate;
InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection;
}
#region Methods called by regions in this instance
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
int failures = 0;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionHandle))
{
failures = m_deadRegionCache[regionHandle];
}
}
if (failures <= 3)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData);
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found");
}
remObject = null;
// m_log.Info("[INTER]: " +
// gdebugRegionName +
// ": OGS1 tried to Update Child Agent data on outside region and got " +
// retValue.ToString());
return retValue;
}
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat("[OGS1 GRID SERVICES]: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
}
else
{
//m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString());
return false;
}
}
/// <summary>
/// Inform a region that a child agent will be on the way from a client.
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found");
}
remObject = null;
m_log.Info("[OGS1 GRID SERVICES]: " +
m_localBackend._gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
agentData.firstname + " " + agentData.lastname + " and got " +
retValue.ToString());
return retValue;
}
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
if (regInfo != null)
{
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
}
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
}
// UGLY!
public bool RegionUp(SerializableRegionInfo region, ulong regionhandle)
{
SerializableRegionInfo regInfo = null;
try
{
// You may ask why this is in here...
// The region asking the grid services about itself..
// And, surprisingly, the reason is.. it doesn't know
// it's own remoting port! How special.
RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);
region = new SerializableRegionInfo(RequestNeighbourInfo(region.RegionHandle));
region.RemotingAddress = region.ExternalHostName;
region.RemotingPort = NetworkServersInfo.RemotingListenerPort;
region.HttpPort = serversInfo.HttpListenerPort;
if (m_localBackend.RegionUp(region, regionhandle))
{
return true;
}
regInfo = new SerializableRegionInfo(RequestNeighbourInfo(regionhandle));
if (regInfo != null)
{
// If we're not trying to remote to ourselves.
if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.RegionUp(regiondata, regionhandle);
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found");
}
remObject = null;
m_log.Info(
"[INTER]: " + m_localBackend._gdebugRegionName + ": OGS1 tried to inform region I'm up");
return retValue;
}
else
{
// We're trying to inform ourselves via remoting.
// This is here because we're looping over the listeners before we get here.
// Odd but it should work.
return true;
}
}
return false;
}
catch (RemotingException e)
{
m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
" - Is this neighbor up?");
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
m_log.Warn("[OGS1 GRID SERVICES]: Socket Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
" - Is this neighbor up?");
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credentials: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
// This line errors with a Null Reference Exception.. Why? @.@
//m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
// ":" + regInfo.RemotingPort +
//"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one");
m_log.Debug(e.ToString());
return false;
}
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
int failures = 0;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionHandle))
{
failures = m_deadRegionCache[regionHandle];
}
}
if (failures <= 1)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
m_log.DebugFormat("[INTERREGION]: Sending prim crossing message for prim {0}", primID.ToString());
retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod);
m_log.DebugFormat("[INTERREGION]: Return from prim crossing message for prim {0}: {1}", primID.ToString(), retValue.ToString());
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found");
}
remObject = null;
return retValue;
}
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credential Exception: Invalid Credentials : " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Unknown exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0}", e);
return false;
}
}
else
{
return false;
}
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
RegionInfo[] regions = m_regionsOnInstance.ToArray();
bool banned = false;
for (int i = 0; i < regions.Length; i++)
{
if (regions[i] != null)
{
if (regions[i].RegionHandle == regionHandle)
{
if (regions[i].EstateSettings.IsBanned(agentID))
{
banned = true;
break;
}
}
}
}
if (banned)
return false;
RegionInfo regInfo = null;
try
{
if (m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
typeof (OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position),
isFlying);
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found");
}
remObject = null;
return retValue;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.WarnFormat(
"[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}",
regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch
{
NoteDeadRegion(regionHandle);
return false;
}
}
public bool ExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
typeof (OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position),
isPhysical);
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found");
}
remObject = null;
return retValue;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credential Exception: Invalid Credentials : " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Unknown exception: Unable to connect to adjacent region: " + regionHandle);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0}", e);
return false;
}
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID))
{
return true;
}
regInfo = RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
// bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
// retValue =
remObject.TellRegionToCloseChildConnection(regionHandle, agentID.Guid);
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found");
}
remObject = null;
return true;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
//m_log.Debug(e.ToString());
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Socket Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
" - Is this neighbor up?");
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (InvalidCredentialException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credentials: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (AuthenticationException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (WebException e)
{
NoteDeadRegion(regionHandle);
m_log.Warn("[OGS1 GRID SERVICES]: WebException exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message);
return false;
}
catch (Exception e)
{
NoteDeadRegion(regionHandle);
// This line errors with a Null Reference Exception.. Why? @.@
//m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
// ":" + regInfo.RemotingPort +
//"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one");
m_log.DebugFormat("[OGS1 GRID SERVICES]: {0}", e);
return false;
}
}
public bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId)
{
return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId);
}
public bool AcknowledgePrimCrossed(ulong regionHandle, UUID primId)
{
return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId);
}
#endregion
#region Methods triggered by calls from external instances
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
//m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname);
return m_localBackend.IncomingChildAgent(regionHandle, agentData);
}
public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle)
{
m_log.Info(
"[OGS1 GRID SERVICES]: " +
m_localBackend._gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X +
"," + regionData.Y + "). Giving this region a fresh set of 'dead' tries");
RegionInfo nRegionInfo = new RegionInfo();
nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT);
nRegionInfo.ExternalHostName = regionData.IPADDR;
nRegionInfo.RegionLocX = regionData.X;
nRegionInfo.RegionLocY = regionData.Y;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle))
{
m_deadRegionCache.Remove(nRegionInfo.RegionHandle);
}
}
return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle);
}
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
//m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update");
return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData);
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
m_log.DebugFormat("[INTERREGION]: Got prim crosssing request for {0}", primID);
m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod);
return true;
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
}
public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical)
{
return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical);
}
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
}
#endregion
#endregion
int timeOut = 10; //10 seconds
/// <summary>
/// Check that a region is available for TCP comms. This is necessary for .NET remoting between regions.
/// </summary>
/// <param name="address"></param>
/// <param name="port"></param>
/// <param name="retry"></param>
/// <returns></returns>
public bool CheckRegion(string address, uint port, bool retry)
{
bool available = false;
bool timed_out = true;
IPAddress ia = Util.GetHostFromDNS(address);
IPEndPoint m_EndPoint;
try
{
m_EndPoint = new IPEndPoint(ia, (int)port);
}
catch (Exception)
{
m_log.Debug("[OGS1 GRID SERVICES]: Invalid remoting address: " + address);
return false;
}
AsyncCallback callback = delegate(IAsyncResult iar)
{
timed_out = false;
Socket s = (Socket)iar.AsyncState;
try
{
s.EndConnect(iar);
available = true;
}
catch (Exception e)
{
m_log.DebugFormat(
"[OGS1 GRID SERVICES]: Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace);
}
s.Close();
};
IAsyncResult ar;
try
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
ar = socket.BeginConnect(m_EndPoint, callback, socket);
ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
}
catch (Exception e)
{
m_log.DebugFormat(
"[OGS1 GRID SERVICES]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace);
return false;
}
if (timed_out)
{
ar.AsyncWaitHandle.Close();
m_log.DebugFormat(
"[OGS1 GRID SERVICES]: socket [{0}] timed out ({1}) waiting to obtain a connection.",
m_EndPoint, timeOut * 1000);
if (retry)
{
return CheckRegion(address, port, false);
}
}
return available;
}
public bool CheckRegion(string address, uint port)
{
return CheckRegion(address, port, true);
}
public void NoteDeadRegion(ulong regionhandle)
{
lock (m_deadRegionCache)

View File

@ -1,263 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using System.Runtime.Remoting;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Region.Communications.OGS1
{
public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
public delegate bool ExpectArrival(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying);
public delegate bool InformRegionPrimGroup(ulong regionHandle, UUID primID, Vector3 Positon, bool isPhysical);
public delegate bool PrimGroupArrival(ulong regionHandle, UUID primID, string objData, int XMLMethod);
public delegate bool RegionUp(RegionUpData region, ulong regionhandle);
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID);
public sealed class InterRegionSingleton
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton();
public event InformRegionChild OnChildAgent;
public event ExpectArrival OnArrival;
public event InformRegionPrimGroup OnPrimGroupNear;
public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection;
private InformRegionChild handlerChildAgent = null; // OnChildAgent;
private ExpectArrival handlerArrival = null; // OnArrival;
private InformRegionPrimGroup handlerPrimGroupNear = null; // OnPrimGroupNear;
private PrimGroupArrival handlerPrimGroupArrival = null; // OnPrimGroupArrival;
private RegionUp handlerRegionUp = null; // OnRegionUp;
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
private TellRegionToCloseChildConnection handlerTellRegionToCloseChildConnection = null; // OnTellRegionToCloseChildConnection;
static InterRegionSingleton()
{
}
private InterRegionSingleton()
{
}
public static InterRegionSingleton Instance
{
get { return instance; }
}
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
handlerChildAgent = OnChildAgent;
if (handlerChildAgent != null)
{
return handlerChildAgent(regionHandle, agentData);
}
return false;
}
public bool RegionUp(RegionUpData sregion, ulong regionhandle)
{
handlerRegionUp = OnRegionUp;
if (handlerRegionUp != null)
{
return handlerRegionUp(sregion, regionhandle);
}
return false;
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
{
handlerChildAgentUpdate = OnChildAgentUpdate;
if (handlerChildAgentUpdate != null)
{
return handlerChildAgentUpdate(regionHandle, cAgentUpdate);
}
return false;
}
public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
handlerArrival = OnArrival;
if (handlerArrival != null)
{
return handlerArrival(regionHandle, agentID, position, isFlying);
}
return false;
}
public bool InformRegionPrim(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical)
{
handlerPrimGroupNear = OnPrimGroupNear;
if (handlerPrimGroupNear != null)
{
return handlerPrimGroupNear(regionHandle, primID, position, isPhysical);
}
return false;
}
public bool ExpectPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod)
{
handlerPrimGroupArrival = OnPrimGroupArrival;
if (handlerPrimGroupArrival != null)
{
return handlerPrimGroupArrival(regionHandle, primID, objData, XMLMethod);
}
return false;
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
{
handlerTellRegionToCloseChildConnection = OnTellRegionToCloseChildConnection;
if (handlerTellRegionToCloseChildConnection != null)
{
return handlerTellRegionToCloseChildConnection(regionHandle, agentID);
}
return false;
}
}
public class OGS1InterRegionRemoting : MarshalByRefObject
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public OGS1InterRegionRemoting()
{
}
public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData)
{
try
{
return
InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData));
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool RegionUp(RegionUpData region, ulong regionhandle)
{
try
{
return InterRegionSingleton.Instance.RegionUp(region, regionhandle);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
try
{
return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
return false;
}
}
public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
{
try
{
return
InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new UUID(agentID),
new Vector3(position.x, position.y, position.z),
isFlying);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical)
{
try
{
return
InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new UUID(SceneObjectGroupID),
new Vector3(position.x, position.y, position.z),
isPhysical);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData, int XMLMethod)
{
try
{
return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new UUID(primID), objData, XMLMethod);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID)
{
try
{
return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new UUID(agentID));
}
catch (RemotingException)
{
m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to remote region: " + regionHandle.ToString());
return false;
}
}
}
}

View File

@ -2112,21 +2112,6 @@ namespace OpenSim.Region.Framework.Scenes
appearance = new AvatarAppearance();
}
//try
//{
// if (m_AvatarFactory != null)
// {
// if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
// return;
// }
//}
//catch (Exception e)
//{
// m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}",
// client.Name, e);
//}
//m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
}
/// <summary>
@ -2692,19 +2677,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Agent is crossing the border into a neighbouring region. Tell the neighbour about it!
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <param name="isFlying"></param>
/// <returns></returns>
public bool InformNeighbourOfCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
{
return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
}
public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
{
m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying);

View File

@ -99,7 +99,6 @@ namespace OpenSim.Region.Framework.Scenes
m_regionInfo = regionInfos;
m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName;
regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
if (regionCommsHost != null)
@ -1017,16 +1016,6 @@ namespace OpenSim.Region.Framework.Scenes
{
return previousNeighbours.FindAll(delegate(ulong handle) { return !currentNeighbours.Contains(handle); });
}
/// <summary>
/// Inform a neighbouring region that an avatar is about to cross into it.
/// </summary>
/// <param name="regionhandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
public bool CrossToNeighbouringRegion(ulong regionhandle, UUID agentID, Vector3 position, bool isFlying)
{
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
}
public void CrossAgentToNewRegion(Scene scene, ScenePresence agent, bool isFlying)
{
@ -1205,11 +1194,6 @@ namespace OpenSim.Region.Framework.Scenes
}
public bool PrimCrossToNeighboringRegion(ulong regionhandle, UUID primID, string objData, int XMLMethod)
{
return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData, XMLMethod);
}
public Dictionary<string, string> GetGridSettings()
{
return m_commsProvider.GridService.GetGridSettings();

View File

@ -75,7 +75,6 @@ namespace OpenSim.Tests.Common.Mock
LocalBackEndServices gs = new LocalBackEndServices();
m_gridService = gs;
m_interRegion = gs;
}
}
}