Merge branch 'avination-current' of ssh://3dhosting.de/var/git/careminster into avination-current

Conflicts:
	bin/Regions/Regions.ini.example
This commit is contained in:
Melanie
2013-04-28 19:03:39 +02:00
567 changed files with 48052 additions and 23936 deletions

View File

@@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using log4net;
@@ -38,39 +39,53 @@ namespace OpenSim.Region.ClientStack
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Type plugin;
private Assembly pluginAssembly;
private List<Type> plugin = new List<Type>();
private List<Assembly> pluginAssembly = new List<Assembly>();
public ClientStackManager(string dllName)
public ClientStackManager(string pDllName)
{
m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
try
List<string> clientstacks = new List<string>();
if (pDllName.Contains(","))
{
plugin = null;
pluginAssembly = Assembly.LoadFrom(dllName);
clientstacks = new List<string>(pDllName.Split(','));
}
else
{
clientstacks.Add(pDllName);
}
foreach (string dllName in clientstacks)
{
m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
foreach (Type pluginType in pluginAssembly.GetTypes())
try
{
if (pluginType.IsPublic)
{
Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true);
//plugin = null;
Assembly itemAssembly = Assembly.LoadFrom(dllName);
pluginAssembly.Add(itemAssembly);
if (typeInterface != null)
foreach (Type pluginType in itemAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface");
plugin = pluginType;
return;
Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true);
if (typeInterface != null)
{
m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface");
plugin.Add(pluginType);
break;
}
}
}
}
} catch (ReflectionTypeLoadException e)
{
foreach (Exception e2 in e.LoaderExceptions)
catch (ReflectionTypeLoadException e)
{
m_log.Error(e2.ToString());
foreach (Exception e2 in e.LoaderExceptions)
{
m_log.Error(e2.ToString());
}
throw e;
}
throw e;
}
}
@@ -84,11 +99,11 @@ namespace OpenSim.Region.ClientStack
/// <param name="assetCache"></param>
/// <param name="authenticateClass"></param>
/// <returns></returns>
public IClientNetworkServer CreateServer(
public List<IClientNetworkServer> CreateServers(
IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port,
AgentCircuitManager authenticateClass)
{
return CreateServer(
return CreateServers(
_listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass);
}
@@ -105,20 +120,24 @@ namespace OpenSim.Region.ClientStack
/// <param name="assetCache"></param>
/// <param name="authenticateClass"></param>
/// <returns></returns>
public IClientNetworkServer CreateServer(
public List<IClientNetworkServer> CreateServers(
IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource,
AgentCircuitManager authenticateClass)
{
List<IClientNetworkServer> servers = new List<IClientNetworkServer>();
if (plugin != null)
{
IClientNetworkServer server =
(IClientNetworkServer)Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString()));
server.Initialise(
_listenIP, ref port, proxyPortOffset, allow_alternate_port,
configSource, authenticateClass);
return server;
for (int i = 0; i < plugin.Count; i++)
{
IClientNetworkServer server =
(IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString()));
server.Initialise(
_listenIP, ref port, proxyPortOffset, allow_alternate_port,
configSource, authenticateClass);
servers.Add(server);
}
return servers;
}
m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server");

View File

@@ -50,6 +50,7 @@ using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.ClientStack.Linden
{
@@ -105,7 +106,6 @@ namespace OpenSim.Region.ClientStack.Linden
private static readonly string m_ResourceCostSelectedPath = "0103/";
private static readonly string m_UpdateAgentInformationPath = "0500/";
// These are callbacks which will be setup by the scene so that we can update scene data when we
// receive capability calls
public NewInventoryItem AddNewInventoryItem = null;
@@ -343,6 +343,9 @@ namespace OpenSim.Region.ClientStack.Linden
m_log.DebugFormat(
"[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
if (!m_HostCapsObj.WaitForActivation())
return string.Empty;
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
{
m_log.WarnFormat(
@@ -828,9 +831,9 @@ namespace OpenSim.Region.ClientStack.Linden
texitem.Folder = texturesFolder;
texitem.CurrentPermissions
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
texitem.BasePermissions = (uint)PermissionMask.All;
texitem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
texitem.EveryOnePermissions = 0;
texitem.NextPermissions = (uint)PermissionMask.All;
texitem.CreationDate = Util.UnixTimeSinceEpoch();
@@ -1095,9 +1098,9 @@ namespace OpenSim.Region.ClientStack.Linden
else
{
item.CurrentPermissions
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
item.BasePermissions = (uint)PermissionMask.All;
item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
item.EveryOnePermissions = 0;
item.NextPermissions = (uint)PermissionMask.All;
}
@@ -1317,7 +1320,7 @@ namespace OpenSim.Region.ClientStack.Linden
object_data["PhysicsShapeType"] = obj.PhysicsShapeType;
object_data["Density"] = obj.Density;
object_data["Friction"] = obj.Friction;
object_data["Restitution"] = obj.Bounciness;
object_data["Restitution"] = obj.Restitution;
object_data["GravityMultiplier"] = obj.GravityModifier;
resp[uuid.ToString()] = object_data;
@@ -1446,7 +1449,7 @@ namespace OpenSim.Region.ClientStack.Linden
string param, IOSHttpRequest httpRequest,
IOSHttpResponse httpResponse)
{
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
OSDMap resp = new OSDMap();
OSDMap accessPrefs = new OSDMap();

View File

@@ -97,6 +97,14 @@ namespace OpenSim.Region.ClientStack.Linden
+ " >= 1 - turns on outgoing event logging\n"
+ " >= 2 - turns on poll notification",
HandleDebugEq);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"show eq",
"show eq",
"Show contents of event queues for logged in avatars. Used for debugging.",
HandleShowEq);
}
public void RemoveRegion(Scene scene)
@@ -138,7 +146,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel)))
{
MainConsole.Instance.OutputFormat("Usage: debug eq [0|1]");
MainConsole.Instance.OutputFormat("Usage: debug eq [0|1|2]");
}
else
{
@@ -148,6 +156,21 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
protected void HandleShowEq(string module, string[] args)
{
MainConsole.Instance.OutputFormat("For scene {0}", m_scene.Name);
lock (queues)
{
foreach (KeyValuePair<UUID, Queue<OSD>> kvp in queues)
{
MainConsole.Instance.OutputFormat(
"For agent {0} there are {1} messages queued for send.",
kvp.Key, kvp.Value.Count);
}
}
}
/// <summary>
/// Always returns a valid queue
/// </summary>
@@ -467,8 +490,8 @@ namespace OpenSim.Region.ClientStack.Linden
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["reusecontext"] = false;
responsedata["str_response_string"] = "Upstream error: ";
responsedata["error_status_text"] = "Upstream error:";
responsedata["str_response_string"] = "<llsd></llsd>";
responsedata["error_status_text"] = "<llsd></llsd>";
responsedata["http_protocol_version"] = "HTTP/1.0";
return responsedata;
}

