Merge branch 'grid-service-redux'

This commit is contained in:
Melanie
2009-09-28 23:03:47 +01:00
79 changed files with 1405 additions and 4192 deletions

View File

@@ -35,6 +35,8 @@ using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using log4net;
namespace OpenSim.Framework.Communications.Clients
@@ -43,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason)
public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, out string reason)
{
reason = String.Empty;
@@ -166,7 +168,7 @@ namespace OpenSim.Framework.Communications.Clients
}
public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData)
public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData)
{
// Eventually, we want to use a caps url instead of the agentID
string uri = string.Empty;
@@ -260,7 +262,7 @@ namespace OpenSim.Framework.Communications.Clients
return true;
}
public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent)
public bool DoRetrieveRootAgentCall(GridRegion region, UUID id, out IAgentData agent)
{
agent = null;
// Eventually, we want to use a caps url instead of the agentID
@@ -348,7 +350,7 @@ namespace OpenSim.Framework.Communications.Clients
}
public bool DoCloseAgentCall(RegionInfo region, UUID id)
public bool DoCloseAgentCall(GridRegion region, UUID id)
{
string uri = string.Empty;
try
@@ -391,7 +393,7 @@ namespace OpenSim.Framework.Communications.Clients
return true;
}
public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, string sogXml2, bool allowScriptCrossing)
public bool DoCreateObjectCall(GridRegion region, ISceneObject sog, string sogXml2, bool allowScriptCrossing)
{
ulong regionHandle = GetRegionHandle(region.RegionHandle);
string uri
@@ -474,7 +476,7 @@ namespace OpenSim.Framework.Communications.Clients
}
public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID)
public bool DoCreateObjectCall(GridRegion region, UUID userID, UUID itemID)
{
ulong regionHandle = GetRegionHandle(region.RegionHandle);
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/";
@@ -646,7 +648,7 @@ namespace OpenSim.Framework.Communications.Clients
return false;
}
public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit)
public virtual void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
{
}

View File

@@ -59,11 +59,6 @@ namespace OpenSim.Framework.Communications
}
protected IMessagingService m_messageService;
public IGridServices GridService
{
get { return m_gridService; }
}
protected IGridServices m_gridService;
public UserProfileCacheService UserProfileCacheService
{

View File

@@ -1,92 +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 OpenSimulator 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 IGridServices
{
string gdebugRegionName { get; set; }
/// <summary>
/// If true, then regions will accept logins from the user service. If false, then they will not.
/// </summary>
bool RegionLoginsEnabled { get; set; }
/// <summary>
/// Register a region with the grid service.
/// </summary>
/// <param name="regionInfos"> </param>
/// <returns></returns>
/// <exception cref="System.Exception">Thrown if region registration failed</exception>
RegionCommsListener RegisterRegion(RegionInfo regionInfos);
/// <summary>
/// Deregister a region with the grid service.
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
/// <exception cref="System.Exception">Thrown if region deregistration failed</exception>
bool DeregisterRegion(RegionInfo regionInfo);
/// <summary>
/// Get information about the regions neighbouring the given co-ordinates.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
RegionInfo RequestNeighbourInfo(ulong regionHandle);
RegionInfo RequestNeighbourInfo(UUID regionID);
RegionInfo RequestNeighbourInfo(string name);
RegionInfo RequestNeighbourInfo(string host, uint port);
RegionInfo RequestClosestRegion(string regionName);
Dictionary<string, string> GetGridSettings();
List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
// not complete yet, only contains the fields needed for ParcelInfoReqeust
LandData RequestLandData(ulong regionHandle, uint x, uint y);
/// <summary>
/// Get information about regions starting with the provided name.
/// </summary>
/// <param name="name">
/// The name to match against.
/// </param>
/// <param name="maxNumber">
/// The maximum number of results to return.
/// </param>
/// <returns>
/// A list of <see cref="RegionInfo"/>s of regions with matching name. If the
/// grid-server couldn't be contacted or returned an error, return null.
/// </returns>
List<RegionInfo> RequestNamedRegions(string name, int maxNumber);
}
}

View File

@@ -1,38 +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 OpenSimulator 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.
*/
namespace OpenSim.Framework.Communications
{
public interface IHyperlink
{
bool IsHyperlinkRegion(ulong handle);
RegionInfo GetHyperlinkRegion(ulong handle);
ulong FindRegionHandle(ulong handle);
bool SendUserInformation(RegionInfo region, AgentCircuitData aCircuit);
void AdjustUserInformation(AgentCircuitData aCircuit);
}
}

View File

@@ -46,8 +46,6 @@ namespace OpenSim.Framework
public delegate bool CloseAgentConnection(UUID agentID);
public delegate bool RegionUp(RegionInfo region);
public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData);
public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message);
@@ -65,7 +63,6 @@ namespace OpenSim.Framework
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
event UpdateNeighbours OnNeighboursUpdate;
event CloseAgentConnection OnCloseAgentConnection;
event RegionUp OnRegionUp;
event ChildAgentUpdate OnChildAgentUpdate;
event LogOffUser OnLogOffUser;
event GetLandData OnGetLandData;

View File

@@ -74,7 +74,7 @@ namespace OpenSim.Framework
void CloseAllAgents(uint circuitcode);
void Restart(int seconds);
bool OtherRegionUp(RegionInfo thisRegion);
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
string GetSimulatorVersion();

View File

@@ -102,8 +102,7 @@ namespace OpenSim.Framework
ConfigSettings.DefaultInventoryServerHttpPort.ToString());
secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true);
MessagingURL = config.Configs["Network"].GetString("messaging_server_url",
"http://127.0.0.1:" + ConfigSettings.DefaultMessageServerHttpPort);
MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty);
}
}
}

View File

@@ -47,7 +47,6 @@ namespace OpenSim.Framework
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
private RegionUp handlerRegionUp = null; // OnRegionUp;
private LogOffUser handlerLogOffUser = null;
private GetLandData handlerGetLandData = null;
@@ -62,7 +61,6 @@ namespace OpenSim.Framework
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
public event CloseAgentConnection OnCloseAgentConnection;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
public event LogOffUser OnLogOffUser;
public event GetLandData OnGetLandData;
@@ -108,17 +106,6 @@ namespace OpenSim.Framework
return false;
}
public virtual bool TriggerRegionUp(RegionInfo region)
{
handlerRegionUp = OnRegionUp;
if (handlerRegionUp != null)
{
handlerRegionUp(region);
return true;
}
return false;
}
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
{
handlerChildAgentUpdate = OnChildAgentUpdate;

View File

@@ -59,11 +59,11 @@ namespace OpenSim.Framework.Servers.HttpServer
int length = 0;
using (StreamWriter writer = new StreamWriter(buffer))
{
writer.WriteLine(obj);
writer.Write(obj);
writer.Flush();
length = (int)buffer.Length;
}
length = (int)obj.Length;
request.ContentLength = length;
Stream requestStream = request.GetRequestStream();

View File

@@ -1203,6 +1203,32 @@ namespace OpenSim.Framework
return found.ToArray();
}
public static string ServerURI(string uri)
{
if (uri == string.Empty)
return string.Empty;
// Get rid of eventual slashes at the end
uri = uri.TrimEnd('/');
IPAddress ipaddr1 = null;
string port1 = "";
try
{
ipaddr1 = Util.GetHostFromURL(uri);
}
catch { }
try
{
port1 = uri.Split(new char[] { ':' })[2];
}
catch { }
// We tried our best to convert the domain names to IP addresses
return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
}
#region FireAndForget Threading Pattern
public static void FireAndForget(System.Threading.WaitCallback callback)