mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
This commit is contained in:
@@ -74,7 +74,7 @@ namespace OpenSim
|
||||
AppDomain.CurrentDomain.UnhandledException +=
|
||||
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
|
||||
ServicePointManager.DefaultConnectionLimit = 6;
|
||||
ServicePointManager.DefaultConnectionLimit = 12;
|
||||
|
||||
// Add the arguments supplied when running the application to the configuration
|
||||
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Timers;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -466,6 +467,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
if (llsdRequest.asset_type == "mesh")
|
||||
{
|
||||
cost += 20; // Constant for now to test showing a price
|
||||
|
||||
if (llsdRequest.asset_resources == null)
|
||||
{
|
||||
client.SendAgentAlertMessage("Unable to upload asset. missing information.", false);
|
||||
@@ -479,7 +482,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count;
|
||||
textures_cost *= (uint)mm.UploadCharge;
|
||||
|
||||
cost = textures_cost;
|
||||
cost += textures_cost;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1092,6 +1095,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public class AssetUploader
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event UpLoadedAsset OnUpLoad;
|
||||
private UpLoadedAsset handlerUpLoad = null;
|
||||
|
||||
@@ -1106,6 +1112,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private string m_invType = String.Empty;
|
||||
private string m_assetType = String.Empty;
|
||||
private Timer m_timeoutTimer = new Timer();
|
||||
|
||||
public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
|
||||
UUID parentFolderID, string invType, string assetType, string path,
|
||||
@@ -1121,6 +1128,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_assetType = assetType;
|
||||
m_invType = invType;
|
||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||
|
||||
m_timeoutTimer.Elapsed += TimedOut;
|
||||
m_timeoutTimer.Interval = 120000;
|
||||
m_timeoutTimer.AutoReset = false;
|
||||
m_timeoutTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1142,6 +1154,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
m_timeoutTimer.Stop();
|
||||
|
||||
// TODO: probably make this a better set of extensions here
|
||||
string extension = ".jp2";
|
||||
@@ -1163,6 +1176,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return res;
|
||||
}
|
||||
|
||||
private void TimedOut(object sender, ElapsedEventArgs args)
|
||||
{
|
||||
m_log.InfoFormat("[CAPS]: Removing URL and handler for timed out mesh upload");
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
}
|
||||
|
||||
///Left this in and commented in case there are unforseen issues
|
||||
//private void SaveAssetToFile(string filename, byte[] data)
|
||||
//{
|
||||
|
||||
@@ -27,18 +27,13 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
@@ -47,64 +42,73 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
/// <summary>
|
||||
/// This module implements both WebFetchTextureDescendents and FetchTextureDescendents2 capabilities.
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")]
|
||||
public class GetTextureModule : 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_Enabled = false;
|
||||
private static GetTextureHandler m_getTextureHandler;
|
||||
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
private IAssetService m_assetService = null;
|
||||
|
||||
private string m_URL;
|
||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||
private static Thread[] m_workerThreads = null;
|
||||
|
||||
private static OpenMetaverse.BlockingQueue<PollServiceTextureEventArgs> m_queue =
|
||||
new OpenMetaverse.BlockingQueue<PollServiceTextureEventArgs>();
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_URL = config.GetString("Cap_GetTexture", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = s;
|
||||
m_assetService = s.AssetService;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
// We'll reuse the same handler for all requests.
|
||||
m_getTextureHandler = new GetTextureHandler(m_assetService);
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||
|
||||
if (m_workerThreads == null)
|
||||
{
|
||||
m_workerThreads = new Thread[4];
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests,
|
||||
String.Format("TextureWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -122,24 +126,155 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#endregion
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
~GetTextureModule()
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
foreach (Thread t in m_workerThreads)
|
||||
t.Abort();
|
||||
}
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
private class PollServiceTextureEventArgs : PollServiceEventArgs
|
||||
{
|
||||
private List<Hashtable> requests =
|
||||
new List<Hashtable>();
|
||||
private Dictionary<UUID, Hashtable> responses =
|
||||
new Dictionary<UUID, Hashtable>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
public PollServiceTextureEventArgs(UUID pId, Scene scene) :
|
||||
base(null, null, null, null, pId, 30000)
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler(
|
||||
"GetTexture",
|
||||
new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString()));
|
||||
m_scene = scene;
|
||||
|
||||
HasEvents = (x, y) => { return this.responses.ContainsKey(x); };
|
||||
GetEvents = (x, y, s) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.responses[x];
|
||||
}
|
||||
finally
|
||||
{
|
||||
responses.Remove(x);
|
||||
}
|
||||
};
|
||||
|
||||
Request = (x, y) =>
|
||||
{
|
||||
y["RequestID"] = x.ToString();
|
||||
lock (this.requests)
|
||||
this.requests.Add(y);
|
||||
|
||||
m_queue.Enqueue(this);
|
||||
};
|
||||
|
||||
NoEvents = (x, y) =>
|
||||
{
|
||||
lock (this.requests)
|
||||
{
|
||||
Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString());
|
||||
requests.Remove(request);
|
||||
}
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
|
||||
response["int_response_code"] = 500;
|
||||
response["str_response_string"] = "Script timeout";
|
||||
response["content_type"] = "text/plain";
|
||||
response["keepalive"] = false;
|
||||
response["reusecontext"] = false;
|
||||
|
||||
return response;
|
||||
};
|
||||
}
|
||||
else
|
||||
|
||||
public void Process()
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", m_URL);
|
||||
Hashtable response;
|
||||
Hashtable request = null;
|
||||
|
||||
try
|
||||
{
|
||||
lock (this.requests)
|
||||
{
|
||||
request = requests[0];
|
||||
requests.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UUID requestID = new UUID(request["RequestID"].ToString());
|
||||
|
||||
// If the avatar is gone, don't bother to get the texture
|
||||
if (m_scene.GetScenePresence(Id) == null)
|
||||
{
|
||||
response = new Hashtable();
|
||||
|
||||
response["int_response_code"] = 500;
|
||||
response["str_response_string"] = "Script timeout";
|
||||
response["content_type"] = "text/plain";
|
||||
response["keepalive"] = false;
|
||||
response["reusecontext"] = false;
|
||||
|
||||
responses[requestID] = response;
|
||||
return;
|
||||
}
|
||||
|
||||
response = m_getTextureHandler.Handle(request);
|
||||
|
||||
responses[requestID] = response;
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl = "/CAPS/" + UUID.Random() + "/";
|
||||
|
||||
// Register this as a poll service
|
||||
// absurd large timeout to tune later to make a bit less than viewer
|
||||
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
|
||||
|
||||
args.Type = PollServiceEventArgs.EventType.Texture;
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
|
||||
|
||||
string hostName = m_scene.RegionInfo.ExternalHostName;
|
||||
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
||||
string protocol = "http";
|
||||
|
||||
if (MainServer.Instance.UseSSL)
|
||||
{
|
||||
hostName = MainServer.Instance.SSLCommonName;
|
||||
port = MainServer.Instance.SSLPort;
|
||||
protocol = "https";
|
||||
}
|
||||
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||
|
||||
m_capsDict[agentID] = capUrl;
|
||||
}
|
||||
|
||||
private void DeregisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl;
|
||||
|
||||
if (m_capsDict.TryGetValue(agentID, out capUrl))
|
||||
{
|
||||
MainServer.Instance.RemoveHTTPHandler("", capUrl);
|
||||
m_capsDict.Remove(agentID);
|
||||
}
|
||||
}
|
||||
|
||||
private void DoTextureRequests()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
PollServiceTextureEventArgs args = m_queue.Dequeue();
|
||||
|
||||
args.Process();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -256,7 +256,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
if (sp.IsChildAgent)
|
||||
return;
|
||||
sp.ControllingClient.Kick(reason);
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
sp.MakeChildAgent();
|
||||
sp.ControllingClient.Close();
|
||||
}
|
||||
|
||||
private void OnIncomingInstantMessage(GridInstantMessage msg)
|
||||
|
||||
@@ -648,7 +648,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
//
|
||||
// This sleep can be increased if necessary. However, whilst it's active,
|
||||
// an agent cannot teleport back to this region if it has teleported away.
|
||||
Thread.Sleep(2000);
|
||||
Thread.Sleep(3000);
|
||||
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
id, m_mod.Scene.RegionInfo.RegionName, currentState));
|
||||
}
|
||||
|
||||
int count = 200;
|
||||
int count = 400;
|
||||
|
||||
// There should be no race condition here since no other code should be removing the agent transfer or
|
||||
// changing the state to another other than Transferring => ReceivedAtDestination.
|
||||
@@ -266,4 +266,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4274,7 +4274,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name='agentID'></param>
|
||||
protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
|
||||
{
|
||||
int ntimes = 20;
|
||||
int ntimes = 30;
|
||||
ScenePresence sp = null;
|
||||
while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0))
|
||||
Thread.Sleep(1000);
|
||||
@@ -4326,7 +4326,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
|
||||
if (presence != null)
|
||||
{
|
||||
presence.ControllingClient.Close();
|
||||
presence.ControllingClient.Close(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -902,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
axis.X = (axis.X > 0) ? 1f : 0f;
|
||||
axis.Y = (axis.Y > 0) ? 1f : 0f;
|
||||
axis.Z = (axis.Z > 0) ? 1f : 0f;
|
||||
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
||||
// m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
||||
AddChange(changes.AngLock, axis);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user