Merge branch 'avination' into ubitwork

avinationmerge
UbitUmarov 2013-01-26 03:16:45 +00:00
commit c58ec342ff
20 changed files with 413 additions and 397 deletions

View File

@ -70,6 +70,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private string m_name = "RemoteAdminPlugin";
private string m_version = "0.0";
private string m_openSimVersion;
public string Version
{
@ -89,6 +90,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
public void Initialise(OpenSimBase openSim)
{
m_openSimVersion = openSim.GetVersionText();
m_configSource = openSim.ConfigSource.Source;
try
{
@ -159,6 +162,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Misc
availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion);
// Either enable full remote functionality or just selected features
string enabledMethods = m_config.GetString("enabled_methods", "all");
@ -1977,6 +1981,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_log.Info("[RADMIN]: Refresh Search Request complete");
}
private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
{
m_log.Info("[RADMIN]: Received Get OpenSim Version Request");
Hashtable responseData = (Hashtable)response.Value;
responseData["version"] = m_openSimVersion;
responseData["success"] = true;
m_log.Info("[RADMIN]: Get OpenSim Version Request complete");
}
/// <summary>
/// Parse a float with the given parameter name from a request data hash table.
/// </summary>

View File

@ -99,12 +99,23 @@ namespace OpenSim.Capabilities.Handlers
}
// OK, we have an array with preferred formats, possibly with only one entry
bool foundtexture = false;
foreach (string f in formats)
{
if (FetchTexture(request, ret, textureID, f))
foundtexture = FetchTexture(request, ret, textureID, f);
if (foundtexture)
break;
}
if (!foundtexture)
{
ret["int_response_code"] = 404;
ret["error_status_text"] = "not found";
ret["str_response_string"] = "not found";
ret["content_type"] = "text/plain";
ret["keepalive"] = false;
ret["reusecontext"] = false;
ret["int_bytes"] = 0;
}
}
else
{
@ -176,9 +187,13 @@ namespace OpenSim.Capabilities.Handlers
return true;
}
//response = new Hashtable();
//WriteTextureData(request,response,null,format);
// not found
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
return true;
//m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
return false;
}
private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format)

View File

@ -1558,7 +1558,58 @@ namespace OpenSim.Framework
SHAPE_EYELID_INNER_CORNER_UP = 214,
SKIRT_SKIRT_RED = 215,
SKIRT_SKIRT_GREEN = 216,
SKIRT_SKIRT_BLUE = 217
SKIRT_SKIRT_BLUE = 217,
/// <summary>
/// Avatar Physics section. These are 0 type visual params which get transmitted.
/// </summary>
/// <summary>
/// Breast Part 1
/// </summary>
BREAST_PHYSICS_MASS = 218,
BREAST_PHYSICS_GRAVITY = 219,
BREAST_PHYSICS_DRAG = 220,
BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221,
BREAST_PHYSICS_UPDOWN_SPRING = 222,
BREAST_PHYSICS_UPDOWN_GAIN = 223,
BREAST_PHYSICS_UPDOWN_DAMPING = 224,
BREAST_PHYSICS_INOUT_MAX_EFFECT = 225,
BREAST_PHYSICS_INOUT_SPRING = 226,
BREAST_PHYSICS_INOUT_GAIN = 227,
BREAST_PHYSICS_INOUT_DAMPING = 228,
/// <summary>
/// Belly
/// </summary>
BELLY_PHYISCS_MASS = 229,
BELLY_PHYSICS_GRAVITY = 230,
BELLY_PHYSICS_DRAG = 231,
BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232,
BELLY_PHYSICS_UPDOWN_SPRING = 233,
BELLY_PHYSICS_UPDOWN_GAIN = 234,
BELLY_PHYSICS_UPDOWN_DAMPING = 235,
/// <summary>
/// Butt
/// </summary>
BUTT_PHYSICS_MASS = 236,
BUTT_PHYSICS_GRAVITY = 237,
BUTT_PHYSICS_DRAG = 238,
BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239,
BUTT_PHYSICS_UPDOWN_SPRING = 240,
BUTT_PHYSICS_UPDOWN_GAIN = 241,
BUTT_PHYSICS_UPDOWN_DAMPING = 242,
BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243,
BUTT_PHYSICS_LEFTRIGHT_SPRING = 244,
BUTT_PHYSICS_LEFTRIGHT_GAIN = 245,
BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246,
/// <summary>
/// Breast Part 2
/// </summary>
BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247,
BREAST_PHYSICS_LEFTRIGHT_SPRING= 248,
BREAST_PHYSICS_LEFTRIGHT_GAIN = 249,
BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250
}
#endregion
}