View File

@@ -44,13 +44,15 @@ using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.ClientStack.Linden.Tests
{
[TestFixture]
public class EventQueueTests
public class EventQueueTests : OpenSimTestCase
{
private TestScene m_scene;
[SetUp]
public void SetUp()
public override void SetUp()
{
base.SetUp();
uint port = 9999;
uint sslPort = 9998;

View File

@@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden
public PollServiceTextureEventArgs thepoll;
public UUID reqID;
public Hashtable request;
public bool send503;
}
public class aPollResponse
@@ -244,7 +245,19 @@ namespace OpenSim.Region.ClientStack.Linden
reqinfo.thepoll = this;
reqinfo.reqID = x;
reqinfo.request = y;
reqinfo.send503 = false;
lock (responses)
{
if (responses.Count > 0)
{
if (m_queue.Count >= 4)
{
// Never allow more than 4 fetches to wait
reqinfo.send503 = true;
}
}
}
m_queue.Enqueue(reqinfo);
};
@@ -276,6 +289,22 @@ namespace OpenSim.Region.ClientStack.Linden
UUID requestID = requestinfo.reqID;
if (requestinfo.send503)
{
response = new Hashtable();
response["int_response_code"] = 503;
response["str_response_string"] = "Throttled";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
lock (responses)
responses[requestID] = new aPollResponse() {bytes = 0, response = response};
return;
}
// If the avatar is gone, don't bother to get the texture
if (m_scene.GetScenePresence(Id) == null)
{
@@ -385,6 +414,9 @@ namespace OpenSim.Region.ClientStack.Linden
GetTextureModule.aPollResponse response;
if (responses.TryGetValue(key, out response))
{
// This is any error response
if (response.bytes == 0)
return true;
// Normal
if (BytesSent + response.bytes <= ThrottleBytes)
@@ -411,12 +443,12 @@ namespace OpenSim.Region.ClientStack.Linden
return haskey;
}
public void ProcessTime()
{
PassTime();
}
private void PassTime()
{
currenttime = Util.EnvironmentTickCount();

View File

@@ -57,7 +57,6 @@ namespace OpenSim.Region.ClientStack.Linden
public bool Enabled { get; private set; }
private Scene m_scene;
private UUID m_agentID;
#region ISharedRegionModule Members
@@ -118,13 +117,14 @@ namespace OpenSim.Region.ClientStack.Linden
public void RegisterCaps(UUID agentID, Caps caps)
{
IRequestHandler reqHandler
= new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag, "MeshUploadFlag", agentID.ToString());
= new RestHTTPHandler(
"GET", "/CAPS/" + UUID.Random(), ht => MeshUploadFlag(ht, agentID), "MeshUploadFlag", agentID.ToString());
caps.RegisterHandler("MeshUploadFlag", reqHandler);
m_agentID = agentID;
}
private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
private Hashtable MeshUploadFlag(Hashtable mDhttpMethod, UUID agentID)
{
// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
@@ -148,4 +148,4 @@ namespace OpenSim.Region.ClientStack.Linden
return responsedata;
}
}
}
}

