Merge branch 'master' of git://opensimulator.org/git/opensim into dev
Conflicts: OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.csdsg
commit
cf15fc0b97
|
@ -1,136 +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;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.ClientStack;
|
||||
using OpenSim.Region.ClientStack.LindenUDP;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Client.Linden
|
||||
{
|
||||
/// <summary>
|
||||
/// Linden UDP Stack Region Module
|
||||
/// </summary>
|
||||
public class LLClientStackModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
/// <summary>
|
||||
/// Scene that contains the region's data
|
||||
/// </summary>
|
||||
protected Scene m_scene;
|
||||
protected bool m_createClientStack = false;
|
||||
protected IClientNetworkServer m_clientServer;
|
||||
protected ClientStackManager m_clientStackManager;
|
||||
protected IConfigSource m_source;
|
||||
|
||||
protected string m_clientStackDll = "OpenSim.Region.ClientStack.LindenUDP.dll";
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_source = source;
|
||||
|
||||
IConfig startupConfig = m_source.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
m_clientStackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
|
||||
if ((m_scene != null) && (m_createClientStack))
|
||||
{
|
||||
m_log.Info("[LLClientStackModule] Starting up LLClientStack.");
|
||||
IPEndPoint endPoint = m_scene.RegionInfo.InternalEndPoint;
|
||||
|
||||
uint port = (uint)endPoint.Port;
|
||||
m_clientStackManager = new ClientStackManager(m_clientStackDll);
|
||||
|
||||
m_clientServer
|
||||
= m_clientStackManager.CreateServer(endPoint.Address,
|
||||
ref port, m_scene.RegionInfo.ProxyOffset, m_scene.RegionInfo.m_allow_alternate_ports, m_source,
|
||||
m_scene.AuthenticateHandler);
|
||||
|
||||
m_clientServer.AddScene(m_scene);
|
||||
|
||||
m_clientServer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LLClientStackModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<Addin id="OpenSim.Client.Linden.LindenModules" version="0.2">
|
||||
<Runtime>
|
||||
<Import assembly="OpenSim.Client.Linden.dll"/>
|
||||
</Runtime>
|
||||
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
|
||||
<Extension path = "/OpenSim/RegionModules">
|
||||
<RegionModule id="LLClientStackModule" type="OpenSim.Client.Linden.LLClientStackModule" />
|
||||
</Extension>
|
||||
</Addin>
|
|
@ -867,7 +867,7 @@ namespace OpenSim.Data.MySQL
|
|||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand sqlCmd = new MySqlCommand(
|
||||
"SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1", dbcon))
|
||||
"SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags & 1", dbcon))
|
||||
{
|
||||
sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
|
||||
sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm);
|
||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
||||
|
|
|
@ -765,8 +765,8 @@ namespace OpenSim.Framework.Capabilities
|
|||
{
|
||||
try
|
||||
{
|
||||
m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
|
||||
m_regionName);
|
||||
// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
|
||||
// m_regionName);
|
||||
|
||||
string capsBase = "/CAPS/" + m_capsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
@ -1332,7 +1332,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
newAssetID = UUID.Random();
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1360,7 +1360,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,11 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
System.Console.WriteLine(text);
|
||||
}
|
||||
|
||||
public virtual void OutputFormat(string format, params string[] components)
|
||||
{
|
||||
Output(string.Format(format, components));
|
||||
}
|
||||
|
||||
public string CmdPrompt(string p)
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
m_console.Commands.AddCommand("base", false, "show info",
|
||||
"show info",
|
||||
"Show general information", HandleShow);
|
||||
"Show general information about the server", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "show stats",
|
||||
"show stats",
|
||||
|
@ -371,8 +371,7 @@ namespace OpenSim.Framework.Servers
|
|||
switch (showParams[0])
|
||||
{
|
||||
case "info":
|
||||
Notice("Version: " + m_version);
|
||||
Notice("Startup directory: " + m_startupDirectory);
|
||||
ShowInfo();
|
||||
break;
|
||||
|
||||
case "stats":
|
||||
|
@ -389,18 +388,30 @@ namespace OpenSim.Framework.Servers
|
|||
break;
|
||||
|
||||
case "version":
|
||||
Notice(
|
||||
String.Format(
|
||||
"Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion));
|
||||
Notice(GetVersionText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShowInfo()
|
||||
{
|
||||
Notice(GetVersionText());
|
||||
Notice("Startup directory: " + m_startupDirectory);
|
||||
if (null != m_consoleAppender)
|
||||
Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold));
|
||||
}
|
||||
|
||||
protected string GetVersionText()
|
||||
{
|
||||
return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console output is only possible if a console has been established.
|
||||
/// That is something that cannot be determined within this class. So
|
||||
/// all attempts to use the console MUST be verified.
|
||||
/// </summary>
|
||||
/// <param name="msg"></param>
|
||||
protected void Notice(string msg)
|
||||
{
|
||||
if (m_console != null)
|
||||
|
@ -408,6 +419,19 @@ namespace OpenSim.Framework.Servers
|
|||
m_console.Output(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console output is only possible if a console has been established.
|
||||
/// That is something that cannot be determined within this class. So
|
||||
/// all attempts to use the console MUST be verified.
|
||||
/// </summary>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="components"></param>
|
||||
protected void Notice(string format, params string[] components)
|
||||
{
|
||||
if (m_console != null)
|
||||
m_console.OutputFormat(format, components);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enhance the version string with extra information if it's available.
|
||||
|
|
|
@ -346,9 +346,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// <param name="response"></param>
|
||||
public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
string reqnum = "unknown";
|
||||
int tickstart = Environment.TickCount;
|
||||
|
||||
try
|
||||
{
|
||||
//m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
|
||||
// OpenSim.Framework.WebUtil.OSHeaderRequestID
|
||||
if (request.Headers["opensim-request-id"] != null)
|
||||
reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]);
|
||||
// m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl);
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||
|
||||
|
@ -576,6 +582,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
|
||||
SendHTML500(response);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Every month or so this will wrap and give bad numbers, not really a problem
|
||||
// since its just for reporting, 200ms limit can be adjusted
|
||||
int tickdiff = Environment.TickCount - tickstart;
|
||||
if (tickdiff > 500)
|
||||
m_log.InfoFormat(
|
||||
"[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler)
|
||||
|
|
|
@ -46,7 +46,7 @@ using System.Threading;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using Nwc.XmlRpc;
|
||||
using BclExtras;
|
||||
// using BclExtras;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using Amib.Threading;
|
||||
|
@ -1375,8 +1375,29 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Created to work around a limitation in Mono with nested delegates
|
||||
/// </summary>
|
||||
private class FireAndForgetWrapper
|
||||
private sealed class FireAndForgetWrapper
|
||||
{
|
||||
private static volatile FireAndForgetWrapper instance;
|
||||
private static object syncRoot = new Object();
|
||||
|
||||
public static FireAndForgetWrapper Instance {
|
||||
get {
|
||||
|
||||
if (instance == null)
|
||||
{
|
||||
lock (syncRoot)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new FireAndForgetWrapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void FireAndForget(System.Threading.WaitCallback callback)
|
||||
{
|
||||
callback.BeginInvoke(null, EndFireAndForget, callback);
|
||||
|
@ -1445,7 +1466,7 @@ namespace OpenSim.Framework
|
|||
ThreadPool.QueueUserWorkItem(callback, obj);
|
||||
break;
|
||||
case FireAndForgetMethod.BeginInvoke:
|
||||
FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
|
||||
FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
|
||||
wrapper.FireAndForget(callback, obj);
|
||||
break;
|
||||
case FireAndForgetMethod.SmartThreadPool:
|
||||
|
|
|
@ -50,6 +50,16 @@ namespace OpenSim.Framework
|
|||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static int m_requestNumber = 0;
|
||||
|
||||
// this is the header field used to communicate the local request id
|
||||
// used for performance and debugging
|
||||
public const string OSHeaderRequestID = "opensim-request-id";
|
||||
|
||||
// number of milliseconds a call can take before it is considered
|
||||
// a "long" call for warning & debugging purposes
|
||||
public const int LongCallTime = 500;
|
||||
|
||||
/// <summary>
|
||||
/// Send LLSD to an HTTP client in application/llsd+json form
|
||||
/// </summary>
|
||||
|
@ -122,27 +132,187 @@ namespace OpenSim.Framework
|
|||
return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PUT JSON-encoded data to a web service that returns LLSD or
|
||||
/// JSON data
|
||||
/// </summary>
|
||||
public static OSDMap PutToService(string url, OSDMap data)
|
||||
{
|
||||
return ServiceOSDRequest(url,data,"PUT",10000);
|
||||
}
|
||||
|
||||
public static OSDMap PostToService(string url, OSDMap data)
|
||||
{
|
||||
return ServiceOSDRequest(url,data,"POST",10000);
|
||||
}
|
||||
|
||||
public static OSDMap GetFromService(string url)
|
||||
{
|
||||
return ServiceOSDRequest(url,null,"GET",10000);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout)
|
||||
{
|
||||
int reqnum = m_requestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
string errorMessage = "unknown error";
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = method;
|
||||
request.Timeout = timeout;
|
||||
request.KeepAlive = false;
|
||||
request.MaximumAutomaticRedirections = 10;
|
||||
request.ReadWriteTimeout = timeout / 4;
|
||||
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
||||
|
||||
// If there is some input, write it into the request
|
||||
if (data != null)
|
||||
{
|
||||
string strBuffer = OSDParser.SerializeJsonString(data);
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
|
||||
|
||||
request.ContentType = "application/json";
|
||||
request.ContentLength = buffer.Length; //Count bytes to send
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer, 0, buffer.Length); //Send it
|
||||
}
|
||||
|
||||
// capture how much time was spent writing, this may seem silly
|
||||
// but with the number concurrent requests, this often blocks
|
||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
|
||||
using (WebResponse response = request.GetResponse())
|
||||
{
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
{
|
||||
string responseStr = null;
|
||||
responseStr = responseStream.GetStreamString();
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr);
|
||||
return CanonicalizeResults(responseStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
errorMessage = we.Message;
|
||||
if (we.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
HttpWebResponse webResponse = (HttpWebResponse)we.Response;
|
||||
errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// This just dumps a warning for any operation that takes more than 100 ms
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > LongCallTime)
|
||||
m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing",
|
||||
reqnum,url,method,tickdiff,tickdata);
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[WEB UTIL] <{0}> osd request failed: {1}",reqnum,errorMessage);
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Since there are no consistencies in the way web requests are
|
||||
/// formed, we need to do a little guessing about the result format.
|
||||
/// Keys:
|
||||
/// Success|success == the success fail of the request
|
||||
/// _RawResult == the raw string that came back
|
||||
/// _Result == the OSD unpacked string
|
||||
/// </summary>
|
||||
private static OSDMap CanonicalizeResults(string response)
|
||||
{
|
||||
OSDMap result = new OSDMap();
|
||||
|
||||
// Default values
|
||||
result["Success"] = OSD.FromBoolean(true);
|
||||
result["success"] = OSD.FromBoolean(true);
|
||||
result["_RawResult"] = OSD.FromString(response);
|
||||
result["_Result"] = new OSDMap();
|
||||
|
||||
if (response.Equals("true",System.StringComparison.OrdinalIgnoreCase))
|
||||
return result;
|
||||
|
||||
if (response.Equals("false",System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
result["Success"] = OSD.FromBoolean(false);
|
||||
result["success"] = OSD.FromBoolean(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OSD responseOSD = OSDParser.Deserialize(response);
|
||||
if (responseOSD.Type == OSDType.Map)
|
||||
{
|
||||
result["_Result"] = (OSDMap)responseOSD;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// don't need to treat this as an error... we're just guessing anyway
|
||||
m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// POST URL-encoded form data to a web service that returns LLSD or
|
||||
/// JSON data
|
||||
/// </summary>
|
||||
public static OSDMap PostToService(string url, NameValueCollection data)
|
||||
{
|
||||
string errorMessage;
|
||||
return ServiceFormRequest(url,data,10000);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
|
||||
{
|
||||
int reqnum = m_requestNumber++;
|
||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
string errorMessage = "unknown error";
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
|
||||
try
|
||||
{
|
||||
string queryString = BuildQueryString(data);
|
||||
byte[] requestData = System.Text.Encoding.UTF8.GetBytes(queryString);
|
||||
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
request.Method = "POST";
|
||||
request.ContentLength = requestData.Length;
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
request.Timeout = timeout;
|
||||
request.KeepAlive = false;
|
||||
request.MaximumAutomaticRedirections = 10;
|
||||
request.ReadWriteTimeout = timeout / 4;
|
||||
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
string queryString = BuildQueryString(data);
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
|
||||
|
||||
request.ContentLength = buffer.Length;
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(requestData, 0, requestData.Length);
|
||||
requestStream.Close();
|
||||
// capture how much time was spent writing, this may seem silly
|
||||
// but with the number concurrent requests, this often blocks
|
||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
|
||||
using (WebResponse response = request.GetResponse())
|
||||
{
|
||||
|
@ -150,34 +320,50 @@ namespace OpenSim.Framework
|
|||
{
|
||||
string responseStr = null;
|
||||
|
||||
try
|
||||
{
|
||||
responseStr = responseStream.GetStreamString();
|
||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||
if (responseOSD.Type == OSDType.Map)
|
||||
return (OSDMap)responseOSD;
|
||||
else
|
||||
errorMessage = "Response format was invalid.";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(responseStr))
|
||||
errorMessage = "Failed to parse the response:\n" + responseStr;
|
||||
else
|
||||
errorMessage = "Failed to retrieve the response: " + ex.Message;
|
||||
}
|
||||
responseStr = responseStream.GetStreamString();
|
||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||
if (responseOSD.Type == OSDType.Map)
|
||||
return (OSDMap)responseOSD;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
errorMessage = we.Message;
|
||||
if (we.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
HttpWebResponse webResponse = (HttpWebResponse)we.Response;
|
||||
errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("POST to URL " + url + " failed: " + ex);
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > LongCallTime)
|
||||
m_log.InfoFormat("[WEB UTIL]: form request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing",
|
||||
reqnum,url,method,tickdiff,tickdata);
|
||||
}
|
||||
|
||||
return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } };
|
||||
m_log.WarnFormat("[WEB UTIL]: <{0}> form request failed: {1}",reqnum,errorMessage);
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a response map for an error, trying to keep
|
||||
/// the result formats consistent
|
||||
/// </summary>
|
||||
private static OSDMap ErrorResponseMap(string msg)
|
||||
{
|
||||
OSDMap result = new OSDMap();
|
||||
result["Success"] = "False";
|
||||
result["Message"] = OSD.FromString("Service request failed: " + msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
#region Uri
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -283,10 +283,6 @@ namespace OpenSim
|
|||
"kick user <first> <last> [message]",
|
||||
"Kick a user off the simulator", KickUserCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show assets",
|
||||
"show assets",
|
||||
"Show asset data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show users",
|
||||
"show users [full]",
|
||||
"Show user data for users currently on the region",
|
||||
|
@ -305,13 +301,6 @@ namespace OpenSim
|
|||
m_console.Commands.AddCommand("region", false, "show regions",
|
||||
"show regions",
|
||||
"Show region data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show queues",
|
||||
"show queues [full]",
|
||||
"Show queue data for each client",
|
||||
"Without the 'full' option, only users actually on the region are shown."
|
||||
+ " With the 'full' option child agents of users in neighbouring regions are also shown.",
|
||||
HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show ratings",
|
||||
"show ratings",
|
||||
|
@ -335,16 +324,19 @@ namespace OpenSim
|
|||
"Restart all sims in this instance", RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config set",
|
||||
"config set <section> <field> <value>",
|
||||
"Set a config option", HandleConfig);
|
||||
"config set <section> <key> <value>",
|
||||
"Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config get",
|
||||
"config get <section> <field>",
|
||||
"Read a config option", HandleConfig);
|
||||
"config get [<section>] [<key>]",
|
||||
"Show a config option",
|
||||
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
||||
+ "If a section is given but not a field, then all fields in that section are printed.",
|
||||
HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config save",
|
||||
"config save",
|
||||
"Save current configuration", HandleConfig);
|
||||
"config save <path>",
|
||||
"Save current configuration to a file at the given path", HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "command-script",
|
||||
"command-script <script>",
|
||||
|
@ -637,7 +629,6 @@ namespace OpenSim
|
|||
List<string> args = new List<string>(cmd);
|
||||
args.RemoveAt(0);
|
||||
string[] cmdparams = args.ToArray();
|
||||
string n = "CONFIG";
|
||||
|
||||
if (cmdparams.Length > 0)
|
||||
{
|
||||
|
@ -646,8 +637,8 @@ namespace OpenSim
|
|||
case "set":
|
||||
if (cmdparams.Length < 4)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("SYNTAX: {0} SET SECTION KEY VALUE",n));
|
||||
MainConsole.Instance.Output(String.Format("EXAMPLE: {0} SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5",n));
|
||||
Notice("Syntax: config set <section> <key> <value>");
|
||||
Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -660,48 +651,68 @@ namespace OpenSim
|
|||
c.Set(cmdparams[2], _value);
|
||||
m_config.Source.Merge(source);
|
||||
|
||||
MainConsole.Instance.Output(String.Format("{0} {0} {1} {2} {3}",n,cmdparams[1],cmdparams[2],_value));
|
||||
Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "get":
|
||||
if (cmdparams.Length < 3)
|
||||
if (cmdparams.Length == 1)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("SYNTAX: {0} GET SECTION KEY",n));
|
||||
MainConsole.Instance.Output(String.Format("EXAMPLE: {0} GET ScriptEngine.DotNetEngine NumberOfScriptThreads",n));
|
||||
}
|
||||
else
|
||||
{
|
||||
IConfig c = m_config.Source.Configs[cmdparams[1]];
|
||||
if (c == null)
|
||||
foreach (IConfig config in m_config.Source.Configs)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("Section \"{0}\" does not exist.",cmdparams[1]));
|
||||
Notice("[{0}]", config.Name);
|
||||
string[] keys = config.GetKeys();
|
||||
foreach (string key in keys)
|
||||
Notice(" {0} = {1}", key, config.GetString(key));
|
||||
}
|
||||
}
|
||||
else if (cmdparams.Length == 2 || cmdparams.Length == 3)
|
||||
{
|
||||
IConfig config = m_config.Source.Configs[cmdparams[1]];
|
||||
if (config == null)
|
||||
{
|
||||
Notice("Section \"{0}\" does not exist.",cmdparams[1]);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("{0} GET {1} {2} : {3}",n,cmdparams[1],cmdparams[2],
|
||||
c.GetString(cmdparams[2])));
|
||||
if (cmdparams.Length == 2)
|
||||
{
|
||||
Notice("[{0}]", config.Name);
|
||||
foreach (string key in config.GetKeys())
|
||||
Notice(" {0} = {1}", key, config.GetString(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
Notice(
|
||||
"config get {0} {1} : {2}",
|
||||
cmdparams[1], cmdparams[2], config.GetString(cmdparams[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Notice("Syntax: config get [<section>] [<key>]");
|
||||
Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "save":
|
||||
if (cmdparams.Length < 2)
|
||||
{
|
||||
MainConsole.Instance.Output("SYNTAX: " + n + " SAVE FILE");
|
||||
Notice("Syntax: config save <path>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Application.iniFilePath == cmdparams[1])
|
||||
{
|
||||
MainConsole.Instance.Output("FILE can not be " + Application.iniFilePath);
|
||||
Notice("Path can not be " + Application.iniFilePath);
|
||||
return;
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output("Saving configuration file: " + cmdparams[1]);
|
||||
Notice("Saving configuration file: " + cmdparams[1]);
|
||||
m_config.Save(cmdparams[1]);
|
||||
break;
|
||||
}
|
||||
|
@ -920,10 +931,6 @@ namespace OpenSim
|
|||
|
||||
switch (showParams[0])
|
||||
{
|
||||
case "assets":
|
||||
MainConsole.Instance.Output("Not implemented.");
|
||||
break;
|
||||
|
||||
case "users":
|
||||
IList agents;
|
||||
if (showParams.Length > 1 && showParams[1] == "full")
|
||||
|
@ -1010,10 +1017,6 @@ namespace OpenSim
|
|||
});
|
||||
break;
|
||||
|
||||
case "queues":
|
||||
Notice(GetQueuesReport(showParams));
|
||||
break;
|
||||
|
||||
case "ratings":
|
||||
m_sceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
|
@ -1040,94 +1043,6 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate UDP Queue data report for each client
|
||||
/// </summary>
|
||||
/// <param name="showParams"></param>
|
||||
/// <returns></returns>
|
||||
private string GetQueuesReport(string[] showParams)
|
||||
{
|
||||
bool showChildren = false;
|
||||
|
||||
if (showParams.Length > 1 && showParams[1] == "full")
|
||||
showChildren = true;
|
||||
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
int columnPadding = 2;
|
||||
int maxNameLength = 18;
|
||||
int maxRegionNameLength = 14;
|
||||
int maxTypeLength = 4;
|
||||
int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
|
||||
|
||||
report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", "");
|
||||
report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", "");
|
||||
report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", "");
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
|
||||
"Packets",
|
||||
"Packets",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes",
|
||||
"Bytes");
|
||||
|
||||
report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
|
||||
report.AppendFormat(
|
||||
"{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
|
||||
"Out",
|
||||
"In",
|
||||
"Unacked",
|
||||
"Resend",
|
||||
"Land",
|
||||
"Wind",
|
||||
"Cloud",
|
||||
"Task",
|
||||
"Texture",
|
||||
"Asset",
|
||||
"State");
|
||||
|
||||
m_sceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
scene.ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
if (client is IStatsCollector)
|
||||
{
|
||||
bool isChild = scene.PresenceChildStatus(client.AgentId);
|
||||
if (isChild && !showChildren)
|
||||
return;
|
||||
|
||||
string name = client.Name;
|
||||
string regionName = scene.RegionInfo.RegionName;
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,-" + maxNameLength + "}{1,-" + columnPadding + "}",
|
||||
name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, "");
|
||||
report.AppendFormat(
|
||||
"{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}",
|
||||
regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, "");
|
||||
report.AppendFormat(
|
||||
"{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}",
|
||||
isChild ? "Cd" : "Rt", "");
|
||||
|
||||
IStatsCollector stats = (IStatsCollector)client;
|
||||
|
||||
report.AppendLine(stats.Report());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return report.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use XML2 format to serialize data to a file
|
||||
/// </summary>
|
||||
|
@ -1197,7 +1112,7 @@ namespace OpenSim
|
|||
MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z));
|
||||
}
|
||||
}
|
||||
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
|
||||
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[2], generateNewIDS, loadOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -373,6 +373,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
#region Properties
|
||||
|
||||
public LLUDPClient UDPClient { get { return m_udpClient; } }
|
||||
public LLUDPServer UDPServer { get { return m_udpServer; } }
|
||||
public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } }
|
||||
public UUID SecureSessionId { get { return m_secureSessionId; } }
|
||||
public IScene Scene { get { return m_scene; } }
|
||||
|
@ -3473,9 +3474,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
ani.AnimationList[i].AnimSequenceID = seqs[i];
|
||||
|
||||
ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock();
|
||||
ani.AnimationSourceList[i].ObjectID = objectIDs[i];
|
||||
if (objectIDs[i] == UUID.Zero)
|
||||
ani.AnimationSourceList[i].ObjectID = sourceAgentId;
|
||||
if (objectIDs[i].Equals(sourceAgentId))
|
||||
ani.AnimationSourceList[i].ObjectID = UUID.Zero;
|
||||
else
|
||||
ani.AnimationSourceList[i].ObjectID = objectIDs[i];
|
||||
}
|
||||
ani.Header.Reliable = false;
|
||||
OutPacket(ani, ThrottleOutPacketType.Task);
|
||||
|
|
|
@ -256,18 +256,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public string GetStats()
|
||||
{
|
||||
return string.Format(
|
||||
"{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}",
|
||||
"{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}",
|
||||
PacketsSent,
|
||||
PacketsReceived,
|
||||
UnackedBytes,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Resend].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Land].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Wind].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Cloud].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Task].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Texture].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.Asset].Content,
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.State].Content);
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Wind].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count,
|
||||
m_packetOutboxes[(int)ThrottleOutPacketType.State].Count);
|
||||
}
|
||||
|
||||
public void SendPacketStats()
|
||||
|
|
|
@ -114,8 +114,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
//private UDPClientCollection m_clients = new UDPClientCollection();
|
||||
/// <summary>Bandwidth throttle for this UDP server</summary>
|
||||
protected TokenBucket m_throttle;
|
||||
|
||||
/// <summary>Bandwidth throttle rates for this UDP server</summary>
|
||||
protected ThrottleRates m_throttleRates;
|
||||
public ThrottleRates ThrottleRates { get; private set; }
|
||||
|
||||
/// <summary>Manages authentication for agent circuits</summary>
|
||||
private AgentCircuitManager m_circuitManager;
|
||||
/// <summary>Reference to the scene this UDP server is attached to</summary>
|
||||
|
@ -226,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
#endregion BinaryStats
|
||||
|
||||
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
|
||||
m_throttleRates = new ThrottleRates(configSource);
|
||||
ThrottleRates = new ThrottleRates(configSource);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
|
@ -585,8 +587,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
// Stats tracking
|
||||
Interlocked.Increment(ref udpClient.PacketsSent);
|
||||
if (isReliable)
|
||||
Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
|
||||
|
||||
// Put the UDP payload on the wire
|
||||
AsyncBeginSend(buffer);
|
||||
|
@ -648,7 +648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
IClientAPI client;
|
||||
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
||||
{
|
||||
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||
//m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -859,9 +859,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// Acknowledge the UseCircuitCode packet
|
||||
SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
||||
buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
||||
// m_log.DebugFormat(
|
||||
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
||||
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
||||
}
|
||||
|
||||
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
|
||||
|
@ -924,7 +924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
|
||||
{
|
||||
// Create the LLUDPClient
|
||||
LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
|
||||
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
|
||||
IClientAPI existingClient;
|
||||
|
||||
// REGION SYNC (Load Balancing)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
@ -77,6 +78,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public void Add(OutgoingPacket packet)
|
||||
{
|
||||
m_pendingAdds.Enqueue(packet);
|
||||
Interlocked.Add(ref packet.Client.UnackedBytes, packet.Buffer.DataLength);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -139,46 +141,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private void ProcessQueues()
|
||||
{
|
||||
// Process all the pending adds
|
||||
|
||||
OutgoingPacket pendingAdd;
|
||||
if (m_pendingAdds != null)
|
||||
{
|
||||
while (m_pendingAdds.TryDequeue(out pendingAdd))
|
||||
{
|
||||
if (pendingAdd != null && m_packets != null)
|
||||
{
|
||||
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (m_pendingAdds.TryDequeue(out pendingAdd))
|
||||
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
|
||||
|
||||
// Process all the pending removes, including updating statistics and round-trip times
|
||||
PendingAck pendingRemove;
|
||||
OutgoingPacket ackedPacket;
|
||||
if (m_pendingRemoves != null)
|
||||
while (m_pendingRemoves.TryDequeue(out pendingRemove))
|
||||
{
|
||||
while (m_pendingRemoves.TryDequeue(out pendingRemove))
|
||||
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
|
||||
{
|
||||
if (m_pendingRemoves != null && m_packets != null)
|
||||
m_packets.Remove(pendingRemove.SequenceNumber);
|
||||
|
||||
// Update stats
|
||||
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
|
||||
|
||||
if (!pendingRemove.FromResend)
|
||||
{
|
||||
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
|
||||
{
|
||||
m_packets.Remove(pendingRemove.SequenceNumber);
|
||||
|
||||
// Update stats
|
||||
System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
|
||||
|
||||
if (!pendingRemove.FromResend)
|
||||
{
|
||||
// Calculate the round-trip time for this packet and its ACK
|
||||
int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
|
||||
if (rtt > 0)
|
||||
ackedPacket.Client.UpdateRoundTrip(rtt);
|
||||
}
|
||||
}
|
||||
// Calculate the round-trip time for this packet and its ACK
|
||||
int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
|
||||
if (rtt > 0)
|
||||
ackedPacket.Client.UpdateRoundTrip(rtt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,8 +41,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
/// </summary>
|
||||
public class AgentAssetTransactions
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Fields
|
||||
private bool m_dumpAssetsToFile;
|
||||
|
|
|
@ -49,8 +49,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetMeshModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
|
@ -102,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
// m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
caps.RegisterHandler("GetMesh",
|
||||
new RestHTTPHandler("GET", "/CAPS/" + capID,
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
// m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
||||
private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format)
|
||||
{
|
||||
m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||
AssetBase texture;
|
||||
|
||||
string fullID = textureID.ToString();
|
||||
|
|
|
@ -50,8 +50,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_dumpAssetsToFile = false;
|
||||
|
@ -104,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID);
|
||||
caps.RegisterHandler("NewFileAgentInventoryVariablePrice",
|
||||
|
||||
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST",
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId);
|
||||
m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId);
|
||||
|
||||
// If we only found default textures, then the appearance is not cached
|
||||
return (defonly ? false : true);
|
||||
|
@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
return;
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}",client.AgentId);
|
||||
// m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId);
|
||||
|
||||
// TODO: This is probably not necessary any longer, just assume the
|
||||
// textureEntry set implies that the appearance transaction is complete
|
||||
|
@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
{
|
||||
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
|
||||
|
||||
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}",client.AgentId);
|
||||
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId);
|
||||
Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); });
|
||||
|
||||
// This appears to be set only in the final stage of the appearance
|
||||
|
|
|
@ -489,7 +489,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
im.imSessionID = im.fromAgentID;
|
||||
|
||||
// Try the local sim
|
||||
UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID);
|
||||
UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, agentID);
|
||||
im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
|
||||
|
||||
if (LocalFriendshipOffered(friendID, im))
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
|
||||
return FailureResult();
|
||||
|
||||
UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID);
|
||||
UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(UUID.Zero, fromID);
|
||||
string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
|
||||
|
||||
GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID,
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
|||
item = invService.GetItem(item);
|
||||
if (item != null)
|
||||
{
|
||||
item.Flags = 1;
|
||||
item.Flags |= 1;
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
|
@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
|||
item = invService.GetItem(item);
|
||||
if (item != null)
|
||||
{
|
||||
item.Flags = 0;
|
||||
item.Flags &= ~(uint)1;
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
|
@ -93,4 +93,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
|||
"[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
if (!user.IsChildAgent)
|
||||
{
|
||||
// Local message
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
|
||||
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
// Message sent
|
||||
|
@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
// Local message
|
||||
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
|
||||
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
// Message sent
|
||||
|
@ -177,7 +177,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
|
||||
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
|
||||
SendGridInstantMessageViaXMLRPC(im, result);
|
||||
|
||||
return;
|
||||
|
|
|
@ -139,6 +139,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
if (options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving item {0} with asset {1}", inventoryItem.ID, inventoryItem.AssetID);
|
||||
|
||||
string filename = path + CreateArchiveItemName(inventoryItem);
|
||||
|
||||
// Record the creator of this item for user record purposes (which might go away soon)
|
||||
|
@ -162,6 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself,
|
||||
Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
if (options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name);
|
||||
|
||||
if (saveThisFolderItself)
|
||||
{
|
||||
path += CreateArchiveFolderName(inventoryFolder);
|
||||
|
|
|
@ -122,12 +122,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
scene.AddCommand(
|
||||
this, "save iar",
|
||||
"save iar [--p|-profile=<url>] <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"save iar [--p|-profile=<url>] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]",
|
||||
"Save user inventory archive (IAR).",
|
||||
"<first> is the user's first name." + Environment.NewLine
|
||||
+ "<last> is the user's last name." + Environment.NewLine
|
||||
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
|
||||
+ "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
||||
+ "-v|--verbose extra debug messages." + Environment.NewLine
|
||||
+ "<IAR path> is the filesystem path at which to save the IAR."
|
||||
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
||||
HandleSaveInvConsoleCommand);
|
||||
|
@ -394,6 +395,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
OptionSet ops = new OptionSet();
|
||||
//ops.Add("v|version=", delegate(string v) { options["version"] = v; });
|
||||
ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
|
||||
ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; });
|
||||
|
||||
List<string> mainParams = ops.Parse(cmdparams);
|
||||
|
||||
|
|
|
@ -43,8 +43,9 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
{
|
||||
public class ObjectAdd : IRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
#region IRegionModule Members
|
||||
|
||||
|
@ -63,7 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
{
|
||||
UUID capuuid = UUID.Random();
|
||||
|
||||
m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/");
|
||||
// m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/");
|
||||
|
||||
caps.RegisterHandler("ObjectAdd",
|
||||
new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/",
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.Info("[UploadObjectAssetModule]: /CAPS/" + capID);
|
||||
// m_log.Debug("[UPLOAD OBJECT ASSET MODULE]: /CAPS/" + capID);
|
||||
caps.RegisterHandler("UploadObjectAsset",
|
||||
new RestHTTPHandler("POST", "/CAPS/OA/" + capID + "/",
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[UploadObjectAssetModule]: Error deserializing message " + ex.ToString());
|
||||
m_log.Error("[UPLOAD OBJECT ASSET MODULE]: Error deserializing message " + ex.ToString());
|
||||
message = null;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation);
|
||||
Quaternion rot = Quaternion.Identity;
|
||||
Vector3 rootpos = Vector3.Zero;
|
||||
Quaternion rootrot = Quaternion.Identity;
|
||||
// Quaternion rootrot = Quaternion.Identity;
|
||||
|
||||
SceneObjectGroup rootGroup = null;
|
||||
SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length];
|
||||
|
@ -186,11 +186,9 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
if (i == 0)
|
||||
{
|
||||
rootpos = obj.Position;
|
||||
rootrot = obj.Rotation;
|
||||
|
||||
// rootrot = obj.Rotation;
|
||||
}
|
||||
|
||||
|
||||
// Combine the extraparams data into it's ugly blob again....
|
||||
//int bytelength = 0;
|
||||
//for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++)
|
||||
|
@ -363,9 +361,8 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId));
|
||||
|
||||
return responsedata;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private string ConvertUintToBytes(uint val)
|
||||
{
|
||||
byte[] resultbytes = Utils.UIntToBytes(val);
|
||||
|
@ -374,4 +371,4 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
return String.Format("<binary encoding=\"base64\">{0}</binary>", Convert.ToBase64String(resultbytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1203,6 +1203,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString());
|
||||
}
|
||||
if (!regionAccepted)
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1517,7 +1519,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
// If we fail to cross the border, then reset the position of the scene object on that border.
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(newRegionHandle, out x, out y);
|
||||
GridRegion destination = scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
|
||||
{
|
||||
grp.OffsetForNewRegion(oldGroupPosition);
|
||||
|
|
|
@ -434,10 +434,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
|
||||
|
||||
// Magic number badness. Maybe this deserves an enum.
|
||||
// bit 4 (16) is the "Slam" bit, it means treat as passed
|
||||
// and apply next owner perms on rez
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -640,8 +637,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
rootPart.Name = item.Name;
|
||||
rootPart.Description = item.Description;
|
||||
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0)
|
||||
{
|
||||
rootPart.ObjectSaleType = item.SaleType;
|
||||
rootPart.SalePrice = item.SalePrice;
|
||||
}
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
||||
if ((rootPart.OwnerID != item.Owner) ||
|
||||
(item.CurrentPermissions & 16) != 0 || // Magic number
|
||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||
{
|
||||
//Need to kill the for sale here
|
||||
rootPart.ObjectSaleType = 0;
|
||||
|
@ -651,9 +656,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
|
@ -669,8 +677,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
return returnstring;
|
||||
}
|
||||
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid);
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
||||
|
@ -121,7 +122,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
|||
|
||||
#region ILandService
|
||||
|
||||
public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
|
||||
regionHandle, m_Scenes.Count);
|
||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
||||
{
|
||||
|
@ -116,7 +117,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
|
||||
#region ILandService
|
||||
|
||||
public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
regionAccess = 2;
|
||||
m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}",
|
||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
||||
|
@ -109,13 +110,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
|
||||
#region ILandService
|
||||
|
||||
public override LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
public override LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
LandData land = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess);
|
||||
LandData land = m_LocalService.GetLandData(scopeID, regionHandle, x, y, out regionAccess);
|
||||
if (land != null)
|
||||
return land;
|
||||
|
||||
return base.GetLandData(regionHandle, x, y, out regionAccess);
|
||||
return base.GetLandData(scopeID, regionHandle, x, y, out regionAccess);
|
||||
|
||||
}
|
||||
#endregion ILandService
|
||||
|
|
|
@ -300,7 +300,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
if (s.RegionInfo.RegionID == destination.RegionID)
|
||||
{
|
||||
//m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent");
|
||||
return s.IncomingCloseAgent(id);
|
||||
// Let's spawn a threadlet right here, because this may take
|
||||
// a while
|
||||
Util.FireAndForget(delegate { s.IncomingCloseAgent(id); });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
|
||||
|
|
|
@ -249,14 +249,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
|
||||
if (asset != null)
|
||||
{
|
||||
// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
|
||||
if (m_options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id);
|
||||
|
||||
m_foundAssetUuids.Add(asset.FullID);
|
||||
|
||||
m_assetsArchiver.WriteAsset(PostProcess(asset));
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id);
|
||||
if (m_options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id);
|
||||
|
||||
m_notFoundAssetUuids.Add(new UUID(id));
|
||||
}
|
||||
|
||||
|
|
|
@ -767,6 +767,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
|
||||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
private void LookupUUID(List<UUID> uuidLst)
|
||||
{
|
||||
LookupUUIDS d = LookupUUIDsAsync;
|
||||
|
@ -775,6 +776,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
LookupUUIDSCompleted,
|
||||
d);
|
||||
}
|
||||
|
||||
private void LookupUUIDsAsync(List<UUID> uuidLst)
|
||||
{
|
||||
UUID[] uuidarr;
|
||||
|
@ -789,12 +791,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
|
||||
|
||||
IUserManagement userManager = m_scene.RequestModuleInterface<IUserManagement>();
|
||||
string userName = "Unkown User";
|
||||
if (userManager != null)
|
||||
userName = userManager.GetUserName(uuidarr[i]);
|
||||
userManager.GetUserName(uuidarr[i]);
|
||||
|
||||
// we drop it. It gets cached though... so we're ready for the next request.
|
||||
// diva commnent 11/21/2010: uh?!? wft?
|
||||
// justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume.
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -1510,40 +1510,40 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
if (parcelID == UUID.Zero)
|
||||
return;
|
||||
|
||||
ExtendedLandData data =
|
||||
(ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
|
||||
delegate(string id)
|
||||
{
|
||||
UUID parcel = UUID.Zero;
|
||||
UUID.TryParse(id, out parcel);
|
||||
// assume we've got the parcelID we just computed in RemoteParcelRequest
|
||||
ExtendedLandData extLandData = new ExtendedLandData();
|
||||
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
|
||||
out extLandData.X, out extLandData.Y);
|
||||
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
|
||||
extLandData.RegionHandle, extLandData.X, extLandData.Y);
|
||||
ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
|
||||
delegate(string id)
|
||||
{
|
||||
UUID parcel = UUID.Zero;
|
||||
UUID.TryParse(id, out parcel);
|
||||
// assume we've got the parcelID we just computed in RemoteParcelRequest
|
||||
ExtendedLandData extLandData = new ExtendedLandData();
|
||||
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
|
||||
out extLandData.X, out extLandData.Y);
|
||||
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
|
||||
extLandData.RegionHandle, extLandData.X, extLandData.Y);
|
||||
|
||||
// for this region or for somewhere else?
|
||||
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
|
||||
extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILandService landService = m_scene.RequestModuleInterface<ILandService>();
|
||||
extLandData.LandData = landService.GetLandData(extLandData.RegionHandle,
|
||||
extLandData.X,
|
||||
extLandData.Y,
|
||||
out extLandData.RegionAccess);
|
||||
if (extLandData.LandData == null)
|
||||
{
|
||||
// we didn't find the region/land => don't cache
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return extLandData;
|
||||
});
|
||||
// for this region or for somewhere else?
|
||||
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
|
||||
extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILandService landService = m_scene.RequestModuleInterface<ILandService>();
|
||||
extLandData.LandData = landService.GetLandData(m_scene.RegionInfo.ScopeID,
|
||||
extLandData.RegionHandle,
|
||||
extLandData.X,
|
||||
extLandData.Y,
|
||||
out extLandData.RegionAccess);
|
||||
if (extLandData.LandData == null)
|
||||
{
|
||||
// we didn't find the region/land => don't cache
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return extLandData;
|
||||
});
|
||||
|
||||
if (data != null) // if we found some data, send it
|
||||
{
|
||||
|
@ -1557,7 +1557,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
// most likely still cached from building the extLandData entry
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(data.RegionHandle, out x, out y);
|
||||
info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
}
|
||||
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
|
||||
m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
|
||||
|
|
|
@ -217,6 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
ParcelFlags.AllowDamage |
|
||||
ParcelFlags.CreateObjects |
|
||||
ParcelFlags.RestrictPushObject |
|
||||
ParcelFlags.AllowOtherScripts |
|
||||
ParcelFlags.AllowGroupScripts |
|
||||
ParcelFlags.CreateGroupObjects |
|
||||
ParcelFlags.AllowAPrimitiveEntry |
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
|||
part.NextOwnerMask;
|
||||
item.GroupPermissions = part.GroupMask &
|
||||
part.NextOwnerMask;
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (m_scene.AddInventoryItem(item))
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
|||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Commander m_commander = new Commander("export");
|
||||
// private Commander m_commander = new Commander("export");
|
||||
private List<Scene> m_regions = new List<Scene>();
|
||||
private string m_savedir = "exports";
|
||||
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
|
||||
|
@ -77,14 +77,13 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
|||
m_serialisers.Add(new SerialiseObjects());
|
||||
}
|
||||
|
||||
LoadCommanderCommands();
|
||||
// LoadCommanderCommands();
|
||||
}
|
||||
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
scene.RegisterModuleCommander(m_commander);
|
||||
scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
// scene.RegisterModuleCommander(m_commander);
|
||||
// scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
scene.RegisterModuleInterface<IRegionSerialiserModule>(this);
|
||||
|
||||
lock (m_regions)
|
||||
|
@ -211,18 +210,18 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
|||
|
||||
#endregion
|
||||
|
||||
private void EventManager_OnPluginConsole(string[] args)
|
||||
{
|
||||
if (args[0] == "export")
|
||||
{
|
||||
string[] tmpArgs = new string[args.Length - 2];
|
||||
int i = 0;
|
||||
for (i = 2; i < args.Length; i++)
|
||||
tmpArgs[i - 2] = args[i];
|
||||
|
||||
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||
}
|
||||
}
|
||||
// private void EventManager_OnPluginConsole(string[] args)
|
||||
// {
|
||||
// if (args[0] == "export")
|
||||
// {
|
||||
// string[] tmpArgs = new string[args.Length - 2];
|
||||
// int i = 0;
|
||||
// for (i = 2; i < args.Length; i++)
|
||||
// tmpArgs[i - 2] = args[i];
|
||||
//
|
||||
// m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||
// }
|
||||
// }
|
||||
|
||||
private void InterfaceSaveRegion(Object[] args)
|
||||
{
|
||||
|
@ -245,15 +244,15 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
|||
}
|
||||
}
|
||||
|
||||
private void LoadCommanderCommands()
|
||||
{
|
||||
Command serialiseSceneCommand = new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveRegion, "Saves the named region into the exports directory.");
|
||||
serialiseSceneCommand.AddArgument("region-name", "The name of the region you wish to export", "String");
|
||||
|
||||
Command serialiseAllScenesCommand = new Command("save-all",CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveAllRegions, "Saves all regions into the exports directory.");
|
||||
|
||||
m_commander.RegisterCommand("save", serialiseSceneCommand);
|
||||
m_commander.RegisterCommand("save-all", serialiseAllScenesCommand);
|
||||
}
|
||||
// private void LoadCommanderCommands()
|
||||
// {
|
||||
// Command serialiseSceneCommand = new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveRegion, "Saves the named region into the exports directory.");
|
||||
// serialiseSceneCommand.AddArgument("region-name", "The name of the region you wish to export", "String");
|
||||
//
|
||||
// Command serialiseAllScenesCommand = new Command("save-all",CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveAllRegions, "Saves all regions into the exports directory.");
|
||||
//
|
||||
// m_commander.RegisterCommand("save", serialiseSceneCommand);
|
||||
// m_commander.RegisterCommand("save-all", serialiseAllScenesCommand);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
{
|
||||
public class SoundModule : IRegionModule, ISoundModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Scene m_scene;
|
||||
|
||||
|
|
|
@ -85,9 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
|||
public static float noise1(float arg)
|
||||
{
|
||||
int bx0, bx1;
|
||||
float rx0, rx1, sx, t, u, v, a;
|
||||
|
||||
a = arg;
|
||||
float rx0, rx1, sx, t, u, v;
|
||||
|
||||
t = arg + N;
|
||||
bx0 = ((int)t) & BM;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName);
|
||||
if (info != null) regionInfos.Add(info);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
|
||||
MapBlockData data;
|
||||
|
@ -128,14 +128,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
data.Agents = 0;
|
||||
data.Access = 255;
|
||||
data.MapImageId = UUID.Zero;
|
||||
data.Name = mapName;
|
||||
data.Name = ""; // mapName;
|
||||
data.RegionFlags = 0;
|
||||
data.WaterHeight = 0; // not used
|
||||
data.X = 0;
|
||||
data.Y = 0;
|
||||
blocks.Add(data);
|
||||
|
||||
remoteClient.SendMapBlock(blocks, 2);
|
||||
remoteClient.SendMapBlock(blocks, 0);
|
||||
}
|
||||
|
||||
// private Scene GetClientScene(IClientAPI client)
|
||||
|
|
|
@ -641,7 +641,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
lock (m_openRequests)
|
||||
m_openRequests.Add(requestID, mrs);
|
||||
|
||||
WebRequest mapitemsrequest = WebRequest.Create(httpserver);
|
||||
WebRequest mapitemsrequest = null;
|
||||
try
|
||||
{
|
||||
mapitemsrequest = WebRequest.Create(httpserver);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[WORLD MAP]: Access to {0} failed with {1}", httpserver, e);
|
||||
return new OSDMap();
|
||||
}
|
||||
|
||||
mapitemsrequest.Method = "POST";
|
||||
mapitemsrequest.ContentType = "application/xml+llsd";
|
||||
OSDMap RAMap = new OSDMap();
|
||||
|
|
|
@ -489,8 +489,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
item.Name = itemUpd.Name;
|
||||
item.Description = itemUpd.Description;
|
||||
if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||
item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
|
||||
if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
||||
item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
|
||||
if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
||||
item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
|
||||
item.GroupID = itemUpd.GroupID;
|
||||
item.GroupOwned = itemUpd.GroupOwned;
|
||||
|
@ -505,9 +511,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// TODO: Check if folder changed and move item
|
||||
//item.NextPermissions = itemUpd.Folder;
|
||||
item.InvType = itemUpd.InvType;
|
||||
|
||||
if (item.SalePrice != itemUpd.SalePrice ||
|
||||
item.SaleType != itemUpd.SaleType)
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamSale;
|
||||
item.SalePrice = itemUpd.SalePrice;
|
||||
item.SaleType = itemUpd.SaleType;
|
||||
item.Flags = itemUpd.Flags;
|
||||
|
||||
InventoryService.UpdateItem(item);
|
||||
}
|
||||
|
@ -688,7 +697,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Assign to the actual item. Make sure the slam bit is
|
||||
// set, if it wasn't set before.
|
||||
itemCopy.BasePermissions = basePerms;
|
||||
itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
|
||||
itemCopy.CurrentPermissions = ownerPerms;
|
||||
itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
|
||||
itemCopy.NextPermissions = item.NextPermissions;
|
||||
|
||||
|
@ -1204,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
else
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
||||
|
||||
agentItem.CurrentPermissions |= 16; // Slam
|
||||
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
agentItem.NextPermissions = taskItem.NextPermissions;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
|
||||
|
@ -1415,7 +1425,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
|
||||
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
destTaskItem.CurrentPermissions |= 16; // Slam!
|
||||
destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1596,6 +1606,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Base ALWAYS has move
|
||||
currentItem.BasePermissions |= (uint)PermissionMask.Move;
|
||||
|
||||
itemInfo.Flags = currentItem.Flags;
|
||||
|
||||
// Check if we're allowed to mess with permissions
|
||||
if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
|
||||
{
|
||||
|
@ -1613,6 +1625,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Owner can't change base, and can change other
|
||||
// only up to base
|
||||
itemInfo.BasePermissions = currentItem.BasePermissions;
|
||||
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
||||
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
||||
if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
|
||||
if (itemInfo.NextPermissions != currentItem.NextPermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||
itemInfo.EveryonePermissions &= currentItem.BasePermissions;
|
||||
itemInfo.GroupPermissions &= currentItem.BasePermissions;
|
||||
itemInfo.CurrentPermissions &= currentItem.BasePermissions;
|
||||
|
@ -1620,6 +1640,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemInfo.BasePermissions != currentItem.BasePermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
|
||||
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
||||
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
||||
if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
|
||||
if (itemInfo.NextPermissions != currentItem.NextPermissions)
|
||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||
}
|
||||
|
||||
// Next ALWAYS has move
|
||||
itemInfo.NextPermissions |= (uint)PermissionMask.Move;
|
||||
|
@ -1867,7 +1900,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
srcTaskItem.NextPermissions;
|
||||
destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
|
||||
srcTaskItem.NextPermissions;
|
||||
destTaskItem.CurrentPermissions |= 16; // Slam!
|
||||
destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2331,5 +2364,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_sceneGraph.LinkObjects(root, children);
|
||||
}
|
||||
|
||||
private string PermissionString(uint permissions)
|
||||
{
|
||||
PermissionMask perms = (PermissionMask)permissions &
|
||||
(PermissionMask.Move |
|
||||
PermissionMask.Copy |
|
||||
PermissionMask.Transfer |
|
||||
PermissionMask.Modify);
|
||||
return perms.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool PropagatePermissionsHandler();
|
||||
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
|
||||
public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
|
||||
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
|
||||
public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
|
||||
public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
|
||||
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
|
||||
|
@ -80,10 +81,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
|
||||
public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
||||
public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
||||
public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
||||
public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
|
||||
public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool TransferUserInventoryHandler(UUID itemID, UUID userID, UUID recipientID);
|
||||
public delegate bool TeleportHandler(UUID userID, Scene scene);
|
||||
public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face);
|
||||
public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face);
|
||||
|
@ -107,6 +110,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event PropagatePermissionsHandler OnPropagatePermissions;
|
||||
public event RezObjectHandler OnRezObject;
|
||||
public event DeleteObjectHandler OnDeleteObject;
|
||||
public event TransferObjectHandler OnTransferObject;
|
||||
public event TakeObjectHandler OnTakeObject;
|
||||
public event TakeCopyObjectHandler OnTakeCopyObject;
|
||||
public event DuplicateObjectHandler OnDuplicateObject;
|
||||
|
@ -144,10 +148,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event CreateObjectInventoryHandler OnCreateObjectInventory;
|
||||
public event CopyObjectInventoryHandler OnCopyObjectInventory;
|
||||
public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
|
||||
public event TransferObjectInventoryHandler OnTransferObjectInventory;
|
||||
public event CreateUserInventoryHandler OnCreateUserInventory;
|
||||
public event EditUserInventoryHandler OnEditUserInventory;
|
||||
public event CopyUserInventoryHandler OnCopyUserInventory;
|
||||
public event DeleteUserInventoryHandler OnDeleteUserInventory;
|
||||
public event TransferUserInventoryHandler OnTransferUserInventory;
|
||||
public event TeleportHandler OnTeleport;
|
||||
public event ControlPrimMediaHandler OnControlPrimMedia;
|
||||
public event InteractWithPrimMediaHandler OnInteractWithPrimMedia;
|
||||
|
@ -264,10 +270,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PERMISSIONS]: CanDeleteObject() fired for object {0}, deleter {1}, result {2}",
|
||||
// objectID, deleter, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool CanTransferObject(UUID objectID, UUID recipient)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
TransferObjectHandler handler = OnTransferObject;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (TransferObjectHandler h in list)
|
||||
{
|
||||
if (h(objectID, recipient, m_scene) == false)
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -917,6 +940,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool CanTransferObjectInventory(UUID itemID, UUID objectID, UUID userID)
|
||||
{
|
||||
TransferObjectInventoryHandler handler = OnTransferObjectInventory;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (TransferObjectInventoryHandler h in list)
|
||||
{
|
||||
if (h(itemID, objectID, userID) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the specified user is allowed to create the given inventory type in their inventory.
|
||||
/// </summary>
|
||||
|
@ -1001,6 +1039,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool CanTransferUserInventory(UUID itemID, UUID userID, UUID recipientID)
|
||||
{
|
||||
TransferUserInventoryHandler handler = OnTransferUserInventory;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (TransferUserInventoryHandler h in list)
|
||||
{
|
||||
if (h(itemID, userID, recipientID) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanTeleport(UUID userID)
|
||||
{
|
||||
TeleportHandler handler = OnTeleport;
|
||||
|
|
|
@ -3060,12 +3060,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// and the scene presence and the client, if they exist
|
||||
try
|
||||
{
|
||||
ScenePresence sp = GetScenePresence(agentID);
|
||||
PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
||||
|
||||
// We need to wait for the client to make UDP contact first.
|
||||
// It's the UDP contact that creates the scene presence
|
||||
ScenePresence sp = WaitGetScenePresence(agentID);
|
||||
if (sp != null)
|
||||
sp.ControllingClient.Close();
|
||||
{
|
||||
PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
||||
|
||||
sp.ControllingClient.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID);
|
||||
}
|
||||
// BANG! SLASH!
|
||||
m_authenticateHandler.RemoveCircuit(agentID);
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle);
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
/// This informs all neighboring regions about the settings of it's child agent.
|
||||
|
@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
|
||||
///
|
||||
/// </summary>
|
||||
private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, ulong regionHandle)
|
||||
private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle)
|
||||
{
|
||||
//m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
|
||||
try
|
||||
|
@ -245,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (regionHandle != m_regionInfo.RegionHandle)
|
||||
{
|
||||
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
|
||||
d.BeginInvoke(cAgentData, regionHandle,
|
||||
d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle,
|
||||
SendChildAgentDataUpdateCompleted,
|
||||
d);
|
||||
}
|
||||
|
@ -258,13 +258,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
}
|
||||
|
||||
public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
|
||||
//public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
|
||||
//private void SendCloseChildAgentCompleted(IAsyncResult iar)
|
||||
//{
|
||||
// SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
|
||||
// icon.EndInvoke(iar);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// This Closes child agents on neighboring regions
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// Closes a child agent on a given region
|
||||
/// </summary>
|
||||
protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle)
|
||||
protected void SendCloseChildAgent(UUID agentID, ulong regionHandle)
|
||||
{
|
||||
|
||||
m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle);
|
||||
|
@ -273,25 +277,25 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
|
||||
m_scene.SimulationService.CloseAgent(destination, agentID);
|
||||
}
|
||||
|
||||
private void SendCloseChildAgentCompleted(IAsyncResult iar)
|
||||
{
|
||||
SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
|
||||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes a child agents in a collection of regions. Does so asynchronously
|
||||
/// so that the caller doesn't wait.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="regionslst"></param>
|
||||
public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst)
|
||||
{
|
||||
foreach (ulong handle in regionslst)
|
||||
Util.FireAndForget(delegate
|
||||
{
|
||||
SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
|
||||
d.BeginInvoke(agentID, handle,
|
||||
SendCloseChildAgentCompleted,
|
||||
d);
|
||||
}
|
||||
foreach (ulong handle in regionslst)
|
||||
{
|
||||
SendCloseChildAgent(agentID, handle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
taskItem.NextPermissions = item.NextPermissions;
|
||||
// We're adding this to a prim we don't own. Force
|
||||
// owner change
|
||||
taskItem.CurrentPermissions |= 16; // Slam
|
||||
taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -178,6 +178,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
item.LastOwnerID = item.OwnerID;
|
||||
item.OwnerID = ownerId;
|
||||
item.PermsMask = 0;
|
||||
item.PermsGranter = UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -632,14 +634,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
group.SetGroup(m_part.GroupID, null);
|
||||
|
||||
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
||||
// TODO: Remove magic number badness
|
||||
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
|
||||
{
|
||||
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
|
@ -648,15 +655,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
||||
// TODO: Remove magic number badness
|
||||
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.OwnerID;
|
||||
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
||||
}
|
||||
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
|
@ -688,7 +700,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
item.ParentID = m_part.UUID;
|
||||
item.ParentPartID = m_part.UUID;
|
||||
item.Flags = m_items[item.ItemID].Flags;
|
||||
|
||||
// If group permissions have been set on, check that the groupID is up to date in case it has
|
||||
// changed since permissions were last set.
|
||||
|
@ -843,7 +854,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="xferManager"></param>
|
||||
public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
|
||||
{
|
||||
bool changed = CreateInventoryFile();
|
||||
CreateInventoryFile();
|
||||
|
||||
if (m_inventorySerial == 0) // No inventory
|
||||
{
|
||||
|
@ -949,6 +960,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
|
||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
||||
|
||||
if (item.InvType != (int)InventoryType.Object)
|
||||
{
|
||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
|
@ -999,6 +1017,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.BasePermissions &= item.NextPermissions;
|
||||
item.EveryonePermissions &= item.NextPermissions;
|
||||
item.OwnerChanged = true;
|
||||
item.PermsMask = 0;
|
||||
item.PermsGranter = UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1013,6 +1033,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.BasePermissions = perms;
|
||||
}
|
||||
}
|
||||
m_inventorySerial++;
|
||||
HasInventoryChanged = true;
|
||||
}
|
||||
|
||||
public bool ContainsScripts()
|
||||
|
|
|
@ -969,10 +969,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//else
|
||||
// m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
|
||||
// On the next prim update, all objects will be sent
|
||||
//
|
||||
m_sceneViewer.Reset();
|
||||
|
||||
m_isChildAgent = false;
|
||||
|
||||
// send the animations of the other presences to me
|
||||
|
@ -1149,7 +1145,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void CompleteMovement(IClientAPI client)
|
||||
{
|
||||
DateTime startTime = DateTime.Now;
|
||||
// DateTime startTime = DateTime.Now;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Completing movement of {0} into region {1}",
|
||||
|
@ -1204,9 +1200,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
|
||||
client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
|
||||
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2596,7 +2592,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
|
||||
|
||||
avatar.ControllingClient.SendAvatarDataImmediate(this);
|
||||
Animator.SendAnimPackToClient(avatar.ControllingClient);
|
||||
if (Animator != null)
|
||||
Animator.SendAnimPackToClient(avatar.ControllingClient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3056,10 +3053,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
|
||||
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
|
||||
|
||||
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
|
||||
if (m_scene.m_seeIntoRegionFromNeighbor)
|
||||
m_sceneViewer.Reset();
|
||||
|
||||
//cAgentData.AVHeight;
|
||||
m_rootRegionHandle = cAgentData.RegionHandle;
|
||||
//m_velocity = cAgentData.Velocity;
|
||||
|
|
|
@ -1472,6 +1472,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
{
|
||||
TaskInventoryDictionary tinv = new TaskInventoryDictionary();
|
||||
|
||||
if (reader.IsEmptyElement)
|
||||
{
|
||||
reader.Read();
|
||||
return tinv;
|
||||
}
|
||||
|
||||
reader.ReadStartElement(name, String.Empty);
|
||||
|
||||
while (reader.Name == "TaskInventoryItem")
|
||||
|
@ -1505,6 +1511,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
{
|
||||
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||
|
||||
if (reader.IsEmptyElement)
|
||||
{
|
||||
reader.Read();
|
||||
return shape;
|
||||
}
|
||||
|
||||
reader.ReadStartElement(name, String.Empty); // Shape
|
||||
|
||||
string nodeName = string.Empty;
|
||||
|
|
|
@ -86,6 +86,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="assetUuids">The assets gathered</param>
|
||||
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
|
||||
{
|
||||
// avoid infinite loops
|
||||
if (assetUuids.ContainsKey(assetUuid))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
assetUuids[assetUuid] = assetType;
|
||||
|
|
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Region.ClientStack.LindenUDP;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.UDP.Linden
|
||||
{
|
||||
/// <summary>
|
||||
/// A module that just holds commands for inspecting the current state of the Linden UDP stack.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// All actual client stack functionality remains in OpenSim.Region.ClientStack.LindenUDP
|
||||
/// </remarks>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")]
|
||||
public class LindenUDPInfoModule : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||
|
||||
public string Name { get { return "Linden UDP Module"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: POST INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: CLOSED MODULE");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||
|
||||
lock (m_scenes)
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show queues",
|
||||
"show queues [full]",
|
||||
"Show queue data for each client",
|
||||
"Without the 'full' option, only root agents are shown."
|
||||
+ " With the 'full' option child agents are also shown.",
|
||||
ShowQueuesReport);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show throttles",
|
||||
"show throttles [full]",
|
||||
"Show throttle settings for each client and for the server overall",
|
||||
"Without the 'full' option, only root agents are shown."
|
||||
+ " With the 'full' option child agents are also shown.",
|
||||
ShowThrottlesReport);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||
|
||||
lock (m_scenes)
|
||||
m_scenes.Remove(scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
protected void ShowQueuesReport(string module, string[] cmd)
|
||||
{
|
||||
MainConsole.Instance.Output(GetQueuesReport(cmd));
|
||||
}
|
||||
|
||||
protected void ShowThrottlesReport(string module, string[] cmd)
|
||||
{
|
||||
MainConsole.Instance.Output(GetThrottlesReport(cmd));
|
||||
}
|
||||
|
||||
protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
|
||||
{
|
||||
return string.Format(
|
||||
"{0,-" + maxLength + "}{1,-" + columnPadding + "}",
|
||||
entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
|
||||
"");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate UDP Queue data report for each client
|
||||
/// </summary>
|
||||
/// <param name="showParams"></param>
|
||||
/// <returns></returns>
|
||||
protected string GetQueuesReport(string[] showParams)
|
||||
{
|
||||
bool showChildren = false;
|
||||
|
||||
if (showParams.Length > 2 && showParams[2] == "full")
|
||||
showChildren = true;
|
||||
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
int columnPadding = 2;
|
||||
int maxNameLength = 18;
|
||||
int maxRegionNameLength = 14;
|
||||
int maxTypeLength = 4;
|
||||
int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
|
||||
|
||||
report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Bytes",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Pkts",
|
||||
"Pkts");
|
||||
|
||||
report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
|
||||
"Out",
|
||||
"In",
|
||||
"Unacked",
|
||||
"Resend",
|
||||
"Land",
|
||||
"Wind",
|
||||
"Cloud",
|
||||
"Task",
|
||||
"Texture",
|
||||
"Asset",
|
||||
"State");
|
||||
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
scene.ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
if (client is IStatsCollector)
|
||||
{
|
||||
bool isChild = scene.PresenceChildStatus(client.AgentId);
|
||||
if (isChild && !showChildren)
|
||||
return;
|
||||
|
||||
string name = client.Name;
|
||||
string regionName = scene.RegionInfo.RegionName;
|
||||
|
||||
report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
|
||||
|
||||
IStatsCollector stats = (IStatsCollector)client;
|
||||
|
||||
report.AppendLine(stats.Report());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return report.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show throttle data
|
||||
/// </summary>
|
||||
/// <param name="showParams"></param>
|
||||
/// <returns></returns>
|
||||
protected string GetThrottlesReport(string[] showParams)
|
||||
{
|
||||
bool showChildren = false;
|
||||
|
||||
if (showParams.Length > 2 && showParams[2] == "full")
|
||||
showChildren = true;
|
||||
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
int columnPadding = 2;
|
||||
int maxNameLength = 18;
|
||||
int maxRegionNameLength = 14;
|
||||
int maxTypeLength = 4;
|
||||
int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
|
||||
|
||||
report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
|
||||
"Total",
|
||||
"Resend",
|
||||
"Land",
|
||||
"Wind",
|
||||
"Cloud",
|
||||
"Task",
|
||||
"Texture",
|
||||
"Asset");
|
||||
|
||||
report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s");
|
||||
|
||||
report.AppendLine();
|
||||
|
||||
bool firstClient = true;
|
||||
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
scene.ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
if (client is LLClientView)
|
||||
{
|
||||
LLClientView llClient = client as LLClientView;
|
||||
|
||||
if (firstClient)
|
||||
{
|
||||
report.AppendLine(GetServerThrottlesReport(llClient.UDPServer));
|
||||
firstClient = false;
|
||||
}
|
||||
|
||||
bool isChild = scene.PresenceChildStatus(client.AgentId);
|
||||
if (isChild && !showChildren)
|
||||
return;
|
||||
|
||||
string name = client.Name;
|
||||
string regionName = scene.RegionInfo.RegionName;
|
||||
|
||||
LLUDPClient llUdpClient = llClient.UDPClient;
|
||||
ClientInfo ci = llUdpClient.GetClientInfo();
|
||||
|
||||
report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
|
||||
(ci.totalThrottle * 8) / 1000,
|
||||
(ci.resendThrottle * 8) / 1000,
|
||||
(ci.landThrottle * 8) / 1000,
|
||||
(ci.windThrottle * 8) / 1000,
|
||||
(ci.cloudThrottle * 8) / 1000,
|
||||
(ci.taskThrottle * 8) / 1000,
|
||||
(ci.textureThrottle * 8) / 1000,
|
||||
(ci.assetThrottle * 8) / 1000);
|
||||
|
||||
report.AppendLine();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return report.ToString();
|
||||
}
|
||||
|
||||
protected string GetServerThrottlesReport(LLUDPServer udpServer)
|
||||
{
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
int columnPadding = 2;
|
||||
int maxNameLength = 18;
|
||||
int maxRegionNameLength = 14;
|
||||
int maxTypeLength = 4;
|
||||
|
||||
string name = "SERVER AGENT LIMITS";
|
||||
|
||||
report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding));
|
||||
report.Append(GetColumnEntry("-", maxTypeLength, columnPadding));
|
||||
|
||||
ThrottleRates throttleRates = udpServer.ThrottleRates;
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
|
||||
"n/a",
|
||||
(throttleRates.ResendLimit * 8) / 1000,
|
||||
(throttleRates.LandLimit * 8) / 1000,
|
||||
(throttleRates.WindLimit * 8) / 1000,
|
||||
(throttleRates.CloudLimit * 8) / 1000,
|
||||
(throttleRates.TaskLimit * 8) / 1000,
|
||||
(throttleRates.TextureLimit * 8) / 1000,
|
||||
(throttleRates.AssetLimit * 8) / 1000);
|
||||
|
||||
return report.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -123,8 +123,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name);
|
||||
|
||||
m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true);
|
||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
||||
|
||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -871,7 +871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
public Dictionary<string, object> GetVars()
|
||||
{
|
||||
return m_Script.GetVars();
|
||||
if (m_Script != null)
|
||||
return m_Script.GetVars();
|
||||
else
|
||||
return new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
public void SetVars(Dictionary<string, object> vars)
|
||||
|
|
|
@ -558,7 +558,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
else if (m_data[itemIndex] is Int32)
|
||||
return new LSLInteger((int)m_data[itemIndex]);
|
||||
else if (m_data[itemIndex] is LSL_Types.LSLString)
|
||||
return new LSLInteger((string)m_data[itemIndex]);
|
||||
return new LSLInteger(m_data[itemIndex].ToString());
|
||||
else
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
{
|
||||
public class GridInfoServerInConnector : ServiceConnector
|
||||
{
|
||||
private string m_ConfigName = "GridInfoService";
|
||||
// private string m_ConfigName = "GridInfoService";
|
||||
|
||||
public GridInfoServerInConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
|
|
|
@ -51,7 +51,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
{
|
||||
public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IGatekeeperService m_GatekeeperService;
|
||||
|
||||
public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy)
|
||||
|
|
|
@ -41,9 +41,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
{
|
||||
public class GatekeeperServiceInConnector : ServiceConnector
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IGatekeeperService m_GatekeeperService;
|
||||
public IGatekeeperService GateKeeper
|
||||
|
|
|
@ -215,13 +215,22 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
|
||||
// We're behind a proxy
|
||||
Hashtable headers = (Hashtable)request["headers"];
|
||||
if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null)
|
||||
string xff = "X-Forwarded-For";
|
||||
if (headers.ContainsKey(xff.ToLower()))
|
||||
xff = xff.ToLower();
|
||||
|
||||
if (!headers.ContainsKey(xff) || headers[xff] == null)
|
||||
{
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]);
|
||||
if (ep != null)
|
||||
return ep.Address.ToString();
|
||||
m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
||||
return Util.GetCallerIP(request);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
|
||||
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
|
||||
if (ep != null)
|
||||
return ep.Address.ToString();
|
||||
|
||||
// Oops
|
||||
return Util.GetCallerIP(request);
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
{
|
||||
public class UserAgentServerConnector : ServiceConnector
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IUserAgentService m_HomeUsersService;
|
||||
|
||||
|
|
|
@ -347,7 +347,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleAddFolder(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||
InventoryFolderBase folder = BuildFolder(request);
|
||||
|
||||
if (m_InventoryService.AddFolder(folder))
|
||||
|
@ -358,7 +357,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleUpdateFolder(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
InventoryFolderBase folder = BuildFolder(request);
|
||||
|
||||
if (m_InventoryService.UpdateFolder(folder))
|
||||
|
@ -369,7 +367,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleMoveFolder(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
UUID parentID = UUID.Zero;
|
||||
UUID.TryParse(request["ParentID"].ToString(), out parentID);
|
||||
UUID folderID = UUID.Zero;
|
||||
|
@ -387,7 +384,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleDeleteFolders(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||
UUID principal = UUID.Zero;
|
||||
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
|
||||
List<string> slist = (List<string>)request["FOLDERS"];
|
||||
|
@ -408,7 +404,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandlePurgeFolder(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||
UUID folderID = UUID.Zero;
|
||||
UUID.TryParse(request["ID"].ToString(), out folderID);
|
||||
|
||||
|
@ -421,7 +416,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleAddItem(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
InventoryItemBase item = BuildItem(request);
|
||||
|
||||
if (m_InventoryService.AddItem(item))
|
||||
|
@ -432,7 +426,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleUpdateItem(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
InventoryItemBase item = BuildItem(request);
|
||||
|
||||
if (m_InventoryService.UpdateItem(item))
|
||||
|
@ -443,7 +436,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleMoveItems(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||
List<string> idlist = (List<string>)request["IDLIST"];
|
||||
List<string> destlist = (List<string>)request["DESTLIST"];
|
||||
UUID principal = UUID.Zero;
|
||||
|
@ -482,7 +474,6 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
byte[] HandleDeleteItems(Dictionary<string,object> request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
UUID principal = UUID.Zero;
|
||||
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
|
||||
List<string> slist = (List<string>)request["ITEMS"];
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Land
|
|||
m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);
|
||||
|
||||
byte regionAccess;
|
||||
LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess);
|
||||
LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess);
|
||||
Hashtable hash = new Hashtable();
|
||||
if (landData != null)
|
||||
{
|
||||
|
|
|
@ -129,8 +129,6 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
byte[] LogoutAgent(Dictionary<string, object> request)
|
||||
{
|
||||
UUID session = UUID.Zero;
|
||||
Vector3 position = Vector3.Zero;
|
||||
Vector3 lookat = Vector3.Zero;
|
||||
|
||||
if (!request.ContainsKey("SessionID"))
|
||||
return FailureResult();
|
||||
|
|
|
@ -200,13 +200,22 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
|
||||
// We're behind a proxy
|
||||
Hashtable headers = (Hashtable)request["headers"];
|
||||
if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null)
|
||||
string xff = "X-Forwarded-For";
|
||||
if (headers.ContainsKey(xff.ToLower()))
|
||||
xff = xff.ToLower();
|
||||
|
||||
if (!headers.ContainsKey(xff) || headers[xff] == null)
|
||||
{
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]);
|
||||
if (ep != null)
|
||||
return ep.Address.ToString();
|
||||
m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
||||
return Util.GetCallerIP(request);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
|
||||
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
|
||||
if (ep != null)
|
||||
return ep.Address.ToString();
|
||||
|
||||
// Oops
|
||||
return Util.GetCallerIP(request);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
public class SimulationServiceInConnector : ServiceConnector
|
||||
{
|
||||
private ISimulationService m_LocalSimulationService;
|
||||
private IAuthenticationService m_AuthenticationService;
|
||||
// private IAuthenticationService m_AuthenticationService;
|
||||
|
||||
public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
|
||||
base(config, server, String.Empty)
|
||||
|
|
|
@ -158,10 +158,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
try
|
||||
{
|
||||
WebClient c = new WebClient();
|
||||
//m_log.Debug("JPEG: " + imageURL);
|
||||
string name = regionID.ToString();
|
||||
filename = Path.Combine(storagePath, name + ".jpg");
|
||||
c.DownloadFile(imageURL, filename);
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename);
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading...");
|
||||
c.DownloadFile(imageURL, filename);
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
|
||||
|
||||
bitmap = new Bitmap(filename);
|
||||
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
|
||||
byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
|
||||
|
@ -172,10 +179,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
|
||||
ass.Data = imageData;
|
||||
|
||||
m_AssetService.Store(ass);
|
||||
mapTile = ass.FullID;
|
||||
|
||||
// finally
|
||||
mapTile = ass.FullID;
|
||||
m_AssetService.Store(ass);
|
||||
|
||||
}
|
||||
catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
|
||||
{
|
||||
|
@ -283,46 +291,52 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
|
||||
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
|
||||
{
|
||||
HttpWebRequest AgentCreateRequest = null;
|
||||
// m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: CreateAgent start");
|
||||
|
||||
myipaddress = String.Empty;
|
||||
reason = String.Empty;
|
||||
|
||||
if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
|
||||
if (destination == null)
|
||||
{
|
||||
string response = GetResponse(AgentCreateRequest, out reason);
|
||||
bool success = true;
|
||||
UnpackResponse(response, out success, out reason, out myipaddress);
|
||||
return success;
|
||||
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Given destination is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
|
||||
|
||||
try
|
||||
{
|
||||
OSDMap args = aCircuit.PackAgentCircuitData();
|
||||
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
args["teleport_flags"] = OSD.FromString(flags.ToString());
|
||||
|
||||
OSDMap result = WebUtil.PostToService(uri,args);
|
||||
if (result["Success"].AsBoolean())
|
||||
{
|
||||
OSDMap unpacked = (OSDMap)result["_Result"];
|
||||
|
||||
if (unpacked != null)
|
||||
{
|
||||
reason = unpacked["reason"].AsString();
|
||||
myipaddress = unpacked["your_ip"].AsString();
|
||||
return unpacked["success"].AsBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
reason = result["Message"] != null ? result["Message"].AsString() : "error";
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e.ToString());
|
||||
reason = e.Message;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void UnpackResponse(string response, out bool result, out string reason, out string ipaddress)
|
||||
{
|
||||
result = true;
|
||||
reason = string.Empty;
|
||||
ipaddress = string.Empty;
|
||||
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
{
|
||||
try
|
||||
{
|
||||
// we assume we got an OSDMap back
|
||||
OSDMap r = Util.GetOSDMap(response);
|
||||
result = r["success"].AsBoolean();
|
||||
reason = r["reason"].AsString();
|
||||
ipaddress = r["your_ip"].AsString();
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.InfoFormat("[GATEKEEPER SERVICE CONNECTOR]: exception on UnpackResponse of DoCreateChildAgentCall {0}", e.Message);
|
||||
reason = "Internal error";
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,9 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
{
|
||||
Uri m_Uri = new Uri(m_ServerURL);
|
||||
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
|
||||
m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ;
|
||||
m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString());
|
||||
if (!m_ServerURL.EndsWith("/"))
|
||||
m_ServerURL += "/";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -87,6 +89,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
throw new Exception("UserAgent connector init error");
|
||||
}
|
||||
m_ServerURL = serviceURI;
|
||||
if (!m_ServerURL.EndsWith("/"))
|
||||
m_ServerURL += "/";
|
||||
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Services.Connectors
|
|||
m_GridService = gridServices;
|
||||
}
|
||||
|
||||
public virtual LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
LandData landData = null;
|
||||
Hashtable hash = new Hashtable();
|
||||
|
@ -80,7 +80,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
uint xpos = 0, ypos = 0;
|
||||
Utils.LongToUInts(regionHandle, out xpos, out ypos);
|
||||
GridRegion info = m_GridService.GetRegionByPosition(UUID.Zero, (int)xpos, (int)ypos);
|
||||
GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos);
|
||||
if (info != null) // just to be sure
|
||||
{
|
||||
XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y);
|
||||
if ((regInfo != null) &&
|
||||
// Don't remote-call this instance; that's a startup hickup
|
||||
!((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort)))
|
||||
|
|
|
@ -174,9 +174,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return false;
|
||||
}
|
||||
|
||||
// DEBUG ON
|
||||
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR] save appearance for {0}",userID);
|
||||
// DEBUG OFF
|
||||
// m_log.DebugFormat("[SIMIAN AVATAR CONNECTOR] save appearance for {0}",userID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
|
|
@ -0,0 +1,261 @@
|
|||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Timers;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Simian
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianGridMaptile")]
|
||||
public class SimianGridMaptile : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private bool m_enabled = false;
|
||||
private string m_serverUrl = String.Empty;
|
||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||
|
||||
private int m_refreshtime = 0;
|
||||
private int m_lastrefresh = 0;
|
||||
private System.Timers.Timer m_refreshTimer = new System.Timers.Timer();
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
public string Name { get { return "SimianGridMaptile"; } }
|
||||
public void RegionLoaded(Scene scene) { }
|
||||
public void Close() { }
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["SimianGridMaptiles"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
if (! config.GetBoolean("Enabled", false))
|
||||
return;
|
||||
|
||||
m_serverUrl = config.GetString("MaptileURL");
|
||||
if (String.IsNullOrEmpty(m_serverUrl))
|
||||
return;
|
||||
|
||||
m_refreshtime = Convert.ToInt32(config.GetString("RefreshTime"));
|
||||
if (m_refreshtime <= 0)
|
||||
return;
|
||||
|
||||
m_log.InfoFormat("[SIMIAN MAPTILE] enabled with refresh timeout {0} and URL {1}",
|
||||
m_refreshtime,m_serverUrl);
|
||||
|
||||
m_enabled = true;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_refreshTimer.Enabled = true;
|
||||
m_refreshTimer.AutoReset = true;
|
||||
m_refreshTimer.Interval = 5 * 60 * 1000; // every 5 minutes
|
||||
m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (! m_enabled)
|
||||
return;
|
||||
|
||||
// Every shared region module has to maintain an indepedent list of
|
||||
// currently running regions
|
||||
lock (m_scenes)
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (! m_enabled)
|
||||
return;
|
||||
|
||||
lock (m_scenes)
|
||||
m_scenes.Remove(scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
#endregion ISharedRegionModule
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
private void HandleMaptileRefresh(object sender, EventArgs ea)
|
||||
{
|
||||
// this approach is a bit convoluted becase we want to wait for the
|
||||
// first upload to happen on startup but after all the objects are
|
||||
// loaded and initialized
|
||||
if (m_lastrefresh > 0 && Util.EnvironmentTickCountSubtract(m_lastrefresh) < m_refreshtime)
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("[SIMIAN MAPTILE] map refresh fired");
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (IScene scene in m_scenes.Values)
|
||||
{
|
||||
try
|
||||
{
|
||||
UploadMapTile(scene);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.WarnFormat("[SIMIAN MAPTILE] something bad happened {0}",ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_lastrefresh = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
private void UploadMapTile(IScene scene)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName);
|
||||
|
||||
// Create a PNG map tile and upload it to the AddMapTile API
|
||||
byte[] pngData = Utils.EmptyBytes;
|
||||
IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
|
||||
if (tileGenerator == null)
|
||||
{
|
||||
m_log.Warn("[SIMIAN MAPTILE]: Cannot upload PNG map tile without an ImageGenerator");
|
||||
return;
|
||||
}
|
||||
|
||||
using (Image mapTile = tileGenerator.CreateMapTile())
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
mapTile.Save(stream, ImageFormat.Png);
|
||||
pngData = stream.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
|
||||
{
|
||||
new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
|
||||
new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
|
||||
new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
|
||||
};
|
||||
|
||||
string errorMessage = null;
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
|
||||
// Make the remote storage request
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
|
||||
request.Timeout = 20000;
|
||||
request.ReadWriteTimeout = 5000;
|
||||
|
||||
using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
|
||||
{
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
{
|
||||
string responseStr = responseStream.GetStreamString();
|
||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||
if (responseOSD.Type == OSDType.Map)
|
||||
{
|
||||
OSDMap responseMap = (OSDMap)responseOSD;
|
||||
if (responseMap["Success"].AsBoolean())
|
||||
return;
|
||||
|
||||
errorMessage = "Upload failed: " + responseMap["Message"].AsString();
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "Response format was invalid:\n" + responseStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
errorMessage = we.Message;
|
||||
if (we.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
HttpWebResponse webResponse = (HttpWebResponse)we.Response;
|
||||
errorMessage = String.Format("[{0}] {1}",
|
||||
webResponse.StatusCode,webResponse.StatusDescription);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// This just dumps a warning for any operation that takes more than 100 ms
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff);
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}",
|
||||
pngData.Length, scene.RegionInfo.RegionName, errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,8 +28,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
@ -58,7 +56,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ServerURI = String.Empty;
|
||||
private bool m_Enabled = false;
|
||||
// private bool m_Enabled = false;
|
||||
|
||||
public SimianGridServiceConnector() { }
|
||||
public SimianGridServiceConnector(string serverURI)
|
||||
|
@ -95,20 +93,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
|
||||
serviceUrl = serviceUrl + '/';
|
||||
m_ServerURI = serviceUrl;
|
||||
m_Enabled = true;
|
||||
// m_Enabled = true;
|
||||
}
|
||||
|
||||
#region IGridService
|
||||
|
||||
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
||||
{
|
||||
// Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service
|
||||
// Scene scene;
|
||||
// if (m_scenes.TryGetValue(regionInfo.RegionID, out scene))
|
||||
// UploadMapTile(scene);
|
||||
// else
|
||||
// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
|
||||
|
||||
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
|
||||
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
|
||||
|
||||
|
@ -184,7 +175,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
}
|
||||
}
|
||||
|
||||
m_log.Debug("[SIMIAN GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID);
|
||||
// m_log.Debug("[SIMIAN GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID);
|
||||
return regions;
|
||||
}
|
||||
|
||||
|
@ -305,7 +296,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
{ "Enabled", "1" }
|
||||
};
|
||||
|
||||
m_log.WarnFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString());
|
||||
//m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString());
|
||||
|
||||
|
||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
||||
|
@ -380,83 +371,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
#endregion IGridService
|
||||
|
||||
private void UploadMapTile(IScene scene)
|
||||
{
|
||||
string errorMessage = null;
|
||||
|
||||
// Create a PNG map tile and upload it to the AddMapTile API
|
||||
byte[] pngData = Utils.EmptyBytes;
|
||||
IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
|
||||
if (tileGenerator == null)
|
||||
{
|
||||
m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
|
||||
return;
|
||||
}
|
||||
|
||||
using (Image mapTile = tileGenerator.CreateMapTile())
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
mapTile.Save(stream, ImageFormat.Png);
|
||||
pngData = stream.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
|
||||
{
|
||||
new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
|
||||
new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
|
||||
new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
|
||||
};
|
||||
|
||||
// Make the remote storage request
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
|
||||
|
||||
HttpWebResponse response = MultipartForm.Post(request, postParameters);
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
{
|
||||
string responseStr = null;
|
||||
|
||||
try
|
||||
{
|
||||
responseStr = responseStream.GetStreamString();
|
||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||
if (responseOSD.Type == OSDType.Map)
|
||||
{
|
||||
OSDMap responseMap = (OSDMap)responseOSD;
|
||||
if (responseMap["Success"].AsBoolean())
|
||||
m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
|
||||
else
|
||||
errorMessage = "Upload failed: " + responseMap["Message"].AsString();
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "Response format was invalid:\n" + responseStr;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(responseStr))
|
||||
errorMessage = "Failed to parse the response:\n" + responseStr;
|
||||
else
|
||||
errorMessage = "Failed to retrieve the response: " + ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(errorMessage))
|
||||
{
|
||||
m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
|
||||
pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' '));
|
||||
}
|
||||
}
|
||||
|
||||
private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
|
||||
{
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
|
|
|
@ -757,7 +757,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
}
|
||||
}
|
||||
|
||||
m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invFolders.Count + " folders from SimianGrid response");
|
||||
// m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invFolders.Count + " folders from SimianGrid response");
|
||||
return invFolders;
|
||||
}
|
||||
|
||||
|
@ -824,7 +824,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
}
|
||||
}
|
||||
|
||||
m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invItems.Count + " items from SimianGrid response");
|
||||
// m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invItems.Count + " items from SimianGrid response");
|
||||
return invItems;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
|
||||
// m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public bool LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID);
|
||||
// m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -262,7 +262,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);
|
||||
|
||||
// Remove the session to mark this user offline
|
||||
if (!LogoutAgent(sessionID))
|
||||
|
@ -287,7 +287,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -312,10 +312,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public GridUserInfo GetGridUserInfo(string user)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
|
||||
|
||||
UUID userID = new UUID(user);
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
private OSDMap GetUserData(UUID userID)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
OSDMap userResponse = GetUserData(userID);
|
||||
if (userResponse != null)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID);
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -377,10 +377,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
if (presence != null)
|
||||
presences.Add(presence);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Debug("[SIMIAN PRESENCE CONNECTOR]: No session returned for " + userID + ": " + response["Message"].AsString());
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.Debug("[SIMIAN PRESENCE CONNECTOR]: No session returned for " + userID + ": " + response["Message"].AsString());
|
||||
// }
|
||||
}
|
||||
|
||||
return presences;
|
||||
|
@ -424,7 +424,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
{
|
||||
if (userResponse != null && userResponse["User"] is OSDMap)
|
||||
{
|
||||
|
||||
GridUserInfo info = new GridUserInfo();
|
||||
|
||||
info.Online = true;
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
{
|
||||
List<UserAccount> accounts = new List<UserAccount>();
|
||||
|
||||
m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query);
|
||||
// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public bool StoreUserAccount(UserAccount data)
|
||||
{
|
||||
m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
|
||||
// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
private UserAccount GetUser(NameValueCollection requestArgs)
|
||||
{
|
||||
string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)";
|
||||
m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
|
||||
// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
|
||||
|
||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
||||
if (response["Success"].AsBoolean())
|
||||
|
@ -325,4 +325,4 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,9 +43,9 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
public class EstateDataService : ServiceBase, IEstateDataService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected IEstateDataStore m_database;
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
public class SimulationDataService : ServiceBase, ISimulationDataService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected ISimulationDataStore m_database;
|
||||
|
||||
|
|
|
@ -75,469 +75,192 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
return "agent/";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
|
||||
{
|
||||
HttpWebRequest AgentCreateRequest = null;
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateAgent start");
|
||||
|
||||
reason = String.Empty;
|
||||
|
||||
if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
|
||||
{
|
||||
string response = GetResponse(AgentCreateRequest, out reason);
|
||||
bool success = true;
|
||||
UnpackResponse(response, out success, out reason);
|
||||
return success;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected bool SendRequest(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason, out HttpWebRequest AgentCreateRequest)
|
||||
{
|
||||
reason = String.Empty;
|
||||
AgentCreateRequest = null;
|
||||
|
||||
if (destination == null)
|
||||
{
|
||||
reason = "Destination is null";
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
|
||||
|
||||
AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||
AgentCreateRequest.Method = "POST";
|
||||
AgentCreateRequest.ContentType = "application/json";
|
||||
AgentCreateRequest.Timeout = 10000;
|
||||
//AgentCreateRequest.KeepAlive = false;
|
||||
//AgentCreateRequest.Headers.Add("Authorization", authKey);
|
||||
|
||||
// Fill it in
|
||||
OSDMap args = PackCreateAgentArguments(aCircuit, destination, flags);
|
||||
if (args == null)
|
||||
return false;
|
||||
|
||||
string strBuffer = "";
|
||||
byte[] buffer = new byte[1];
|
||||
try
|
||||
{
|
||||
strBuffer = OSDParser.SerializeJsonString(args);
|
||||
Encoding str = Util.UTF8;
|
||||
buffer = str.GetBytes(strBuffer);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of ChildCreate: {0}", e.Message);
|
||||
// ignore. buffer will be empty, caller should check.
|
||||
}
|
||||
|
||||
Stream os = null;
|
||||
try
|
||||
{ // send the Post
|
||||
AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send
|
||||
os = AgentCreateRequest.GetRequestStream();
|
||||
os.Write(buffer, 0, strBuffer.Length); //Send it
|
||||
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateAgent request to remote sim {0}, region {1}, x={2} y={3}",
|
||||
uri, destination.RegionName, destination.RegionLocX, destination.RegionLocY);
|
||||
}
|
||||
//catch (WebException ex)
|
||||
catch
|
||||
{
|
||||
//m_log.ErrorFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on ChildAgentUpdate {0}", ex.Message);
|
||||
reason = "cannot contact remote region";
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (os != null)
|
||||
os.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected string GetResponse(HttpWebRequest AgentCreateRequest, out string reason)
|
||||
{
|
||||
// Let's wait for the response
|
||||
//m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
|
||||
reason = string.Empty;
|
||||
|
||||
WebResponse webResponse = null;
|
||||
StreamReader sr = null;
|
||||
string response = string.Empty;
|
||||
try
|
||||
{
|
||||
webResponse = AgentCreateRequest.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on DoCreateChildAgentCall post");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
response = sr.ReadToEnd().Trim();
|
||||
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response);
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
|
||||
reason = "Destination did not reply";
|
||||
return string.Empty;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
protected void UnpackResponse(string response, out bool result, out string reason)
|
||||
{
|
||||
result = true;
|
||||
reason = string.Empty;
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
{
|
||||
try
|
||||
{
|
||||
// we assume we got an OSDMap back
|
||||
OSDMap r = Util.GetOSDMap(response);
|
||||
result = r["success"].AsBoolean();
|
||||
reason = r["reason"].AsString();
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
|
||||
|
||||
// check for old style response
|
||||
if (response.ToLower().StartsWith("true"))
|
||||
result = true;
|
||||
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion destination, uint flags)
|
||||
{
|
||||
OSDMap args = null;
|
||||
try
|
||||
{
|
||||
args = aCircuit.PackAgentCircuitData();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Add the input arguments
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
args["teleport_flags"] = OSD.FromString(flags.ToString());
|
||||
try
|
||||
{
|
||||
OSDMap args = aCircuit.PackAgentCircuitData();
|
||||
|
||||
return args;
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
args["teleport_flags"] = OSD.FromString(flags.ToString());
|
||||
|
||||
OSDMap result = WebUtil.PostToService(uri,args);
|
||||
if (result["Success"].AsBoolean())
|
||||
return true;
|
||||
|
||||
reason = result["Message"] != null ? result["Message"].AsString() : "error";
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e.ToString());
|
||||
reason = e.Message;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send complete data about an agent in this region to a neighbor
|
||||
/// </summary>
|
||||
public bool UpdateAgent(GridRegion destination, AgentData data)
|
||||
{
|
||||
return UpdateAgent(destination, (IAgentData)data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send updated position information about an agent in this region to a neighbor
|
||||
/// This operation may be called very frequently if an avatar is moving about in
|
||||
/// the region.
|
||||
/// </summary>
|
||||
public bool UpdateAgent(GridRegion destination, AgentPosition data)
|
||||
{
|
||||
return false; //UpdateAgent(destination, (IAgentData)data);
|
||||
// we need a better throttle for these
|
||||
return false;
|
||||
// return UpdateAgent(destination, (IAgentData)data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the worker function to send AgentData to a neighbor region
|
||||
/// </summary>
|
||||
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
|
||||
{
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent start");
|
||||
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/";
|
||||
|
||||
HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||
ChildUpdateRequest.Method = "PUT";
|
||||
ChildUpdateRequest.ContentType = "application/json";
|
||||
ChildUpdateRequest.Timeout = 30000;
|
||||
//ChildUpdateRequest.KeepAlive = false;
|
||||
|
||||
// Fill it in
|
||||
OSDMap args = null;
|
||||
try
|
||||
{
|
||||
args = cAgentData.Pack();
|
||||
OSDMap args = cAgentData.Pack();
|
||||
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
|
||||
OSDMap result = WebUtil.PutToService(uri,args);
|
||||
return result["Success"].AsBoolean();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: PackUpdateMessage failed with exception: " + e.Message);
|
||||
}
|
||||
// Add the input arguments
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
|
||||
string strBuffer = "";
|
||||
byte[] buffer = new byte[1];
|
||||
try
|
||||
{
|
||||
strBuffer = OSDParser.SerializeJsonString(args);
|
||||
Encoding str = Util.UTF8;
|
||||
buffer = str.GetBytes(strBuffer);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of ChildUpdate: {0}", e.Message);
|
||||
// ignore. buffer will be empty, caller should check.
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString());
|
||||
}
|
||||
|
||||
Stream os = null;
|
||||
try
|
||||
{ // send the Post
|
||||
ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
|
||||
os = ChildUpdateRequest.GetRequestStream();
|
||||
os.Write(buffer, 0, strBuffer.Length); //Send it
|
||||
//m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Posted AgentUpdate request to remote sim {0}", uri);
|
||||
}
|
||||
catch (WebException ex)
|
||||
//catch
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on AgentUpdate {0}", ex.Message);
|
||||
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (os != null)
|
||||
os.Close();
|
||||
}
|
||||
|
||||
// Let's wait for the response
|
||||
//m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after ChildAgentUpdate");
|
||||
|
||||
WebResponse webResponse = null;
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
webResponse = ChildUpdateRequest.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on ChilAgentUpdate post");
|
||||
}
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
//reply = sr.ReadToEnd().Trim();
|
||||
sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
//m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
|
||||
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ChilAgentUpdate from {0}: {1}", uri, ex.Message);
|
||||
// ignore, really
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not sure what sequence causes this function to be invoked. The only calling
|
||||
/// path is through the GET method
|
||||
/// </summary>
|
||||
public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
|
||||
{
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: RetrieveAgent start");
|
||||
|
||||
agent = null;
|
||||
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
||||
request.Method = "GET";
|
||||
request.Timeout = 10000;
|
||||
//request.Headers.Add("authorization", ""); // coming soon
|
||||
|
||||
HttpWebResponse webResponse = null;
|
||||
string reply = string.Empty;
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
webResponse = (HttpWebResponse)request.GetResponse();
|
||||
if (webResponse == null)
|
||||
OSDMap result = WebUtil.GetFromService(uri);
|
||||
if (result["Success"].AsBoolean())
|
||||
{
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent get ");
|
||||
// OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString());
|
||||
OSDMap args = (OSDMap)result["_Result"];
|
||||
if (args != null)
|
||||
{
|
||||
agent = new CompleteAgentData();
|
||||
agent.Unpack(args);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
reply = sr.ReadToEnd().Trim();
|
||||
|
||||
|
||||
}
|
||||
catch (WebException ex)
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent get {0}", ex.Message);
|
||||
// ignore, really
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
if (webResponse.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// we know it's jason
|
||||
OSDMap args = Util.GetOSDMap(reply);
|
||||
if (args == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
agent = new CompleteAgentData();
|
||||
agent.Unpack(args);
|
||||
return true;
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public bool QueryAccess(GridRegion destination, UUID id)
|
||||
{
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start");
|
||||
|
||||
IPEndPoint ext = destination.ExternalEndPoint;
|
||||
if (ext == null) return false;
|
||||
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
||||
request.Method = "QUERYACCESS";
|
||||
request.Timeout = 10000;
|
||||
//request.Headers.Add("authorization", ""); // coming soon
|
||||
|
||||
HttpWebResponse webResponse = null;
|
||||
string reply = string.Empty;
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
webResponse = (HttpWebResponse)request.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query ");
|
||||
}
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
reply = sr.ReadToEnd().Trim();
|
||||
|
||||
|
||||
OSDMap result = WebUtil.ServiceOSDRequest(uri,null,"QUERYACCESS",10000);
|
||||
return result["Success"].AsBoolean();
|
||||
}
|
||||
catch (WebException ex)
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message);
|
||||
// ignore, really
|
||||
return false;
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcess failed with exception; {0}",e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
if (webResponse.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool result;
|
||||
|
||||
result = bool.Parse(reply);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
||||
{
|
||||
WebRequest request = WebRequest.Create(uri);
|
||||
request.Method = "DELETE";
|
||||
request.Timeout = 10000;
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: ReleaseAgent start");
|
||||
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
WebResponse webResponse = request.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on ReleaseAgent");
|
||||
}
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
//reply = sr.ReadToEnd().Trim();
|
||||
sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
|
||||
|
||||
WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000);
|
||||
}
|
||||
catch (WebException ex)
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ReleaseAgent {0}", ex.Message);
|
||||
return false;
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] ReleaseAgent failed with exception; {0}",e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public bool CloseAgent(GridRegion destination, UUID id)
|
||||
{
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
|
||||
|
||||
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||
|
||||
WebRequest request = WebRequest.Create(uri);
|
||||
request.Method = "DELETE";
|
||||
request.Timeout = 10000;
|
||||
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
WebResponse webResponse = request.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent delete ");
|
||||
}
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
//reply = sr.ReadToEnd().Trim();
|
||||
sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
|
||||
|
||||
WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000);
|
||||
}
|
||||
catch (WebException ex)
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete from {0}: {1}", destination.RegionName, ex.Message);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -552,97 +275,46 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
return "object/";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
|
||||
{
|
||||
string uri
|
||||
= destination.ServerURI + ObjectPath() + sog.UUID + "/";
|
||||
//m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start");
|
||||
|
||||
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
|
||||
ObjectCreateRequest.Method = "POST";
|
||||
ObjectCreateRequest.ContentType = "application/json";
|
||||
ObjectCreateRequest.Timeout = 10000;
|
||||
string uri = destination.ServerURI + ObjectPath() + sog.UUID + "/";
|
||||
|
||||
OSDMap args = new OSDMap(2);
|
||||
args["sog"] = OSD.FromString(sog.ToXml2());
|
||||
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
|
||||
args["modified"] = OSD.FromBoolean(sog.HasGroupChanged);
|
||||
string state = sog.GetStateSnapshot();
|
||||
if (state.Length > 0)
|
||||
args["state"] = OSD.FromString(state);
|
||||
// Add the input general arguments
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
|
||||
string strBuffer = "";
|
||||
byte[] buffer = new byte[1];
|
||||
try
|
||||
{
|
||||
strBuffer = OSDParser.SerializeJsonString(args);
|
||||
Encoding str = Util.UTF8;
|
||||
buffer = str.GetBytes(strBuffer);
|
||||
OSDMap args = new OSDMap(2);
|
||||
|
||||
args["sog"] = OSD.FromString(sog.ToXml2());
|
||||
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
|
||||
args["modified"] = OSD.FromBoolean(sog.HasGroupChanged);
|
||||
|
||||
string state = sog.GetStateSnapshot();
|
||||
if (state.Length > 0)
|
||||
args["state"] = OSD.FromString(state);
|
||||
|
||||
// Add the input general arguments
|
||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
|
||||
WebUtil.PostToService(uri, args);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of CreateObject: {0}", e.Message);
|
||||
// ignore. buffer will be empty, caller should check.
|
||||
}
|
||||
|
||||
Stream os = null;
|
||||
try
|
||||
{ // send the Post
|
||||
ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
|
||||
os = ObjectCreateRequest.GetRequestStream();
|
||||
os.Write(buffer, 0, strBuffer.Length); //Send it
|
||||
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (os != null)
|
||||
os.Close();
|
||||
}
|
||||
|
||||
// Let's wait for the response
|
||||
//m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
|
||||
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
WebResponse webResponse = ObjectCreateRequest.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post");
|
||||
return false;
|
||||
}
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
//reply = sr.ReadToEnd().Trim();
|
||||
sr.ReadToEnd().Trim();
|
||||
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", reply);
|
||||
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Close();
|
||||
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool CreateObject(GridRegion destination, UUID userID, UUID itemID)
|
||||
{
|
||||
// TODO, not that urgent
|
||||
|
|
|
@ -162,6 +162,7 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
#region Link Region
|
||||
|
||||
// from map search
|
||||
public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
|
||||
{
|
||||
string reason = string.Empty;
|
||||
|
@ -171,7 +172,7 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
private static Random random = new Random();
|
||||
|
||||
// From the command line link-region
|
||||
// From the command line link-region (obsolete) and the map
|
||||
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
|
||||
{
|
||||
return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
|
||||
|
@ -180,45 +181,48 @@ namespace OpenSim.Services.GridService
|
|||
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
string host = "127.0.0.1";
|
||||
string portstr;
|
||||
string regionName = "";
|
||||
uint port = 0;
|
||||
string[] parts = mapName.Split(new char[] { ':' });
|
||||
if (parts.Length >= 1)
|
||||
GridRegion regInfo = null;
|
||||
|
||||
if (!mapName.StartsWith("http"))
|
||||
{
|
||||
host = parts[0];
|
||||
string host = "127.0.0.1";
|
||||
string portstr;
|
||||
string regionName = "";
|
||||
uint port = 0;
|
||||
string[] parts = mapName.Split(new char[] { ':' });
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
host = parts[0];
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
portstr = parts[1];
|
||||
//m_log.Debug("-- port = " + portstr);
|
||||
if (!UInt32.TryParse(portstr, out port))
|
||||
regionName = parts[1];
|
||||
}
|
||||
// always take the last one
|
||||
if (parts.Length >= 3)
|
||||
{
|
||||
regionName = parts[2];
|
||||
}
|
||||
|
||||
|
||||
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
|
||||
if (success)
|
||||
{
|
||||
regInfo.RegionName = mapName;
|
||||
return regInfo;
|
||||
}
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
else
|
||||
{
|
||||
portstr = parts[1];
|
||||
//m_log.Debug("-- port = " + portstr);
|
||||
if (!UInt32.TryParse(portstr, out port))
|
||||
string[] parts = mapName.Split(new char[] {' '});
|
||||
string regionName = String.Empty;
|
||||
if (parts.Length > 1)
|
||||
regionName = parts[1];
|
||||
}
|
||||
// always take the last one
|
||||
if (parts.Length >= 3)
|
||||
{
|
||||
regionName = parts[2];
|
||||
}
|
||||
|
||||
//// Sanity check.
|
||||
//try
|
||||
//{
|
||||
// Util.GetHostFromDNS(host);
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// reason = "Malformed hostname";
|
||||
// return null;
|
||||
//}
|
||||
|
||||
GridRegion regInfo;
|
||||
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
|
||||
if (success)
|
||||
{
|
||||
regInfo.RegionName = mapName;
|
||||
return regInfo;
|
||||
if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
|
||||
return regInfo;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -231,7 +235,7 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
|
||||
{
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}",
|
||||
((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
|
||||
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
|
||||
|
||||
|
@ -324,7 +328,7 @@ namespace OpenSim.Services.GridService
|
|||
regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
|
||||
|
||||
AddHyperlinkRegion(regInfo, handle);
|
||||
m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
|
||||
m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ namespace OpenSim.Services.HypergridService
|
|||
return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
|
||||
else
|
||||
{
|
||||
Object[] args = new Object[] { userURL };
|
||||
// Object[] args = new Object[] { userURL };
|
||||
IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
|
||||
if (userAgentService != null)
|
||||
{
|
||||
|
|
|
@ -13,9 +13,10 @@ namespace OpenSim.Services.HypergridService
|
|||
{
|
||||
private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours!
|
||||
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private ExpiringCache<UUID, UserAccount> m_UUIDCache;
|
||||
|
||||
private IUserAccountService m_UserAccountService;
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace OpenSim.Services.HypergridService
|
|||
string myExternalIP = string.Empty;
|
||||
string gridName = gatekeeper.ServerURI;
|
||||
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: m_grid - {0}, gn - {1}", m_GridName, gridName);
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);
|
||||
|
||||
if (m_GridName == gridName)
|
||||
success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
|
||||
|
@ -266,11 +266,13 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
if (m_TravelingAgents.ContainsKey(sessionID))
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}",
|
||||
m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress);
|
||||
|
||||
return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
|
||||
bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
|
||||
m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
|
||||
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}",
|
||||
reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -33,6 +33,6 @@ namespace OpenSim.Services.Interfaces
|
|||
{
|
||||
public interface ILandService
|
||||
{
|
||||
LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess);
|
||||
LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
protected virtual ArrayList GetInventoryLibrary(ILibraryService library)
|
||||
{
|
||||
Dictionary<UUID, InventoryFolderImpl> rootFolders = library.GetAllFolders();
|
||||
m_log.DebugFormat("[LLOGIN]: Library has {0} folders", rootFolders.Count);
|
||||
// m_log.DebugFormat("[LLOGIN]: Library has {0} folders", rootFolders.Count);
|
||||
//Dictionary<UUID, InventoryFolderImpl> rootFolders = new Dictionary<UUID,InventoryFolderImpl>();
|
||||
ArrayList folderHashes = new ArrayList();
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
// Get active gestures
|
||||
List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(account.PrincipalID);
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count);
|
||||
// m_log.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count);
|
||||
|
||||
//
|
||||
// Login the presence
|
||||
|
|
Binary file not shown.
|
@ -1240,6 +1240,14 @@
|
|||
; Enable media on a prim facilities
|
||||
Enabled = true;
|
||||
|
||||
;;
|
||||
;; If you are using a simian grid frontend you can enable
|
||||
;; this module to upload tile images for the mapping fn
|
||||
;;
|
||||
[SimianGridMaptiles]
|
||||
Enabled = False
|
||||
MaptileURL = "http://www.mygrid.com/Grid/"
|
||||
RefreshTime = 3600
|
||||
|
||||
;;
|
||||
;; These are defaults that are overwritten below in [Architecture].
|
||||
|
|
152
prebuild.xml
152
prebuild.xml
|
@ -158,7 +158,6 @@
|
|||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="BclExtras35" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../bin/"/>
|
||||
|
@ -1475,60 +1474,6 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="PumaCode.SvnDotNet" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Region.CoreModules"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Server.Handlers"/>
|
||||
<Reference name="OpenSim.Services.Connectors"/>
|
||||
<Reference name="OpenSim.Services.Base"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||
|
||||
<!-- For scripting in funny languages by default -->
|
||||
<Reference name="XMLRPC" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="DotNetOpenMail" path="../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Region.RegionCombinerModule" path="OpenSim/Region/RegionCombinerModule" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -1592,7 +1537,6 @@
|
|||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Region.CoreModules"/>
|
||||
<Reference name="XMLRPC" path="../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
|
@ -1632,7 +1576,6 @@
|
|||
<Reference name="OpenSim.Region.ClientStack"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="BclExtras35" path="../../../../bin/"/>
|
||||
<Reference name="XMLRPC" path="../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../../bin/"/>
|
||||
|
@ -1644,6 +1587,61 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="PumaCode.SvnDotNet" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
|
||||
<Reference name="OpenSim.Region.CoreModules"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Server.Handlers"/>
|
||||
<Reference name="OpenSim.Services.Connectors"/>
|
||||
<Reference name="OpenSim.Services.Base"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||
|
||||
<!-- For scripting in funny languages by default -->
|
||||
<Reference name="XMLRPC" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="DotNetOpenMail" path="../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<!-- Datastore Plugins -->
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Data.Null" path="OpenSim/Data/Null" type="Library">
|
||||
<Configuration name="Debug">
|
||||
|
@ -2028,7 +2026,6 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Client.VWoHTTP" path="OpenSim/Client/VWoHTTP" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -2060,45 +2057,6 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Client.Linden" path="OpenSim/Client/Linden" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="System"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Region.ClientStack"/>
|
||||
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="XMLRPC" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
|
||||
<!-- Data Base Modules -->
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library">
|
||||
<Configuration name="Debug">
|
||||
|
|
Loading…
Reference in New Issue