View File

@ -29,7 +29,7 @@ using System.Threading;
namespace OpenSim.Framework
{
public sealed class LocklessQueue<T>
public class LocklessQueue<T>
{
private sealed class SingleLinkNode
{
@ -41,7 +41,7 @@ namespace OpenSim.Framework
SingleLinkNode tail;
int count;
public int Count { get { return count; } }
public virtual int Count { get { return count; } }
public LocklessQueue()
{
@ -76,7 +76,7 @@ namespace OpenSim.Framework
Interlocked.Increment(ref count);
}
public bool Dequeue(out T item)
public virtual bool Dequeue(out T item)
{
item = default(T);
SingleLinkNode oldHead = null;

View File

@ -531,7 +531,7 @@ namespace OpenSim.Framework.Servers
}
}
protected string GetVersionText()
public string GetVersionText()
{
return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
}

View File

@ -47,6 +47,8 @@ namespace OpenSim.Framework
Texture = 5,
/// <summary>Non-texture assets</summary>
Asset = 6,
HighPriority = 128,
}
[Flags]

View File

@ -897,31 +897,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
msg.MessageBlock.Message = Util.StringToBytes1024(im.message);
msg.MessageBlock.BinaryBucket = im.binaryBucket;
if (im.message.StartsWith("[grouptest]"))
{ // this block is test code for implementing group IM - delete when group IM is finished
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
im.dialog = 17;
//eq.ChatterboxInvitation(
// new UUID("00000000-68f9-1111-024e-222222111123"),
// "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
// false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
eq.ChatterboxInvitation(
new UUID("00000000-68f9-1111-024e-222222111123"),
"OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing"));
eq.ChatterBoxSessionAgentListUpdates(
new UUID("00000000-68f9-1111-024e-222222111123"),
new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
}
Console.WriteLine("SendInstantMessage: " + msg);
}
else
OutPacket(msg, ThrottleOutPacketType.Task);
}
}
@ -2788,7 +2763,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
Transfer.TransferInfo.TransferID = req.TransferRequestID;
Transfer.Header.Zerocoded = true;
OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset);
OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
if (req.NumPackets == 1)
{
@ -2799,7 +2774,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TransferPacket.TransferData.Data = req.AssetInf.Data;
TransferPacket.TransferData.Status = 1;
TransferPacket.Header.Zerocoded = true;
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset);
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
}
else
{
@ -2832,7 +2807,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TransferPacket.TransferData.Status = 1;
}
TransferPacket.Header.Zerocoded = true;
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset);
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
processedLength += chunkSize;
packetNumber++;
@ -3605,7 +3580,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
OutPacket(aw, ThrottleOutPacketType.Task);
OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
}
public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)

View File