View File

@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.7.5.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.7.6.*")]

View File

@@ -56,8 +56,8 @@ namespace OpenSim.Region.ClientStack.Linden
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionConsoleModule")]
public class RegionConsoleModule : INonSharedRegionModule, IRegionConsole
{
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 IEventQueue m_eventQueue;
@@ -164,8 +164,8 @@ namespace OpenSim.Region.ClientStack.Linden
public class ConsoleHandler : BaseStreamHandler
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log =
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private RegionConsoleModule m_consoleModule;
private UUID m_agentID;

View File

@@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.Linden
// private static readonly ILog m_log =
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest;
private Scene m_scene;
/// <summary>
@@ -68,6 +70,7 @@ namespace OpenSim.Region.ClientStack.Linden
private string m_MapImageServerURL = string.Empty;
private string m_SearchURL = string.Empty;
private bool m_ExportSupported = false;
#region ISharedRegionModule Members
@@ -85,6 +88,8 @@ namespace OpenSim.Region.ClientStack.Linden
}
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
}
AddDefaultFeatures();
@@ -94,6 +99,8 @@ namespace OpenSim.Region.ClientStack.Linden
{
m_scene = s;
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
m_scene.RegisterModuleInterface<ISimulatorFeaturesModule>(this);
}
public void RemoveRegion(Scene s)
@@ -148,6 +155,9 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_SearchURL != string.Empty)
gridServicesMap["search"] = m_SearchURL;
m_features["GridServices"] = gridServicesMap;
if (m_ExportSupported)
m_features["ExportSupported"] = true;
}
}
@@ -156,7 +166,7 @@ namespace OpenSim.Region.ClientStack.Linden
IRequestHandler reqHandler
= new RestHTTPHandler(
"GET", "/CAPS/" + UUID.Random(),
HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString());
x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString());
caps.RegisterHandler("SimulatorFeatures", reqHandler);
}
@@ -185,18 +195,33 @@ namespace OpenSim.Region.ClientStack.Linden
return new OSDMap(m_features);
}
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod)
private OSDMap DeepCopy()
{
// This isn't the cheapest way of doing this but the rate
// of occurrence is low (on sim entry only) and it's a sure
// way to get a true deep copy.
OSD copy = OSDParser.DeserializeLLSDXml(OSDParser.SerializeLLSDXmlString(m_features));
return (OSDMap)copy;
}
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID)
{
// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
OSDMap copy = DeepCopy();
SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
if (handlerOnSimulatorFeaturesRequest != null)
handlerOnSimulatorFeaturesRequest(agentID, ref copy);
//Send back data
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
lock (m_features)
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(copy);
return responsedata;
}

