Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

prebuild-update
Justin Clark-Casey (justincc) 2010-09-03 21:14:23 +01:00
commit 71c0fc10df
9 changed files with 169 additions and 32 deletions

View File

@ -44,6 +44,8 @@ namespace OpenSim.Framework.Capabilities
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
byte[] data, string inventoryType, string assetType);
public delegate void UploadedBakedTexture(UUID assetID, byte[] data);
public delegate UUID UpdateItem(UUID itemID, byte[] data);
public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
@ -97,6 +99,7 @@ namespace OpenSim.Framework.Capabilities
// private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module.
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
//private string eventQueue = "0100/";
private IScene m_Scene;
@ -185,6 +188,8 @@ namespace OpenSim.Framework.Capabilities
m_capsHandlers["UpdateScriptTaskInventory"] =
new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"];
m_capsHandlers["UploadBakedTexture"] =
new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture);
}
catch (Exception e)
@ -742,6 +747,50 @@ namespace OpenSim.Framework.Capabilities
return null;
}
public string UploadBakedTexture(string request, string path,
string param, OSHttpRequest httpRequest,
OSHttpResponse httpResponse)
{
try
{
m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
m_regionName);
string capsBase = "/CAPS/" + m_capsObjectPath;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader =
new BakedTextureUploader( capsBase + uploaderPath,
m_httpListener);
uploader.OnUpLoad += BakedTextureUploaded;
m_httpListener.AddStreamHandler(
new BinaryStreamHandler("POST", capsBase + uploaderPath,
uploader.uploaderCaps));
string protocol = "http://";
if (m_httpListener.UseSSL)
protocol = "https://";
string uploaderURL = protocol + m_httpListenerHostName + ":" +
m_httpListenPort.ToString() + capsBase + uploaderPath;
LLSDAssetUploadResponse uploadResponse =
new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL;
uploadResponse.state = "upload";
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
}
catch (Exception e)
{
m_log.Error("[CAPS]: " + e.ToString());
}
return null;
}
/// <summary>
/// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.
/// </summary>
@ -925,6 +974,17 @@ namespace OpenSim.Framework.Capabilities
}
}
public void BakedTextureUploaded(UUID assetID, byte[] data)
{
m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
AssetBase asset;
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
asset.Data = data;
asset.Temporary = true;
asset.Local = true;
m_assetCache.Store(asset);
}
/// <summary>
/// Called when new asset data for an agent inventory item update has been uploaded.
/// </summary>
@ -1243,5 +1303,50 @@ namespace OpenSim.Framework.Capabilities
fs.Close();
}
}
public class BakedTextureUploader
{
public event UploadedBakedTexture OnUpLoad;
private UploadedBakedTexture handlerUpLoad = null;
private string uploaderPath = String.Empty;
private UUID newAssetID;
private IHttpServer httpListener;
public BakedTextureUploader(string path, IHttpServer httpServer)
{
newAssetID = UUID.Random();
uploaderPath = path;
httpListener = httpServer;
}
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string uploaderCaps(byte[] data, string path, string param)
{
string res = String.Empty;
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
uploadComplete.new_asset = newAssetID.ToString();
uploadComplete.new_inventory_item = UUID.Zero;
uploadComplete.state = "complete";
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
httpListener.RemoveStreamHandler("POST", uploaderPath);
handlerUpLoad = OnUpLoad;
if (handlerUpLoad != null)
{
handlerUpLoad(newAssetID, data);
}
return res;
}
}
}
}

View File

@ -3408,6 +3408,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
avp.Sender.IsTrial = false;
avp.Sender.ID = agentID;
m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
OutPacket(avp, ThrottleOutPacketType.Task);
}

View File

@ -252,7 +252,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
{
if (stateSource == 1 && // Prim crossing
if (stateSource == 2 && // Prim crossing
m_part.ParentGroup.Scene.m_trustBinaries)
{
lock (m_items)

View File

@ -2464,7 +2464,6 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.SendAvatarDataImmediate(this);
SendInitialFullUpdateToAllClients();
SendAppearanceToAllOtherAgents();
}
/// <summary>

View File

@ -86,8 +86,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
//m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" );
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
XmlRpcResponse response = null;
try
{
@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
string uri = "http://" + gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/";
string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/");
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
XmlRpcResponse response = null;
try

View File

@ -51,15 +51,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
MethodBase.GetCurrentMethod().DeclaringType);
string m_ServerURL;
Uri m_Uri;
public UserAgentServiceConnector(string url)
{
m_ServerURL = url;
// Doing this here, because XML-RPC or mono have some strong ideas about
// caching DNS translations.
try
{
m_Uri = new Uri(m_ServerURL);
Uri m_Uri = new Uri(m_ServerURL);
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port;
m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ;
}
catch (Exception e)
{

View File

@ -104,17 +104,23 @@ namespace OpenSim.Services.Connectors.Simulation
return false;
}
// Eventually, we want to use a caps url instead of the agentID
string uri = string.Empty;
try
// HACK -- Simian grid make it work!!!
if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
else
{
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
}
catch (Exception e)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
reason = e.Message;
return false;
try
{
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
}
catch (Exception e)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
reason = e.Message;
return false;
}
}
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);

View File

@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService
string host = "127.0.0.1";
string portstr;
string regionName = "";
uint port = 9000;
uint port = 0;
string[] parts = mapName.Split(new char[] { ':' });
if (parts.Length >= 1)
{
@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService
regionName = parts[2];
}
// Sanity check.
//IPAddress ipaddr = null;
try
{
//ipaddr = Util.GetHostFromDNS(host);
Util.GetHostFromDNS(host);
}
catch
{
reason = "Malformed hostname";
return null;
}
//// Sanity check.
//try
//{
// Util.GetHostFromDNS(host);
//}
//catch
//{
// reason = "Malformed hostname";
// return null;
//}
GridRegion regInfo;
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason);
@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService
regInfo.RegionLocY = yloc;
regInfo.ScopeID = scopeID;
// Big HACK for Simian Grid !!!
// We need to clean up all URLs used in OpenSim !!!
if (externalHostName.Contains("/"))
regInfo.ServerURI = externalHostName;
try
{
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);

View File

@ -293,13 +293,35 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddFolder(InventoryFolderBase folder)
{
InventoryFolderBase check = GetFolder(folder);
if (check != null)
return false;
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
return m_Database.StoreFolder(xFolder);
}
public virtual bool UpdateFolder(InventoryFolderBase folder)
{
return AddFolder(folder);
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
InventoryFolderBase check = GetFolder(folder);
if (check == null)
return AddFolder(folder);
if (check.Type != -1 || xFolder.type != -1)
{
if (xFolder.version > check.Version)
return false;
check.Version = (ushort)xFolder.version;
xFolder = ConvertFromOpenSim(check);
return m_Database.StoreFolder(xFolder);
}
if (xFolder.version < check.Version)
xFolder.version = check.Version;
xFolder.folderID = check.ID;
return m_Database.StoreFolder(xFolder);
}
public virtual bool MoveFolder(InventoryFolderBase folder)