@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Packets we have sent that need to be ACKed by the client</summary>
public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
/// <summary>ACKs that are queued up, waiting to be sent to the client</summary>
public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>();
public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>();
/// <summary>Current packet sequence number</summary>
public int CurrentSequence;
@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Throttle buckets for each packet category</summary>
private readonly TokenBucket[] m_throttleCategories;
/// <summary>Outgoing queues for throttled packets</summary>
private readonly OpenSim.Framework.LocklessQueue<OutgoingPacket>[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
private readonly DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
/// <summary>A container that can hold one packet for each outbox, used to store
/// dequeued packets that are being held for throttling</summary>
private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ThrottleOutPacketType type = (ThrottleOutPacketType)i;
// Initialize the packet outboxes, where packets sit while they are waiting for tokens
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
// Initialize the token buckets that control the throttling for each category
m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type));
}
@ -429,16 +429,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// false if the packet has not been queued and should be sent immediately.
/// </returns>
public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
{
return EnqueueOutgoing(packet, forceQueue, false);
}
public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority)
{
int category = (int)packet.Category;
if (category >= 0 && category < m_packetOutboxes.Length)
{
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
DoubleLocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
if (m_deliverPackets == false)
{
queue.Enqueue(packet);
queue.Enqueue(packet, highPriority);
return true;
}
@ -449,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// queued packets
if (queue.Count > 0)
{
queue.Enqueue(packet);
queue.Enqueue(packet, highPriority);
return true;
}
@ -462,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else
{
// Force queue specified or not enough tokens in the bucket, queue this packet
queue.Enqueue(packet);
queue.Enqueue(packet, highPriority);
return true;
}
}
@ -494,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_deliverPackets == false) return false;
OutgoingPacket packet = null;
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
DoubleLocklessQueue<OutgoingPacket> queue;
TokenBucket bucket;
bool packetSent = false;
ThrottleOutPacketTypeFlags emptyCategories = 0;
@ -534,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch
{
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
}
if (success)
{
@ -567,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
emptyCategories |= CategoryToFlag(i);
}
}
@ -724,4 +729,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
public class DoubleLocklessQueue<T> : OpenSim.Framework.LocklessQueue<T>
{
OpenSim.Framework.LocklessQueue<T> highQueue = new OpenSim.Framework.LocklessQueue<T>();
public override int Count
{
get
{
return base.Count + highQueue.Count;
}
}
public override bool Dequeue(out T item)
{
if (highQueue.Dequeue(out item))
return true;
return base.Dequeue(out item);
}
public void Enqueue(T item, bool highPriority)
{
if (highPriority)
highQueue.Enqueue(item);
else
Enqueue(item);
}
}
}

View File

@ -803,6 +803,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Queue or Send
bool highPriority = false;
if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0)
{
category = (ThrottleOutPacketType)((int)category & 127);
highPriority = true;
}
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
// If we were not provided a method for handling unacked, use the UDPServer default method
outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
@ -811,7 +819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// continue to display the deleted object until relog. Therefore, we need to always queue a kill object
// packet so that it isn't sent before a queued update packet.
bool requestQueue = type == PacketType.KillObject;
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
SendPacketFinal(outgoingPacket);
#endregion Queue or Send

View File

@ -373,6 +373,52 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
{
bool defonly = true; // are we only using default textures
IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
WearableCacheItem[] wearableCache = null;
// Cache wearable data for teleport.
// Only makes sense if there's a bake module and a cache module
if (bakedModule != null && cache != null)
{
try
{
wearableCache = bakedModule.Get(sp.UUID);
}
catch (Exception)
{
}
if (wearableCache != null)
{
for (int i = 0; i < wearableCache.Length; i++)
{
cache.Cache(wearableCache[i].TextureAsset);
}
}
}
/*
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
if (invService.GetRootFolder(userID) != null)
{
WearableCacheItem[] wearableCache = null;
if (bakedModule != null)
{
try
{
wearableCache = bakedModule.Get(userID);
appearance.WearableCacheItems = wearableCache;
appearance.WearableCacheItemsDirty = false;
foreach (WearableCacheItem item in wearableCache)
{
appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID;
}
}
catch (Exception)
{
}
}
*/
// Process the texture entry
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@ -380,9 +426,32 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
int idx = AvatarAppearance.BAKE_INDICES[i];
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
// if there is no texture entry, skip it
// No face, so lets check our baked service cache, teleport or login.
if (face == null)
{
if (wearableCache != null)
{
// If we find the an appearance item, set it as the textureentry and the face
WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache);
if (searchitem != null)
{
sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx);
sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID;
face = sp.Appearance.Texture.FaceTextures[idx];
}
else
{
// if there is no texture entry and no baked cache, skip it
continue;
}
}
else
{
//No texture entry face and no cache. Skip this face.
continue;
}
}
// m_log.DebugFormat(
// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",