View File

@@ -190,8 +190,15 @@ namespace OpenSim.Region.ClientStack.Linden
{
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
{
cacheItems[i].TextureID =
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID;
Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
if (face == null)
{
textureEntry.CreateFace(cacheItems[i].TextureIndex);
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
AppearanceManager.DEFAULT_AVATAR_TEXTURE;
continue;
}
cacheItems[i].TextureID =face.TextureID;
if (m_scene.AssetService != null)
cacheItems[i].TextureAsset =
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
@@ -213,8 +220,16 @@ namespace OpenSim.Region.ClientStack.Linden
{
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
{
Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
if (face == null)
{
textureEntry.CreateFace(cacheItems[i].TextureIndex);
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
AppearanceManager.DEFAULT_AVATAR_TEXTURE;
continue;
}
cacheItems[i].TextureID =
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID;
face.TextureID;
}
else
{

View File

@@ -39,10 +39,13 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Capabilities;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
using OpenSim.Capabilities.Handlers;
using OpenSim.Framework.Monitoring;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Region.ClientStack.Linden
{
@@ -52,11 +55,13 @@ namespace OpenSim.Region.ClientStack.Linden
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")]
public class WebFetchInvDescModule : INonSharedRegionModule
{
struct aPollRequest
class aPollRequest
{
public PollServiceInventoryEventArgs thepoll;
public UUID reqID;
public Hashtable request;
public ScenePresence presence;
public List<UUID> folders;
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -71,8 +76,8 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
private static Thread[] m_workerThreads = null;
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
new OpenMetaverse.BlockingQueue<aPollRequest>();
private static DoubleQueue<aPollRequest> m_queue =
new DoubleQueue<aPollRequest>();
#region ISharedRegionModule Members
@@ -143,12 +148,18 @@ namespace OpenSim.Region.ClientStack.Linden
private class PollServiceInventoryEventArgs : PollServiceEventArgs
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, Hashtable> responses =
new Dictionary<UUID, Hashtable>();
public PollServiceInventoryEventArgs(UUID pId) :
private Scene m_scene;
public PollServiceInventoryEventArgs(Scene scene, UUID pId) :
base(null, null, null, null, pId, int.MaxValue)
{
m_scene = scene;
HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
GetEvents = (x, y) =>
{
@@ -167,12 +178,68 @@ namespace OpenSim.Region.ClientStack.Linden
Request = (x, y) =>
{
ScenePresence sp = m_scene.GetScenePresence(Id);
if (sp == null)
{
m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id);
return;
}
aPollRequest reqinfo = new aPollRequest();
reqinfo.thepoll = this;
reqinfo.reqID = x;
reqinfo.request = y;
reqinfo.presence = sp;
reqinfo.folders = new List<UUID>();
m_queue.Enqueue(reqinfo);
// Decode the request here
string request = y["body"].ToString();
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
Hashtable hash = new Hashtable();
try
{
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
}
catch (LLSD.LLSDParseException e)
{
m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
m_log.Error("Request: " + request);
return;
}
catch (System.Xml.XmlException)
{
m_log.ErrorFormat("[INVENTORY]: XML Format error");
}
ArrayList foldersrequested = (ArrayList)hash["folders"];
bool highPriority = false;
for (int i = 0; i < foldersrequested.Count; i++)
{
Hashtable inventoryhash = (Hashtable)foldersrequested[i];
string folder = inventoryhash["folder_id"].ToString();
UUID folderID;
if (UUID.TryParse(folder, out folderID))
{
if (!reqinfo.folders.Contains(folderID))
{
if (sp.COF != UUID.Zero && sp.COF == folderID)
highPriority = true;
reqinfo.folders.Add(folderID);
}
}
}
if (highPriority)
m_queue.EnqueueHigh(reqinfo);
else
m_queue.EnqueueLow(reqinfo);
};
NoEvents = (x, y) =>
@@ -208,7 +275,7 @@ namespace OpenSim.Region.ClientStack.Linden
response["reusecontext"] = false;
response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(
requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
lock (responses)
responses[requestID] = response;
@@ -220,7 +287,7 @@ namespace OpenSim.Region.ClientStack.Linden
string capUrl = "/CAPS/" + UUID.Random() + "/";
// Register this as a poll service
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID);
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID);
args.Type = PollServiceEventArgs.EventType.Inventory;
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);

View File

@@ -51,6 +51,7 @@ using RegionFlags = OpenMetaverse.RegionFlags;
using Nini.Config;
using System.IO;
using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.ClientStack.LindenUDP
{
@@ -822,6 +823,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType);
handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes;
handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[0];
// OutPacket(handshake, ThrottleOutPacketType.Task);
// use same as MoveAgentIntoRegion (both should be task )
OutPacket(handshake, ThrottleOutPacketType.Unknown);
@@ -901,9 +903,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, UUID invoice, List<string> message)
{
GenericMessagePacket gmp = new GenericMessagePacket();
gmp.AgentData.AgentID = AgentId;
gmp.AgentData.SessionID = m_sessionId;
gmp.AgentData.TransactionID = invoice;
gmp.MethodData.Method = Util.StringToBytes256(method);
gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
int i = 0;
@@ -916,9 +923,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(gmp, ThrottleOutPacketType.Task);
}
public void SendGenericMessage(string method, List<byte[]> message)
public void SendGenericMessage(string method, UUID invoice, List<byte[]> message)
{
GenericMessagePacket gmp = new GenericMessagePacket();
gmp.AgentData.AgentID = AgentId;
gmp.AgentData.SessionID = m_sessionId;
gmp.AgentData.TransactionID = invoice;
gmp.MethodData.Method = Util.StringToBytes256(method);
gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
int i = 0;
@@ -1801,7 +1813,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
{
const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
// Fudge this value. It's only needed to make the CRC anyway
const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff;
FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
// TODO: don't create new blocks if recycling an old packet
@@ -2006,7 +2019,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected void SendBulkUpdateInventoryItem(InventoryItemBase item)
{
const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
const uint FULL_MASK_PERMISSIONS = (uint)0x7ffffff;
BulkUpdateInventoryPacket bulkUpdate
= (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory);
@@ -2065,7 +2078,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId)
{
const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff;
UpdateCreateInventoryItemPacket InventoryReply
= (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(
@@ -2654,7 +2667,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
byte physshapetype = part.PhysicsShapeType;
float density = part.Density;
float friction = part.Friction;
float bounce = part.Bounciness;
float bounce = part.Restitution;
float gravmod = part.GravityModifier;
eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
@@ -3604,7 +3617,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
avp.Sender.IsTrial = false;
avp.Sender.ID = agentID;
m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
//m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
OutPacket(avp, ThrottleOutPacketType.Task);
}
@@ -3892,6 +3906,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
part.Shape.LightEntry = false;
}
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
{
// Ensure that mesh has at least 8 valid faces
part.Shape.ProfileBegin = 12500;
part.Shape.ProfileEnd = 0;
part.Shape.ProfileHollow = 27500;
}
}
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
{
// Ensure that mesh has at least 8 valid faces
part.Shape.ProfileBegin = 12500;
part.Shape.ProfileEnd = 0;
part.Shape.ProfileHollow = 27500;
}
}
@@ -4208,7 +4238,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pack.Stat = stats.StatsBlock;
pack.Header.Reliable = false;
pack.RegionInfo = new SimStatsPacket.RegionInfoBlock[0];
OutPacket(pack, ThrottleOutPacketType.Task);
}
@@ -4599,7 +4629,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
rinfopack.AgentData = new RegionInfoPacket.AgentDataBlock();
rinfopack.AgentData.AgentID = AgentId;
rinfopack.AgentData.SessionID = SessionId;
rinfopack.RegionInfo3 = new RegionInfoPacket.RegionInfo3Block[0];
OutPacket(rinfopack, ThrottleOutPacketType.Task);
}
@@ -4952,6 +4982,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset;
rotation = part.RotationOffset * presence.Rotation;
}
angularVelocity = Vector3.Zero;
}
else
{
angularVelocity = presence.AngularVelocity;
rotation = presence.Rotation;
}
attachPoint = 0;
@@ -4963,9 +4999,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// in that direction, even though we don't model this on the server. Implementing this in the future
// may improve movement smoothness.
// acceleration = new Vector3(1, 0, 0);
angularVelocity = Vector3.Zero;
if (sendTexture)
textureEntry = presence.Appearance.Texture.GetBytes();
else
@@ -6575,19 +6609,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion
AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
if (handlerAgentRequestSit != null)
if (!(agentRequestSit.AgentData == null
|| agentRequestSit.TargetObject == null
|| agentRequestSit.TargetObject.TargetID == null
|| agentRequestSit.TargetObject.Offset == null))
{
var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID);
if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting
return true;
handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
}
if (handlerAgentRequestSit != null)
handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
}
return true;
}
@@ -7193,7 +7218,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerUpdatePrimFlags != null)
{
byte[] data = Pack.ToBytes();
// byte[] data = Pack.ToBytes();
// 46,47,48 are special positions within the packet
// This may change so perhaps we need a better way
// of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
@@ -9835,7 +9860,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest;
if (handlerEconomoyDataRequest != null)
{
handlerEconomoyDataRequest(AgentId);
handlerEconomoyDataRequest(this);
}
return true;
}
@@ -12242,11 +12267,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (logPacket)
m_log.DebugFormat(
"[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}",
Name, SceneAgent.IsChildAgent ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type);
Name, SceneAgent.IsChildAgent ? "child" : "root ", Scene.Name, packet.Type);
}
if (!ProcessPacketMethod(packet))
m_log.Warn("[CLIENT]: unhandled packet " + packet.Type);
m_log.WarnFormat(
"[CLIENT]: Unhandled packet {0} from {1} ({2}) in {3}. Ignoring.",
packet.Type, Name, SceneAgent.IsChildAgent ? "child" : "root ", Scene.Name);
}
private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)
@@ -12454,6 +12481,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return String.Empty;
}
public OSDMap OReport(string uptime, string version)
{
return new OSDMap();
}
/// <summary>
/// Make an asset request to the asset service in response to a client request.
/// </summary>

