mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
Resolve merge commits, stage 1
This commit is contained in:
@@ -136,7 +136,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
|
||||
CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
|
||||
GetClient = m_Scene.SceneContents.GetControllingClient;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -232,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public string SeedCapRequest(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
|
||||
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
|
||||
{
|
||||
@@ -331,14 +330,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle a request from the client for a Uri to upload a baked texture.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <returns>The upload response if the request is successful, null otherwise.</returns>
|
||||
public string UploadBakedTexture(string request, string path,
|
||||
string param, OSHttpRequest httpRequest,
|
||||
OSHttpResponse httpResponse)
|
||||
{
|
||||
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_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
@@ -374,6 +381,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a baked texture has been successfully uploaded by a client.
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="data"></param>
|
||||
public void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||
{
|
||||
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
|
||||
@@ -687,7 +699,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (AddNewInventoryItem != null)
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class BunchOfCapsModule : 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;
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[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;
|
||||
@@ -113,12 +113,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
// UUID capID = UUID.Random();
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
@@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetMesh", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
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;
|
||||
|
||||
@@ -128,12 +129,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class MeshUploadFlagModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Is this module enabled?
|
||||
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
|
||||
{
|
||||
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request");
|
||||
// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
|
||||
|
||||
OSDMap data = new OSDMap();
|
||||
ScenePresence sp = m_scene.GetScenePresence(m_agentID);
|
||||
|
||||
@@ -160,8 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
string assetName = llsdRequest.name;
|
||||
string assetDes = llsdRequest.description;
|
||||
@@ -208,12 +206,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return uploadResponse;
|
||||
}
|
||||
|
||||
|
||||
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType,UUID AgentID)
|
||||
{
|
||||
|
||||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
@@ -266,10 +262,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_scene.AddInventoryItem(item);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -322,8 +322,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
rootpart.NextOwnerMask = next_owner_mask;
|
||||
rootpart.Material = (byte)material;
|
||||
|
||||
|
||||
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
|
||||
|
||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parses ad request
|
||||
/// Parses add request
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="AgentId"></param>
|
||||
@@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
primFace.RepeatV = face.ScaleT;
|
||||
primFace.TexMapType = (MappingType) (face.MediaFlags & 6);
|
||||
}
|
||||
|
||||
pbs.TextureEntry = tmp.GetBytes();
|
||||
prim.Shape = pbs;
|
||||
prim.Scale = obj.Scale;
|
||||
|
||||
|
||||
SceneObjectGroup grp = new SceneObjectGroup();
|
||||
|
||||
grp.SetRootPart(prim);
|
||||
@@ -330,7 +330,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
grp.AbsolutePosition = obj.Position;
|
||||
prim.RotationOffset = obj.Rotation;
|
||||
|
||||
grp.RootPart.IsAttachment = false;
|
||||
grp.IsAttachment = false;
|
||||
// Required for linking
|
||||
grp.RootPart.UpdateFlag = 0;
|
||||
|
||||
@@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_scene.AddSceneObject(grp);
|
||||
grp.AbsolutePosition = obj.Position;
|
||||
}
|
||||
|
||||
allparts[i] = grp;
|
||||
|
||||
}
|
||||
|
||||
for (int j = 1; j < allparts.Length; j++)
|
||||
@@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
|
||||
rootGroup.ScheduleGroupForFullUpdate();
|
||||
pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false);
|
||||
pos
|
||||
= m_scene.GetNewRezLocation(
|
||||
Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false);
|
||||
|
||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
|
||||
@@ -43,21 +43,29 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
/// <summary>
|
||||
/// SimulatorFeatures capability. This is required for uploading Mesh.
|
||||
/// SimulatorFeatures capability.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is required for uploading Mesh.
|
||||
/// Since is accepts an open-ended response, we also send more information
|
||||
/// for viewers that care to interpret it.
|
||||
///
|
||||
/// NOTE: Part of this code was adapted from the Aurora project, specifically
|
||||
/// the normal part of the response in the capability handler.
|
||||
/// </summary>
|
||||
///
|
||||
/// </remarks>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class SimulatorFeaturesModule : ISharedRegionModule
|
||||
public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule
|
||||
{
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Simulator features
|
||||
/// </summary>
|
||||
private OSDMap m_features = new OSDMap();
|
||||
|
||||
private string m_MapImageServerURL = string.Empty;
|
||||
private string m_SearchURL = string.Empty;
|
||||
|
||||
@@ -66,18 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["SimulatorFeatures"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
if (config != null)
|
||||
{
|
||||
m_MapImageServerURL = m_MapImageServerURL.Trim();
|
||||
if (!m_MapImageServerURL.EndsWith("/"))
|
||||
m_MapImageServerURL = m_MapImageServerURL + "/";
|
||||
m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
{
|
||||
m_MapImageServerURL = m_MapImageServerURL.Trim();
|
||||
if (!m_MapImageServerURL.EndsWith("/"))
|
||||
m_MapImageServerURL = m_MapImageServerURL + "/";
|
||||
}
|
||||
|
||||
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
|
||||
}
|
||||
|
||||
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
|
||||
AddDefaultFeatures();
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
@@ -110,43 +120,83 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Add default features
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: These should be added from other modules rather than hardcoded.
|
||||
/// </remarks>
|
||||
private void AddDefaultFeatures()
|
||||
{
|
||||
lock (m_features)
|
||||
{
|
||||
m_features["MeshRezEnabled"] = true;
|
||||
m_features["MeshUploadEnabled"] = true;
|
||||
m_features["MeshXferEnabled"] = true;
|
||||
m_features["PhysicsMaterialsEnabled"] = true;
|
||||
|
||||
OSDMap typesMap = new OSDMap();
|
||||
typesMap["convex"] = true;
|
||||
typesMap["none"] = true;
|
||||
typesMap["prim"] = true;
|
||||
m_features["PhysicsShapeTypes"] = typesMap;
|
||||
|
||||
// Extra information for viewers that want to use it
|
||||
OSDMap gridServicesMap = new OSDMap();
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
gridServicesMap["map-server-url"] = m_MapImageServerURL;
|
||||
if (m_SearchURL != string.Empty)
|
||||
gridServicesMap["search"] = m_SearchURL;
|
||||
m_features["GridServices"] = gridServicesMap;
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures);
|
||||
IRequestHandler reqHandler
|
||||
= new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);
|
||||
|
||||
caps.RegisterHandler("SimulatorFeatures", reqHandler);
|
||||
}
|
||||
|
||||
private Hashtable SimulatorFeatures(Hashtable mDhttpMethod)
|
||||
public void AddFeature(string name, OSD value)
|
||||
{
|
||||
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
|
||||
OSDMap data = new OSDMap();
|
||||
data["MeshRezEnabled"] = true;
|
||||
data["MeshUploadEnabled"] = true;
|
||||
data["MeshXferEnabled"] = true;
|
||||
data["PhysicsMaterialsEnabled"] = true;
|
||||
lock (m_features)
|
||||
m_features[name] = value;
|
||||
}
|
||||
|
||||
OSDMap typesMap = new OSDMap();
|
||||
typesMap["convex"] = true;
|
||||
typesMap["none"] = true;
|
||||
typesMap["prim"] = true;
|
||||
data["PhysicsShapeTypes"] = typesMap;
|
||||
public bool RemoveFeature(string name)
|
||||
{
|
||||
lock (m_features)
|
||||
return m_features.Remove(name);
|
||||
}
|
||||
|
||||
// Extra information for viewers that want to use it
|
||||
OSDMap gridServicesMap = new OSDMap();
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
gridServicesMap["map-server-url"] = m_MapImageServerURL;
|
||||
if (m_SearchURL != string.Empty)
|
||||
gridServicesMap["search"] = m_SearchURL;
|
||||
data["GridServices"] = gridServicesMap;
|
||||
public bool TryGetFeature(string name, out OSD value)
|
||||
{
|
||||
lock (m_features)
|
||||
return m_features.TryGetValue(name, out value);
|
||||
}
|
||||
|
||||
public OSDMap GetFeatures()
|
||||
{
|
||||
lock (m_features)
|
||||
return new OSDMap(m_features);
|
||||
}
|
||||
|
||||
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod)
|
||||
{
|
||||
// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
|
||||
|
||||
//Send back data
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 200;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
|
||||
|
||||
lock (m_features)
|
||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public event ObjectAttach OnObjectAttach;
|
||||
public event ObjectDeselect OnObjectDetach;
|
||||
public event ObjectDrop OnObjectDrop;
|
||||
public event GenericCall1 OnCompleteMovementToRegion;
|
||||
public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
|
||||
public event UpdateAgent OnPreAgentUpdate;
|
||||
public event UpdateAgent OnAgentUpdate;
|
||||
public event AgentRequestSit OnAgentRequestSit;
|
||||
@@ -232,7 +232,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public event ScriptReset OnScriptReset;
|
||||
public event GetScriptRunning OnGetScriptRunning;
|
||||
public event SetScriptRunning OnSetScriptRunning;
|
||||
public event UpdateVector OnAutoPilotGo;
|
||||
public event Action<Vector3, bool> OnAutoPilotGo;
|
||||
public event TerrainUnacked OnUnackedTerrain;
|
||||
public event ActivateGesture OnActivateGesture;
|
||||
public event DeactivateGesture OnDeactivateGesture;
|
||||
@@ -534,7 +534,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_udpServer.Flush(m_udpClient);
|
||||
|
||||
// Remove ourselves from the scene
|
||||
m_scene.RemoveClient(AgentId);
|
||||
m_scene.RemoveClient(AgentId, true);
|
||||
|
||||
// We can't reach into other scenes and close the connection
|
||||
// We need to do this over grid communications
|
||||
@@ -596,22 +596,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a handler for the given packet type.
|
||||
/// </summary>
|
||||
/// <remarks>The packet is handled on its own thread. If packets must be handled in the order in which thye
|
||||
/// are received then please us ethe synchronous version of this method.</remarks>
|
||||
/// <param name="packetType"></param>
|
||||
/// <param name="handler"></param>
|
||||
/// <returns>true if the handler was added. This is currently always the case.</returns>
|
||||
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler)
|
||||
{
|
||||
return AddLocalPacketHandler(packetType, handler, true);
|
||||
}
|
||||
|
||||
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool async)
|
||||
/// <summary>
|
||||
/// Add a handler for the given packet type.
|
||||
/// </summary>
|
||||
/// <param name="packetType"></param>
|
||||
/// <param name="handler"></param>
|
||||
/// <param name="doAsync">
|
||||
/// If true, when the packet is received it is handled on its own thread rather than on the main inward bound
|
||||
/// packet handler thread. This vastly increases respnosiveness but some packets need to be handled
|
||||
/// synchronously.
|
||||
/// </param>
|
||||
/// <returns>true if the handler was added. This is currently always the case.</returns>
|
||||
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync)
|
||||
{
|
||||
bool result = false;
|
||||
lock (m_packetHandlers)
|
||||
{
|
||||
if (!m_packetHandlers.ContainsKey(packetType))
|
||||
{
|
||||
m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = async });
|
||||
m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync });
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -694,7 +714,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
m_scene.AddNewClient(this);
|
||||
m_scene.AddNewClient(this, PresenceType.User);
|
||||
|
||||
RefreshGroupMembership();
|
||||
}
|
||||
@@ -4800,7 +4820,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
SceneObjectPart part = (SceneObjectPart)entity;
|
||||
|
||||
attachPoint = part.AttachmentPoint;
|
||||
attachPoint = part.ParentGroup.AttachmentPoint;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}",
|
||||
// attachPoint, part.Name, part.LocalId, Name);
|
||||
|
||||
collisionPlane = Vector4.Zero;
|
||||
position = part.RelativePosition;
|
||||
velocity = part.Velocity;
|
||||
@@ -4957,17 +4982,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
//update.JointType = 0;
|
||||
update.Material = data.Material;
|
||||
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
||||
if (data.IsAttachment)
|
||||
if (data.ParentGroup.IsAttachment)
|
||||
{
|
||||
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
|
||||
update.State = (byte)((data.AttachmentPoint % 16) * 16 + (data.AttachmentPoint / 16));
|
||||
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
|
||||
}
|
||||
else
|
||||
{
|
||||
update.NameValue = Utils.EmptyBytes;
|
||||
update.State = data.Shape.State;
|
||||
|
||||
// The root part state is the canonical state for all parts of the object. The other part states in the
|
||||
// case for attachments may contain conflicting values that can end up crashing the viewer.
|
||||
update.State = data.ParentGroup.RootPart.Shape.State;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending state {0} for {1} {2} to {3}",
|
||||
// update.State, data.Name, data.LocalId, Name);
|
||||
|
||||
update.ObjectData = objectData;
|
||||
update.ParentID = data.ParentID;
|
||||
update.PathBegin = data.Shape.PathBegin;
|
||||
@@ -5311,6 +5343,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
|
||||
AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
|
||||
AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
|
||||
|
||||
AddGenericPacketHandler("autopilot", HandleAutopilot);
|
||||
}
|
||||
|
||||
#region Packet Handlers
|
||||
@@ -5354,7 +5388,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
|
||||
// These should be ordered from most-likely to
|
||||
// least likely to change. I've made an initial
|
||||
@@ -5362,6 +5398,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
if (update)
|
||||
{
|
||||
// m_log.DebugFormat("[LLCLIENTVIEW]: Triggered AgentUpdate for {0}", sener.Name);
|
||||
|
||||
AgentUpdateArgs arg = new AgentUpdateArgs();
|
||||
arg.AgentID = x.AgentID;
|
||||
arg.BodyRotation = x.BodyRotation;
|
||||
@@ -6235,10 +6273,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
|
||||
{
|
||||
GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
|
||||
Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
|
||||
if (handlerCompleteMovementToRegion != null)
|
||||
{
|
||||
handlerCompleteMovementToRegion(sender);
|
||||
handlerCompleteMovementToRegion(sender, true);
|
||||
}
|
||||
handlerCompleteMovementToRegion = null;
|
||||
|
||||
@@ -11316,8 +11354,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet)
|
||||
{
|
||||
MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
|
||||
if (multipleupdate.AgentData.SessionID != SessionId) return false;
|
||||
// m_log.Debug("new multi update packet " + multipleupdate.ToString());
|
||||
|
||||
if (multipleupdate.AgentData.SessionID != SessionId)
|
||||
return false;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length);
|
||||
|
||||
Scene tScene = (Scene)m_scene;
|
||||
|
||||
for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
|
||||
@@ -11338,7 +11381,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
else
|
||||
{
|
||||
// UUID partId = part.UUID;
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
|
||||
// i, block.Type, part.Name, part.LocalId);
|
||||
|
||||
// // Do this once since fetch parts creates a new array.
|
||||
// SceneObjectPart[] parts = part.ParentGroup.Parts;
|
||||
// for (int j = 0; j < parts.Length; j++)
|
||||
// {
|
||||
// part.StoreUndoState();
|
||||
// parts[j].IgnoreUndoUpdate = true;
|
||||
// }
|
||||
|
||||
UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
|
||||
|
||||
switch (block.Type)
|
||||
@@ -11353,6 +11407,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimSinglePosition(localId, pos1, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Quaternion rot1 = new Quaternion(block.Data, 0, true);
|
||||
|
||||
@@ -11363,6 +11418,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimSingleRotation(localId, rot1, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Vector3 rotPos = new Vector3(block.Data, 0);
|
||||
Quaternion rot2 = new Quaternion(block.Data, 12, true);
|
||||
@@ -11375,6 +11431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 20:
|
||||
Vector3 scale4 = new Vector3(block.Data, 0);
|
||||
@@ -11386,8 +11443,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimScale(localId, scale4, this);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
||||
case 5:
|
||||
Vector3 scale1 = new Vector3(block.Data, 12);
|
||||
Vector3 pos11 = new Vector3(block.Data, 0);
|
||||
|
||||
@@ -11404,6 +11461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
Vector3 pos2 = new Vector3(block.Data, 0);
|
||||
|
||||
@@ -11411,10 +11469,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
if (handlerUpdateVector != null)
|
||||
{
|
||||
|
||||
handlerUpdateVector(localId, pos2, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
Quaternion rot3 = new Quaternion(block.Data, 0, true);
|
||||
|
||||
@@ -11425,6 +11483,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimRotation(localId, rot3, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
Vector3 pos3 = new Vector3(block.Data, 0);
|
||||
Quaternion rot4 = new Quaternion(block.Data, 12, true);
|
||||
@@ -11448,6 +11507,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimGroupScale(localId, scale7, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
Vector3 scale2 = new Vector3(block.Data, 12);
|
||||
Vector3 pos4 = new Vector3(block.Data, 0);
|
||||
@@ -11467,6 +11527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 29:
|
||||
Vector3 scale5 = new Vector3(block.Data, 12);
|
||||
Vector3 pos5 = new Vector3(block.Data, 0);
|
||||
@@ -11475,6 +11536,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (handlerUpdatePrimGroupScale != null)
|
||||
{
|
||||
// m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||
part.StoreUndoState(true);
|
||||
part.IgnoreUndoUpdate = true;
|
||||
handlerUpdatePrimGroupScale(localId, scale5, this);
|
||||
handlerUpdateVector = OnUpdatePrimGroupPosition;
|
||||
|
||||
@@ -11482,8 +11545,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
handlerUpdateVector(localId, pos5, this);
|
||||
}
|
||||
|
||||
part.IgnoreUndoUpdate = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 21:
|
||||
Vector3 scale6 = new Vector3(block.Data, 12);
|
||||
Vector3 pos6 = new Vector3(block.Data, 0);
|
||||
@@ -11491,6 +11558,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
handlerUpdatePrimScale = OnUpdatePrimScale;
|
||||
if (handlerUpdatePrimScale != null)
|
||||
{
|
||||
part.StoreUndoState(false);
|
||||
part.IgnoreUndoUpdate = true;
|
||||
|
||||
// m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||
handlerUpdatePrimScale(localId, scale6, this);
|
||||
handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
|
||||
@@ -11498,15 +11568,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
handlerUpdatePrimSinglePosition(localId, pos6, this);
|
||||
}
|
||||
|
||||
part.IgnoreUndoUpdate = false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
m_log.Debug("[CLIENT] MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
|
||||
m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
|
||||
break;
|
||||
}
|
||||
|
||||
// for (int j = 0; j < parts.Length; j++)
|
||||
// parts[j].IgnoreUndoUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11666,55 +11743,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Breaks down the genericMessagePacket into specific events
|
||||
/// </summary>
|
||||
/// <param name="gmMethod"></param>
|
||||
/// <param name="gmInvoice"></param>
|
||||
/// <param name="gmParams"></param>
|
||||
public void DecipherGenericMessage(string gmMethod, UUID gmInvoice, GenericMessagePacket.ParamListBlock[] gmParams)
|
||||
protected void HandleAutopilot(Object sender, string method, List<String> args)
|
||||
{
|
||||
switch (gmMethod)
|
||||
{
|
||||
case "autopilot":
|
||||
float locx;
|
||||
float locy;
|
||||
float locz;
|
||||
float locx = 0;
|
||||
float locy = 0;
|
||||
float locz = 0;
|
||||
uint regionX = 0;
|
||||
uint regionY = 0;
|
||||
|
||||
try
|
||||
{
|
||||
uint regionX;
|
||||
uint regionY;
|
||||
Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
|
||||
locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - regionX;
|
||||
locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - regionY;
|
||||
locz = Convert.ToSingle(Utils.BytesToString(gmParams[2].Parameter));
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
m_log.Error("[CLIENT]: Invalid autopilot request");
|
||||
return;
|
||||
}
|
||||
Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY);
|
||||
locx = Convert.ToSingle(args[0]) - (float)regionX;
|
||||
locy = Convert.ToSingle(args[1]) - (float)regionY;
|
||||
locz = Convert.ToSingle(args[2]);
|
||||
|
||||
UpdateVector handlerAutoPilotGo = OnAutoPilotGo;
|
||||
if (handlerAutoPilotGo != null)
|
||||
{
|
||||
handlerAutoPilotGo(0, new Vector3(locx, locy, locz), this);
|
||||
}
|
||||
m_log.InfoFormat("[CLIENT]: Client Requests autopilot to position <{0},{1},{2}>", locx, locy, locz);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
m_log.Debug("[CLIENT]: Unknown Generic Message, Method: " + gmMethod + ". Invoice: " + gmInvoice + ". Dumping Params:");
|
||||
for (int hi = 0; hi < gmParams.Length; hi++)
|
||||
{
|
||||
Console.WriteLine(gmParams[hi].ToString());
|
||||
}
|
||||
//gmpack.MethodData.
|
||||
break;
|
||||
|
||||
}
|
||||
Action<Vector3, bool> handlerAutoPilotGo = OnAutoPilotGo;
|
||||
if (handlerAutoPilotGo != null)
|
||||
handlerAutoPilotGo(new Vector3(locx, locy, locz), false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Int32 m_counter = 0;
|
||||
|
||||
private Int32 m_identifier;
|
||||
// private Int32 m_identifier;
|
||||
|
||||
/// <summary>
|
||||
/// Number of ticks (ms) per quantum, drip rate and max burst
|
||||
@@ -173,7 +173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// second. If zero, the bucket always remains full</param>
|
||||
public TokenBucket(TokenBucket parent, Int64 dripRate)
|
||||
{
|
||||
m_identifier = m_counter++;
|
||||
// m_identifier = m_counter++;
|
||||
m_counter++;
|
||||
|
||||
Parent = parent;
|
||||
RequestedDripRate = dripRate;
|
||||
@@ -320,7 +321,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public class AdaptiveTokenBucket : TokenBucket
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The minimum rate for flow control. Minimum drip rate is one
|
||||
|
||||
Reference in New Issue
Block a user