View File

@ -1,257 +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.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Groups
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")]
public class GroupsModule : ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, GroupMembershipData> m_GroupMap =
new Dictionary<UUID, GroupMembershipData>();
private Dictionary<UUID, IClientAPI> m_ClientMap =
new Dictionary<UUID, IClientAPI>();
private UUID opensimulatorGroupID =
new UUID("00000000-68f9-1111-024e-222222111123");
private List<Scene> m_SceneList = new List<Scene>();
private static GroupMembershipData osGroup =
new GroupMembershipData();
private bool m_Enabled = false;
#region ISharedRegionModule Members
public void Initialise(IConfigSource config)
{
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
{
m_log.Info("[GROUPS]: No configuration found. Using defaults");
}
else
{
m_Enabled = groupsConfig.GetBoolean("Enabled", false);
if (!m_Enabled)
{
m_log.Info("[GROUPS]: Groups disabled in configuration");
return;
}
if (groupsConfig.GetString("Module", "Default") != "Default")
return;
}
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
lock (m_SceneList)
{
if (!m_SceneList.Contains(scene))
{
if (m_SceneList.Count == 0)
{
osGroup.GroupID = opensimulatorGroupID;
osGroup.GroupName = "OpenSimulator Testing";
osGroup.GroupPowers =
(uint)(GroupPowers.AllowLandmark |
GroupPowers.AllowSetHome);
m_GroupMap[opensimulatorGroupID] = osGroup;
}
m_SceneList.Add(scene);
}
}
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
lock (m_SceneList)
{
if (m_SceneList.Contains(scene))
m_SceneList.Remove(scene);
}
scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnClientClosed -= OnClientClosed;
}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise()
{
}
public void Close()
{
if (!m_Enabled)
return;
// m_log.Debug("[GROUPS]: Shutting down group module.");
lock (m_ClientMap)
{
m_ClientMap.Clear();
}
lock (m_GroupMap)
{
m_GroupMap.Clear();
}
}
public string Name
{
get { return "GroupsModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
private void OnNewClient(IClientAPI client)
{
// Subscribe to instant messages
// client.OnInstantMessage += OnInstantMessage;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
lock (m_ClientMap)
{
if (!m_ClientMap.ContainsKey(client.AgentId))
{
m_ClientMap.Add(client.AgentId, client);
}
}
GroupMembershipData[] updateGroups = new GroupMembershipData[1];
updateGroups[0] = osGroup;
client.SendGroupMembership(updateGroups);
}
private void OnAgentDataUpdateRequest(IClientAPI remoteClient,
UUID AgentID, UUID SessionID)
{
UUID ActiveGroupID;
string ActiveGroupName;
ulong ActiveGroupPowers;
string firstname = remoteClient.FirstName;
string lastname = remoteClient.LastName;
string ActiveGroupTitle = "I IZ N0T";
ActiveGroupID = osGroup.GroupID;
ActiveGroupName = osGroup.GroupName;
ActiveGroupPowers = osGroup.GroupPowers;
remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname,
lastname, ActiveGroupPowers, ActiveGroupName,
ActiveGroupTitle);
}
// private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
// {
// }
// private void OnGridInstantMessage(GridInstantMessage msg)
// {
// // Trigger the above event handler
// OnInstantMessage(null, msg);
// }
private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
{
string groupnamereply = "Unknown";
UUID groupUUID = UUID.Zero;
lock (m_GroupMap)
{
if (m_GroupMap.ContainsKey(id))
{
GroupMembershipData grp = m_GroupMap[id];
groupnamereply = grp.GroupName;
groupUUID = grp.GroupID;
}
}
remote_client.SendGroupNameReply(groupUUID, groupnamereply);
}
private void OnClientClosed(UUID agentID, Scene scene)
{
lock (m_ClientMap)
{
if (m_ClientMap.ContainsKey(agentID))
{
// IClientAPI cli = m_ClientMap[agentID];
// if (cli != null)
// {
// //m_log.Info("[GROUPS]: Removing all reference to groups for " + cli.Name);
// }
// else
// {
// //m_log.Info("[GROUPS]: Removing all reference to groups for " + agentID.ToString());
// }
m_ClientMap.Remove(agentID);
}
}
}
}
}