View File

@@ -281,25 +281,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_shouldCollectStats = false;
if (config != null)
{
if (config.Contains("enabled") && config.GetBoolean("enabled"))
{
if (config.Contains("collect_packet_headers"))
m_shouldCollectStats = config.GetBoolean("collect_packet_headers");
if (config.Contains("packet_headers_period_seconds"))
{
binStatsMaxFilesize = TimeSpan.FromSeconds(config.GetInt("region_stats_period_seconds"));
}
if (config.Contains("stats_dir"))
{
binStatsDir = config.GetString("stats_dir");
}
}
else
{
m_shouldCollectStats = false;
}
}
#endregion BinaryStats
m_shouldCollectStats = config.GetBoolean("Enabled", false);
binStatsMaxFilesize = TimeSpan.FromSeconds(config.GetInt("packet_headers_period_seconds", 300));
binStatsDir = config.GetString("stats_dir", ".");
m_aggregatedBWStats = config.GetBoolean("aggregatedBWStats", false);
}
#endregion BinaryStats
m_throttle = new TokenBucket(null, sceneThrottleBps);
ThrottleRates = new ThrottleRates(configSource);
@@ -1309,8 +1296,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
static object binStatsLogLock = new object();
static string binStatsDir = "";
//for Aggregated In/Out BW logging
static bool m_aggregatedBWStats = false;
static long m_aggregatedBytesIn = 0;
static long m_aggregatedByestOut = 0;
static object aggBWStatsLock = new object();
public static long AggregatedLLUDPBytesIn
{
get { return m_aggregatedBytesIn; }
}
public static long AggregatedLLUDPBytesOut
{
get {return m_aggregatedByestOut;}
}
public static void LogPacketHeader(bool incoming, uint circuit, byte flags, PacketType packetType, ushort size)
{
if (m_aggregatedBWStats)
{
lock (aggBWStatsLock)
{
if (incoming)
m_aggregatedBytesIn += size;
else
m_aggregatedByestOut += size;
}
}
if (!m_shouldCollectStats) return;
// Binary logging format is TTTTTTTTCCCCFPPPSS, T=Time, C=Circuit, F=Flags, P=PacketType, S=size
@@ -1903,112 +1916,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
internal class DoubleQueue<T> where T:class
{
private Queue<T> m_lowQueue = new Queue<T>();
private Queue<T> m_highQueue = new Queue<T>();
private object m_syncRoot = new object();
private Semaphore m_s = new Semaphore(0, 1);
public DoubleQueue()
{
}
public virtual int Count
{
get { return m_highQueue.Count + m_lowQueue.Count; }
}
public virtual void Enqueue(T data)
{
Enqueue(m_lowQueue, data);
}
public virtual void EnqueueLow(T data)
{
Enqueue(m_lowQueue, data);
}
public virtual void EnqueueHigh(T data)
{
Enqueue(m_highQueue, data);
}
private void Enqueue(Queue<T> q, T data)
{
lock (m_syncRoot)
{
m_lowQueue.Enqueue(data);
m_s.WaitOne(0);
m_s.Release();
}
}
public virtual T Dequeue()
{
return Dequeue(Timeout.Infinite);
}
public virtual T Dequeue(int tmo)
{
return Dequeue(TimeSpan.FromMilliseconds(tmo));
}
public virtual T Dequeue(TimeSpan wait)
{
T res = null;
if (!Dequeue(wait, ref res))
return null;
return res;
}
public bool Dequeue(int timeout, ref T res)
{
return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
}
public bool Dequeue(TimeSpan wait, ref T res)
{
if (!m_s.WaitOne(wait))
return false;
lock (m_syncRoot)
{
if (m_highQueue.Count > 0)
res = m_highQueue.Dequeue();
else
res = m_lowQueue.Dequeue();
if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
return true;
try
{
m_s.Release();
}
catch
{
}
return true;
}
}
public virtual void Clear()
{
lock (m_syncRoot)
{
// Make sure sem count is 0
m_s.WaitOne(0);
m_lowQueue.Clear();
m_highQueue.Clear();
}
}
}
}