View File

@ -150,6 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
client.OnTeleportHomeRequest += TriggerTeleportHome;
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
client.OnTeleportCancel += TeleportCancel;
}
public virtual void Close() {}
@ -401,14 +402,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
// Record that this agent is in transit so that we can prevent simultaneous requests and do later detection
// of whether the destination region completes the teleport.
if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
return;
}
m_entityTransferStateMachine.SetInTransit(sp.UUID);
// if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
// {
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
// sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
//
// return;
// }
if (reg == null || finalDestination == null)
{
@ -993,6 +995,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return neighbourRegion;
}
private void TeleportCancel(IClientAPI remoteClient)
{
m_entityTransferStateMachine.ResetFromTransit(remoteClient.AgentId);
}
public bool Cross(ScenePresence agent, bool isFlying)
{
uint x;

View File

@ -42,6 +42,7 @@ using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
using Amib.Threading;
/*****************************************************
*
@ -102,6 +103,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
private Dictionary<UUID, HttpRequestClass> m_pendingRequests;
private Scene m_scene;
// private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
public static SmartThreadPool ThreadPool = null;
public HttpRequestModule()
{
@ -279,7 +281,30 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
int maxThreads = 50;
IConfig httpConfig = config.Configs["HttpRequestModule"];
if (httpConfig != null)
{
maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads);
}
m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
// First instance sets this up for all sims
if (ThreadPool == null)
{
STPStartInfo startInfo = new STPStartInfo();
startInfo.IdleTimeout = 20000;
startInfo.MaxWorkerThreads = maxThreads;
startInfo.MinWorkerThreads = 5;
startInfo.ThreadPriority = ThreadPriority.BelowNormal;
startInfo.StartSuspended = true;
ThreadPool = new SmartThreadPool(startInfo);
ThreadPool.Start();
}
}
public void AddRegion(Scene scene)
@ -340,7 +365,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public string HttpMIMEType = "text/plain;charset=utf-8";
public int HttpTimeout;
public bool HttpVerifyCert = true;
private Thread httpThread;
public IWorkItemResult WorkItem = null;
// Request info
private UUID _itemID;
@ -374,12 +399,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public void Process()
{
httpThread = new Thread(SendRequest);
httpThread.Name = "HttpRequestThread";
httpThread.Priority = ThreadPriority.BelowNormal;
httpThread.IsBackground = true;
_finished = false;
httpThread.Start();
lock (HttpRequestModule.ThreadPool)
WorkItem = HttpRequestModule.ThreadPool.QueueWorkItem(new WorkItemCallback(StpSendWrapper), null);
}
private object StpSendWrapper(object o)
{
SendRequest();
return null;
}
/*
@ -409,13 +438,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
// We could hijack Connection Group Name to identify
// a desired security exception. But at the moment we'll use a dummy header instead.
// Request.ConnectionGroupName = "NoVerify";
Request.Headers.Add("NoVerifyCert", "true");
}
// else
// {
// Request.ConnectionGroupName="Verify";
// }
if (proxyurl != null && proxyurl.Length > 0)
{
if (proxyexcepts != null && proxyexcepts.Length > 0)
@ -485,9 +509,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
ResponseBody = sb.ToString().Replace("\r", "");
}
catch (Exception e)
catch (WebException e)
{
if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError)
if (e.Status == WebExceptionStatus.ProtocolError)
{
HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
Status = (int)webRsp.StatusCode;
@ -509,15 +533,25 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
ResponseBody = e.Message;
}
if (ResponseBody == null)
ResponseBody = String.Empty;
_finished = true;
return;
}
catch (Exception e)
{
// Don't crash on anything else
}
finally
{
if (response != null)
response.Close();
}
if (ResponseBody == null)
ResponseBody = String.Empty;
_finished = true;
}
@ -525,7 +559,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
try
{
httpThread.Abort();
if (!WorkItem.Cancel())
{
WorkItem.Abort();
}
}
catch (Exception)
{

View File

@ -282,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private volatile bool m_backingup;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>();
private bool m_physics_enabled = true;
private bool m_scripts_enabled = true;
@ -1736,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes
public void AddGroupTarget(SceneObjectGroup grp)
{
lock (m_groupsWithTargets)
m_groupsWithTargets[grp.UUID] = grp;
m_groupsWithTargets[grp.UUID] = 0;
}
public void RemoveGroupTarget(SceneObjectGroup grp)
@ -1747,18 +1747,24 @@ namespace OpenSim.Region.Framework.Scenes
private void CheckAtTargets()
{
List<SceneObjectGroup> objs = null;
List<UUID> objs = null;
lock (m_groupsWithTargets)
{
if (m_groupsWithTargets.Count != 0)
objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values);
objs = new List<UUID>(m_groupsWithTargets.Keys);
}
if (objs != null)
{
foreach (SceneObjectGroup entry in objs)
entry.checkAtTargets();
foreach (UUID entry in objs)
{
SceneObjectGroup grp = GetSceneObjectGroup(entry);
if (grp == null)
m_groupsWithTargets.Remove(entry);
else
grp.checkAtTargets();
}
}
}
@ -2059,11 +2065,11 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerPrimsLoaded(this);
}
public bool SuportsRayCastFiltered()
public bool SupportsRayCastFiltered()
{
if (PhysicsScene == null)
return false;
return PhysicsScene.SuportsRaycastWorldFiltered();
return PhysicsScene.SupportsRaycastWorldFiltered();
}
public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)

View File

@ -79,14 +79,14 @@ namespace OpenSim.Region.Framework.Scenes
object_rez = 4194304
}
struct scriptPosTarget
public struct scriptPosTarget
{
public Vector3 targetPos;
public float tolerance;
public uint handle;
}
struct scriptRotTarget
public struct scriptRotTarget
{
public Quaternion targetRot;
public float tolerance;
@ -320,8 +320,18 @@ namespace OpenSim.Region.Framework.Scenes
protected SceneObjectPart m_rootPart;
// private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>();
private SortedDictionary<uint, scriptPosTarget> m_targets = new SortedDictionary<uint, scriptPosTarget>();
private SortedDictionary<uint, scriptRotTarget> m_rotTargets = new SortedDictionary<uint, scriptRotTarget>();
public SortedDictionary<uint, scriptPosTarget> AtTargets
{
get { return m_targets; }
}
public SortedDictionary<uint, scriptRotTarget> RotTargets
{
get { return m_rotTargets; }
}
private bool m_scriptListens_atTarget;
private bool m_scriptListens_notAtTarget;
@ -4112,6 +4122,8 @@ namespace OpenSim.Region.Framework.Scenes
waypoint.handle = handle;
lock (m_rotTargets)
{
if (m_rotTargets.Count >= 8)
m_rotTargets.Remove(m_rotTargets.ElementAt(0).Key);
m_rotTargets.Add(handle, waypoint);
}
m_scene.AddGroupTarget(this);
@ -4137,6 +4149,8 @@ namespace OpenSim.Region.Framework.Scenes
waypoint.handle = handle;
lock (m_targets)
{
if (m_targets.Count >= 8)
m_targets.Remove(m_targets.ElementAt(0).Key);
m_targets.Add(handle, waypoint);
}
m_scene.AddGroupTarget(this);

View File

@ -350,7 +350,7 @@ namespace OpenSim.Region.Physics.Manager
return null;
}
public virtual bool SuportsRaycastWorldFiltered()
public virtual bool SupportsRaycastWorldFiltered()
{
return false;
}

View File

@ -2643,7 +2643,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
public override bool SuportsRaycastWorldFiltered()
public override bool SupportsRaycastWorldFiltered()
{
return true;
}

View File

@ -3018,16 +3018,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public LSL_Integer llGiveMoney(string destination, int amount)
{
Util.FireAndForget(x =>
{
m_host.AddScriptLPS(1);
if (m_item.PermsGranter == UUID.Zero)
return 0;
return;
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
{
LSLError("No permissions to give money");
return 0;
return;
}
UUID toID = new UUID();
@ -3035,7 +3037,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(destination, out toID))
{
LSLError("Bad key in llGiveMoney");
return 0;
return;
}
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
@ -3043,14 +3045,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (money == null)
{
NotImplemented("llGiveMoney");
return 0;
return;
}
bool result = money.ObjectGiveMoney(
money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
if (result)
return 1;
});
return 0;
}
@ -7322,7 +7322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpcMod.IsEnabled())
if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
{
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
@ -7354,6 +7354,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
ScriptSleep(3000);
if (xmlrpcMod == null)
return "";
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
}
@ -7361,6 +7363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpcMod != null)
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
ScriptSleep(3000);
}
@ -7369,6 +7372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpcMod != null)
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
ScriptSleep(1000);
}
@ -7782,8 +7786,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
ScriptSleep(200);
}
private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
@ -12209,7 +12211,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
if (World.SuportsRayCastFiltered())
if (World.SupportsRayCastFiltered())
{
if (dist == 0)
return list;
@ -12272,13 +12274,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
if (checkTerrain)
{
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
if (groundContact != null)
results.Add((ContactResult)groundContact);
}
if (checkAgents)
{
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
@ -12294,6 +12289,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
// Double check this
if (checkTerrain)
{
bool skipGroundCheck = false;
foreach (ContactResult c in results)
{
if (c.ConsumerID == 0) // Physics gave us a ground collision
skipGroundCheck = true;
}
if (!skipGroundCheck)
{
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
if (groundContact != null)
results.Add((ContactResult)groundContact);
}
}
results.Sort(delegate(ContactResult a, ContactResult b)
{
return a.Depth.CompareTo(b.Depth);
@ -12587,7 +12601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
bool result = money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn);
if (result)
{

View File

@ -1821,17 +1821,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
UUID assetID = UUID.Zero;
if (!UUID.TryParse(notecardNameOrUuid, out assetID))
bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID);
if (!notecardNameIsUUID)
{
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == notecardNameOrUuid)
{
assetID = item.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
}
if (assetID == UUID.Zero)
@ -1842,14 +1836,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AssetBase a = World.AssetService.Get(assetID.ToString());
if (a == null)
{
// Whoops, it's still possible here that the notecard name was properly
// formatted like a UUID but isn't an asset UUID so lets look it up by name after all
assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
if (assetID == UUID.Zero)
return UUID.Zero;
if (!NotecardCache.IsCached(assetID))
{
a = World.AssetService.Get(assetID.ToString());
if (a == null)
{
return UUID.Zero;
}
}
}
string data = Encoding.UTF8.GetString(a.Data);
NotecardCache.Cache(assetID, data);
};
return assetID;
}
protected UUID SearchTaskInventoryForAssetId(string name)
{
UUID assetId = UUID.Zero;
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
{
assetId = item.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return assetId;
}
/// <summary>
/// Directly get an entire notecard at once.

View File

@ -1680,6 +1680,7 @@
<!-- To allow regions to have mono addins -->
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="SmartThreadPool"/>
<Files>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>