View File

@@ -204,9 +204,12 @@ namespace OpenMetaverse
{
UDPPacketBuffer buf;
if (UsePools)
buf = Pool.GetObject();
else
// FIXME: Disabled for now as this causes issues with reused packet objects interfering with each other
// on Windows with m_asyncPacketHandling = true, though this has not been seen on Linux.
// Possibly some unexpected issue with fetching UDP data concurrently with multiple threads. Requires more investigation.
// if (UsePools)
// buf = Pool.GetObject();
// else
buf = new UDPPacketBuffer();
if (IsRunningInbound)
@@ -287,8 +290,8 @@ namespace OpenMetaverse
catch (ObjectDisposedException) { }
finally
{
if (UsePools)
Pool.ReturnObject(buffer);
// if (UsePools)
// Pool.ReturnObject(buffer);
// Synchronous mode waits until the packet callback completes
// before starting the receive to fetch another packet

View File

@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.7.5.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.7.6.*")]

View File

@@ -43,7 +43,7 @@ using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
[TestFixture]
public class LLImageManagerTests
public class LLImageManagerTests : OpenSimTestCase
{
private AssetBase m_testImageAsset;
private Scene scene;

View File

@@ -39,7 +39,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
/// Tests for the LL packet handler
/// </summary>
[TestFixture]
public class PacketHandlerTests
public class PacketHandlerTests : OpenSimTestCase
{
// [Test]
// /// <summary>

View File

@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.7.5.*")]
[assembly: AssemblyVersion("0.7.6.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]