From 43a4b7b735f1663fbbb0b74addf82e576b9e5042 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 19 Oct 2010 01:22:31 +0100 Subject: [PATCH 01/20] COmmented the wrong line instead, now I commented them all to be on the safe side --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index ef012d53eb..7b94a8131a 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1363,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } else { - m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); +// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); reader.ReadOuterXml(); // ignore } @@ -1467,7 +1467,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization p(shape, reader); else { - m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); +// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); reader.ReadOuterXml(); } } From b9bef50852cecab6e6fba75d44d4ee2306072299 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Oct 2010 23:21:34 +0100 Subject: [PATCH 02/20] Display more information when xmlrpcgroupsserver comms fails Improve debugging messages --- .../XmlRpcGroups/GroupsMessagingModule.cs | 17 +++++++++-------- .../XmlRpcGroupsServicesConnectorModule.cs | 10 +++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 185d44de80..d178e183c4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -212,12 +212,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public void SendMessageToGroup(GridInstantMessage im, UUID groupID) { + List groupMembers = m_groupData.GetGroupMembers(UUID.Zero, groupID); + if (m_debugEnabled) - m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - - foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID)) - { + m_log.DebugFormat( + "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} members", + groupID, groupMembers.Count); + + foreach (GroupMembersData member in groupMembers) + { if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) { // Don't deliver messages to people who have dropped this session @@ -263,9 +266,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups void OnClientLogin(IClientAPI client) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); - - + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); } private void OnNewClient(IClientAPI client) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 5fabbb03dd..2631ac10d3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -641,11 +641,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } return Roles; - } - - public List GetGroupMembers(UUID requestingAgentID, UUID GroupID) { Hashtable param = new Hashtable(); @@ -988,8 +985,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", e.ToString()); + m_log.ErrorFormat( + "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}", + function, m_groupsServerURI); + + m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace); foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) { From 478b44f231841aafb2ea19d2b21d0d3826456ad7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Oct 2010 01:54:51 +0100 Subject: [PATCH 03/20] Pass in requesting agent ID when GetGroupMembers is called in the XMLRPC groups module This allows the groups xmlrpc server to act appropriately if the requesting agent has permission to see all group members Not sure why this wasn't being done before... --- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 4 ++-- .../OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index d178e183c4..25dba7f45e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -212,11 +212,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public void SendMessageToGroup(GridInstantMessage im, UUID groupID) { - List groupMembers = m_groupData.GetGroupMembers(UUID.Zero, groupID); + List groupMembers = m_groupData.GetGroupMembers(new UUID(im.fromAgentID), groupID); if (m_debugEnabled) m_log.DebugFormat( - "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} members", + "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", groupID, groupMembers.Count); foreach (GroupMembersData member in groupMembers) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 6f044e0086..0c8113e604 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -599,7 +599,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public List GroupMembersRequest(IClientAPI remoteClient, UUID groupID) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + if (m_debugEnabled) + m_log.DebugFormat( + "[GROUPS]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); + List data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); if (m_debugEnabled) From 37a6be7ca9938ae4d3828f277b78f623fa84c9e1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Oct 2010 02:20:47 +0100 Subject: [PATCH 04/20] Stop the InventoryTransferModule logging every IM notification it receives, even if they are nothing to do with it. --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index d1274e9cf1..e3d49692f3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -159,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { - m_log.DebugFormat( - "[INVENTORY TRANSFER]: {0} IM type received from {1}", - (InstantMessageDialog)im.dialog, client.Name); +// m_log.DebugFormat( +// "[INVENTORY TRANSFER]: {0} IM type received from {1}", +// (InstantMessageDialog)im.dialog, client.Name); Scene scene = FindClientScene(client.AgentId); From e561070d3f273048fc52ea1961a38d3f5d6803e2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Oct 2010 02:28:10 +0100 Subject: [PATCH 05/20] Add 'contributors' notice for zlib.net.dll to keep track of its origin and version. Dahlia, please correct the details if they're wrong. --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 24432446c8..38343a4bbc 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -167,6 +167,7 @@ This software uses components from the following developers: * GlynnTucker.Cache (http://gtcache.sourceforge.net/) * NDesk.Options 0.2.1 (http://www.ndesk.org/Options) * Json.NET 3.5 Release 6. The binary used is actually Newtonsoft.Json.Net20.dll for Mono 2.4 compatability (http://james.newtonking.com/projects/json-net.aspx) +* zlib.net for C# 1.0.4 (http://www.componentace.com/zlib_.NET.htm) Some plugins are based on Cable Beach Cable Beach is Copyright (c) 2008 Intel Corporation From 158e43d4fde8c11454b8dd605e59bf17050ac57d Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Mon, 18 Oct 2010 23:47:35 -0400 Subject: [PATCH 06/20] * Almost complete implementation of UploadObjectAsset cap. all meshes get uploaded but they're improperly positioned/oriented at the moment. --- .../ObjectCaps/UploadObjectAssetModule.cs | 301 ++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs new file mode 100644 index 0000000000..f1f219bbb7 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -0,0 +1,301 @@ +/* + * 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; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using Mono.Addins; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenMetaverse.Messages.Linden; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OSD = OpenMetaverse.StructuredData.OSD; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; +using OpenSim.Framework.Capabilities; + +namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class UploadObjectAssetModule : INonSharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; + + #region IRegionModuleBase Members + + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + + } + + public void AddRegion(Scene pScene) + { + m_scene = pScene; + } + + public void RemoveRegion(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + #endregion + + + #region IRegionModule Members + + + + public void Close() { } + + public string Name { get { return "UploadObjectAssetModuleModule"; } } + + + public void RegisterCaps(UUID agentID, Caps caps) + { + UUID capID = UUID.Random(); + + m_log.Info("[UploadObjectAssetModule]: /CAPS/" + capID); + caps.RegisterHandler("UploadObjectAsset", + new RestHTTPHandler("POST", "/CAPS/OA/" + capID + "/", + delegate(Hashtable m_dhttpMethod) + { + return ProcessAdd(m_dhttpMethod, agentID, caps); + })); + /* + caps.RegisterHandler("NewFileAgentInventoryVariablePrice", + + new LLSDStreamhandler("POST", + "/CAPS/" + capID.ToString(), + delegate(LLSDAssetUploadRequest req) + { + return NewAgentInventoryRequest(req,agentID); + })); + */ + + } + + #endregion + + public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) + { + Hashtable responsedata = new Hashtable(); + responsedata["int_response_code"] = 400; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Request wasn't what was expected"; + ScenePresence avatar; + + if (!m_scene.TryGetScenePresence(AgentId, out avatar)) + return responsedata; + + OSDMap r = (OSDMap)OSDParser.Deserialize((string)request["requestbody"]); + UploadObjectAssetMessage message = new UploadObjectAssetMessage(); + try + { + message.Deserialize(r); + + } + catch (Exception ex) + { + m_log.Error("[UploadObjectAssetModule]: Error deserializing message"); + // TODO: Remove this ugly multiline-friendly debug! + Console.WriteLine(ex.ToString()); + message = null; + } + + if (message == null) + { + responsedata["int_response_code"] = 400; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = + "errorError parsing Object"; + + return responsedata; + } + + Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation); + Quaternion rot = Quaternion.Identity; + + + + SceneObjectGroup grp = new SceneObjectGroup(); + for (int i = 0; i < message.Objects.Length; i++) + { + UploadObjectAssetMessage.Object obj = message.Objects[i]; + PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); + + // Combine the extraparams data into it's ugly blob again.... + int bytelength = 0; + for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) + { + bytelength += obj.ExtraParams[extparams].ExtraParamData.Length; + } + byte[] extraparams = new byte[bytelength]; + int position = 0; + + for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) + { + Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, obj.ExtraParams[extparams].ExtraParamData.Length); + + position += obj.ExtraParams[extparams].ExtraParamData.Length; + } + + pbs.ExtraParams = extraparams; + + pbs.PathBegin = (ushort)obj.PathBegin; + pbs.PathCurve = (byte)obj.PathCurve; + pbs.PathEnd = (ushort)obj.PathEnd; + pbs.PathRadiusOffset = (sbyte)obj.RadiusOffset; + pbs.PathRevolutions = (byte)obj.Revolutions; + pbs.PathScaleX = (byte)obj.ScaleX; + pbs.PathScaleY = (byte)obj.ScaleY; + pbs.PathShearX = (byte)obj.ShearX; + pbs.PathShearY = (byte)obj.ShearY; + pbs.PathSkew = (sbyte)obj.Skew; + pbs.PathTaperX = (sbyte)obj.TaperX; + pbs.PathTaperY = (sbyte)obj.TaperY; + pbs.PathTwist = (sbyte)obj.Twist; + pbs.PathTwistBegin = (sbyte)obj.TwistBegin; + pbs.HollowShape = (HollowShape)obj.ProfileHollow; + pbs.PCode = (byte)PCode.Prim; + pbs.ProfileBegin = (ushort)obj.ProfileBegin; + pbs.ProfileCurve = (byte)obj.ProfileCurve; + pbs.ProfileEnd = (ushort)obj.ProfileEnd; + pbs.Scale = obj.Scale; + pbs.State = (byte)0; + SceneObjectPart prim = new SceneObjectPart(); + prim.UUID = UUID.Random(); + prim.CreatorID = AgentId; + prim.OwnerID = AgentId; + prim.GroupID = obj.GroupID; + prim.LastOwnerID = prim.OwnerID; + prim.CreationDate = Util.UnixTimeSinceEpoch(); + prim.Name = obj.Name; + prim.Description = ""; + + prim.PayPrice[0] = -2; + prim.PayPrice[1] = -2; + prim.PayPrice[2] = -2; + prim.PayPrice[3] = -2; + prim.PayPrice[4] = -2; + Primitive.TextureEntry tmp = new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f")); + + for (int j = 0; j < obj.Faces.Length; j++) + { + UploadObjectAssetMessage.Object.Face face = obj.Faces[j]; + + Primitive.TextureEntryFace primFace = tmp.CreateFace((uint)j); + + primFace.Bump = face.Bump; + primFace.RGBA = face.Color; + primFace.Fullbright = face.Fullbright; + primFace.Glow = face.Glow; + primFace.TextureID = face.ImageID; + primFace.Rotation = face.ImageRot; + primFace.MediaFlags = ((face.MediaFlags & 1) != 0); + + primFace.OffsetU = face.OffsetS; + primFace.OffsetV = face.OffsetT; + primFace.RepeatU = face.ScaleS; + primFace.RepeatV = face.ScaleT; + primFace.TexMapType = (MappingType)(face.MediaFlags & 6); + } + pbs.TextureEntry = tmp.GetBytes(); + prim.Shape = pbs; + prim.Scale = obj.Scale; + prim.Shape.SculptEntry = true; + prim.Shape.SculptTexture = obj.SculptID; + prim.Shape.SculptType = (byte) SculptType.Mesh; + + if (i == 0) + { + grp.SetRootPart(prim); + prim.ParentID = 0; + } + else + { + prim.SetParent(grp); + grp.AddPart(prim); + } + + } + pos = m_scene.GetNewRezLocation(Vector3.Zero, pos, UUID.Zero, rot, (byte)1 , 1 , true, grp.GroupScale(), false); + grp.AttachToScene(m_scene); + grp.AbsolutePosition = pos; + grp.ClearPartAttachmentData(); + grp.RootPart.IsAttachment = false; + + if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) + { + m_scene.AddSceneObject(grp); + } + grp.ScheduleGroupForFullUpdate(); + responsedata["int_response_code"] = 200; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = String.Format("local_id{0}", ConvertUintToBytes(grp.LocalId)); + + return responsedata; + + + } + private string ConvertUintToBytes(uint val) + { + byte[] resultbytes = Utils.UIntToBytes(val); + if (BitConverter.IsLittleEndian) + Array.Reverse(resultbytes); + return String.Format("{0}", Convert.ToBase64String(resultbytes)); + } + } +} From b2c1a1c9bd7a6673eda618b39124f28ccf10e7bf Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Tue, 19 Oct 2010 01:53:56 -0400 Subject: [PATCH 07/20] * This concludes UploadObjectAsset for now until the permissions and physics shape are added to the message serialization. * You should now be able to upload multiple mesh collada mesh objects. They should appear in front of you (or on top of you!) when you upload them. * Once again, thanks to John Hurliman and Latif Khalifa for insight and smxy for cheering me on :D --- .../ObjectCaps/UploadObjectAssetModule.cs | 124 +++++++++++------- 1 file changed, 76 insertions(+), 48 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs index f1f219bbb7..d5c6e9d8b4 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -126,6 +126,14 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps #endregion + + /// + /// Parses ad request + /// + /// + /// + /// + /// public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) { Hashtable responsedata = new Hashtable(); @@ -147,9 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps } catch (Exception ex) { - m_log.Error("[UploadObjectAssetModule]: Error deserializing message"); - // TODO: Remove this ugly multiline-friendly debug! - Console.WriteLine(ex.ToString()); + m_log.Error("[UploadObjectAssetModule]: Error deserializing message " + ex.ToString()); message = null; } @@ -163,18 +169,25 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps return responsedata; } - + Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation); Quaternion rot = Quaternion.Identity; + Vector3 rootpos = Vector3.Zero; + Quaternion rootrot = Quaternion.Identity; - - - SceneObjectGroup grp = new SceneObjectGroup(); + SceneObjectGroup rootGroup = null; + SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length]; for (int i = 0; i < message.Objects.Length; i++) { UploadObjectAssetMessage.Object obj = message.Objects[i]; PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); + if (i == 0) + { + rootpos = obj.Position; + rootrot = obj.Rotation; + + } // Combine the extraparams data into it's ugly blob again.... int bytelength = 0; for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) @@ -186,34 +199,35 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) { - Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, obj.ExtraParams[extparams].ExtraParamData.Length); + Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, + obj.ExtraParams[extparams].ExtraParamData.Length); position += obj.ExtraParams[extparams].ExtraParamData.Length; } pbs.ExtraParams = extraparams; - pbs.PathBegin = (ushort)obj.PathBegin; - pbs.PathCurve = (byte)obj.PathCurve; - pbs.PathEnd = (ushort)obj.PathEnd; - pbs.PathRadiusOffset = (sbyte)obj.RadiusOffset; - pbs.PathRevolutions = (byte)obj.Revolutions; - pbs.PathScaleX = (byte)obj.ScaleX; - pbs.PathScaleY = (byte)obj.ScaleY; - pbs.PathShearX = (byte)obj.ShearX; - pbs.PathShearY = (byte)obj.ShearY; - pbs.PathSkew = (sbyte)obj.Skew; - pbs.PathTaperX = (sbyte)obj.TaperX; - pbs.PathTaperY = (sbyte)obj.TaperY; - pbs.PathTwist = (sbyte)obj.Twist; - pbs.PathTwistBegin = (sbyte)obj.TwistBegin; - pbs.HollowShape = (HollowShape)obj.ProfileHollow; - pbs.PCode = (byte)PCode.Prim; - pbs.ProfileBegin = (ushort)obj.ProfileBegin; - pbs.ProfileCurve = (byte)obj.ProfileCurve; - pbs.ProfileEnd = (ushort)obj.ProfileEnd; + pbs.PathBegin = (ushort) obj.PathBegin; + pbs.PathCurve = (byte) obj.PathCurve; + pbs.PathEnd = (ushort) obj.PathEnd; + pbs.PathRadiusOffset = (sbyte) obj.RadiusOffset; + pbs.PathRevolutions = (byte) obj.Revolutions; + pbs.PathScaleX = (byte) obj.ScaleX; + pbs.PathScaleY = (byte) obj.ScaleY; + pbs.PathShearX = (byte) obj.ShearX; + pbs.PathShearY = (byte) obj.ShearY; + pbs.PathSkew = (sbyte) obj.Skew; + pbs.PathTaperX = (sbyte) obj.TaperX; + pbs.PathTaperY = (sbyte) obj.TaperY; + pbs.PathTwist = (sbyte) obj.Twist; + pbs.PathTwistBegin = (sbyte) obj.TwistBegin; + pbs.HollowShape = (HollowShape) obj.ProfileHollow; + pbs.PCode = (byte) PCode.Prim; + pbs.ProfileBegin = (ushort) obj.ProfileBegin; + pbs.ProfileCurve = (byte) obj.ProfileCurve; + pbs.ProfileEnd = (ushort) obj.ProfileEnd; pbs.Scale = obj.Scale; - pbs.State = (byte)0; + pbs.State = (byte) 0; SceneObjectPart prim = new SceneObjectPart(); prim.UUID = UUID.Random(); prim.CreatorID = AgentId; @@ -229,13 +243,14 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps prim.PayPrice[2] = -2; prim.PayPrice[3] = -2; prim.PayPrice[4] = -2; - Primitive.TextureEntry tmp = new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f")); + Primitive.TextureEntry tmp = + new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f")); for (int j = 0; j < obj.Faces.Length; j++) { UploadObjectAssetMessage.Object.Face face = obj.Faces[j]; - Primitive.TextureEntryFace primFace = tmp.CreateFace((uint)j); + Primitive.TextureEntryFace primFace = tmp.CreateFace((uint) j); primFace.Bump = face.Bump; primFace.RGBA = face.Color; @@ -249,7 +264,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps primFace.OffsetV = face.OffsetT; primFace.RepeatU = face.ScaleS; primFace.RepeatV = face.ScaleT; - primFace.TexMapType = (MappingType)(face.MediaFlags & 6); + primFace.TexMapType = (MappingType) (face.MediaFlags & 6); } pbs.TextureEntry = tmp.GetBytes(); prim.Shape = pbs; @@ -257,34 +272,47 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps prim.Shape.SculptEntry = true; prim.Shape.SculptTexture = obj.SculptID; prim.Shape.SculptType = (byte) SculptType.Mesh; - + + SceneObjectGroup grp = new SceneObjectGroup(); + + grp.SetRootPart(prim); + prim.ParentID = 0; if (i == 0) { - grp.SetRootPart(prim); - prim.ParentID = 0; + rootGroup = grp; + } - else + grp.AttachToScene(m_scene); + grp.AbsolutePosition = obj.Position; + prim.RotationOffset = obj.Rotation; + + grp.RootPart.IsAttachment = false; + // Required for linking + grp.RootPart.UpdateFlag = 0; + + if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) { - prim.SetParent(grp); - grp.AddPart(prim); + m_scene.AddSceneObject(grp); + grp.AbsolutePosition = obj.Position; } + allparts[i] = grp; + + } - } - pos = m_scene.GetNewRezLocation(Vector3.Zero, pos, UUID.Zero, rot, (byte)1 , 1 , true, grp.GroupScale(), false); - grp.AttachToScene(m_scene); - grp.AbsolutePosition = pos; - grp.ClearPartAttachmentData(); - grp.RootPart.IsAttachment = false; - - if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) + for (int j = 1; j < allparts.Length; j++) { - m_scene.AddSceneObject(grp); + rootGroup.RootPart.UpdateFlag = 0; + allparts[j].RootPart.UpdateFlag = 0; + rootGroup.LinkToGroup(allparts[j]); } - grp.ScheduleGroupForFullUpdate(); + + rootGroup.ScheduleGroupForFullUpdate(); + 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"; responsedata["keepalive"] = false; - responsedata["str_response_string"] = String.Format("local_id{0}", ConvertUintToBytes(grp.LocalId)); + responsedata["str_response_string"] = String.Format("local_id{0}", ConvertUintToBytes(allparts[0].LocalId)); return responsedata; From 684449f7832fbb6b1811c303f25d08cdfc3dd6d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 00:04:02 -0700 Subject: [PATCH 08/20] Added TextureAnimation and ParticleSystem to serialization. --- .../Serialization/SceneObjectSerializer.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7b94a8131a..b6aa31ba43 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -318,6 +318,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); + m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); + m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); #endregion #region TaskInventoryXmlProcessors initialization @@ -663,6 +665,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); } + + private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) + { + obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); + } + + private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader) + { + obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); + } #endregion #region TaskInventoryXmlProcessors @@ -1128,6 +1140,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null) writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); + WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); + WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); writer.WriteEndElement(); } @@ -1161,6 +1175,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); } + static void WriteBytes(XmlTextWriter writer, string name, byte[] data) + { + writer.WriteStartElement(name); + byte[] d; + if (data != null) + d = data; + else + d = Utils.EmptyBytes; + writer.WriteBase64(d, 0, d.Length); + writer.WriteEndElement(); // name + + } + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) { if (tinv.Count > 0) // otherwise skip this From 3b2d9a99390e44d99bf00a6be685c08e307b9e42 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 14:37:03 -0700 Subject: [PATCH 09/20] Added code to quaternion deserialization to try to cope with an exception seen in Wright Plaza related to SitTargetOrientation. 17:23:05 - [SceneObjectSerializer]: exception while parsing SitTargetOrientation: System.Xml.XmlException: Expecting X tag from namespace , got w and instead Line 1, position 30064. --- .../Serialization/SceneObjectSerializer.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b6aa31ba43..3a482999d4 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1438,10 +1438,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization Quaternion quat; reader.ReadStartElement(name); - quat.X = reader.ReadElementContentAsFloat("X", String.Empty); - quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); - quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); - quat.W = reader.ReadElementContentAsFloat("W", String.Empty); + if (reader.Name == "X") // assume X, Y, Z, W order + { + quat.X = reader.ReadElementContentAsFloat("X", String.Empty); + quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); + quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); + quat.W = reader.ReadElementContentAsFloat("W", String.Empty); + } + else // assume w, x, y, z + { + quat.W = reader.ReadElementContentAsFloat("w", String.Empty); + quat.X = reader.ReadElementContentAsFloat("x", String.Empty); + quat.Y = reader.ReadElementContentAsFloat("y", String.Empty); + quat.Z = reader.ReadElementContentAsFloat("z", String.Empty); + } + reader.ReadEndElement(); return quat; From 8acac3d07f63769051d5aad9a54953d033210f48 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 15:07:15 -0700 Subject: [PATCH 10/20] Another take related to the previous commit. --- .../Serialization/SceneObjectSerializer.cs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3a482999d4..58ec8a6c06 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1435,22 +1435,26 @@ namespace OpenSim.Region.Framework.Scenes.Serialization static Quaternion ReadQuaternion(XmlTextReader reader, string name) { - Quaternion quat; + Quaternion quat = new Quaternion(); reader.ReadStartElement(name); - if (reader.Name == "X") // assume X, Y, Z, W order + while (reader.NodeType != XmlNodeType.EndElement) { - quat.X = reader.ReadElementContentAsFloat("X", String.Empty); - quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); - quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); - quat.W = reader.ReadElementContentAsFloat("W", String.Empty); - } - else // assume w, x, y, z - { - quat.W = reader.ReadElementContentAsFloat("w", String.Empty); - quat.X = reader.ReadElementContentAsFloat("x", String.Empty); - quat.Y = reader.ReadElementContentAsFloat("y", String.Empty); - quat.Z = reader.ReadElementContentAsFloat("z", String.Empty); + switch (reader.Name.ToLower()) + { + case "x": + quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + case "y": + quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + case "z": + quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + case "w": + quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + } } reader.ReadEndElement(); From 8731c2be11085469c051dfea067b930520059a6a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 15:16:29 -0700 Subject: [PATCH 11/20] It looks like Vector3s also got written down in lower case at some point in time. Added code to account for that. 17:45:59 - [SceneObjectSerializer]: exception while parsing SitTargetPosition: System.Xml.XmlException: Expecting X tag from namespace , got x and instead Line 1, position 2838. --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 58ec8a6c06..044b5991d2 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1425,9 +1425,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization Vector3 vec; reader.ReadStartElement(name); - vec.X = reader.ReadElementContentAsFloat("X", String.Empty); - vec.Y = reader.ReadElementContentAsFloat("Y", String.Empty); - vec.Z = reader.ReadElementContentAsFloat("Z", String.Empty); + vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x + vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y + vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z reader.ReadEndElement(); return vec; From edce4e9c67b1c3b90474951532e78a2ea07e69fd Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 20 Oct 2010 00:40:05 -0400 Subject: [PATCH 12/20] * This removes an ugly extraparams hack that I used and makes UploadObjectAsset into a generic linkset upload tool. --- .../ObjectCaps/UploadObjectAssetModule.cs | 81 ++++++++++++++----- 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs index d5c6e9d8b4..465da290f0 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -47,6 +47,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; using OSD = OpenMetaverse.StructuredData.OSD; using OSDMap = OpenMetaverse.StructuredData.OSDMap; using OpenSim.Framework.Capabilities; +using ExtraParamType = OpenMetaverse.ExtraParamType; namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps { @@ -188,25 +189,71 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps rootrot = obj.Rotation; } + + // Combine the extraparams data into it's ugly blob again.... - int bytelength = 0; + //int bytelength = 0; + //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) + //{ + // bytelength += obj.ExtraParams[extparams].ExtraParamData.Length; + //} + //byte[] extraparams = new byte[bytelength]; + //int position = 0; + + + + //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) + //{ + // Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, + // obj.ExtraParams[extparams].ExtraParamData.Length); + // + // position += obj.ExtraParams[extparams].ExtraParamData.Length; + // } + + //pbs.ExtraParams = extraparams; for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) { - bytelength += obj.ExtraParams[extparams].ExtraParamData.Length; + UploadObjectAssetMessage.Object.ExtraParam extraParam = obj.ExtraParams[extparams]; + switch ((ushort)extraParam.Type) + { + case (ushort)ExtraParamType.Sculpt: + pbs.SculptEntry = true; + pbs.SculptTexture = obj.SculptID; + pbs.SculptType = (byte)SculptType.Mesh; + + break; + case (ushort)ExtraParamType.Flexible: + Primitive.FlexibleData flex = new Primitive.FlexibleData(extraParam.ExtraParamData, 0); + pbs.FlexiEntry = true; + pbs.FlexiDrag = flex.Drag; + pbs.FlexiForceX = flex.Force.X; + pbs.FlexiForceY = flex.Force.Y; + pbs.FlexiForceZ = flex.Force.Z; + pbs.FlexiGravity = flex.Gravity; + pbs.FlexiSoftness = flex.Softness; + pbs.FlexiTension = flex.Tension; + pbs.FlexiWind = flex.Wind; + break; + case (ushort)ExtraParamType.Light: + Primitive.LightData light = new Primitive.LightData(extraParam.ExtraParamData, 0); + pbs.LightColorA = light.Color.A; + pbs.LightColorB = light.Color.B; + pbs.LightColorG = light.Color.G; + pbs.LightColorR = light.Color.R; + pbs.LightCutoff = light.Cutoff; + pbs.LightEntry = true; + pbs.LightFalloff = light.Falloff; + pbs.LightIntensity = light.Intensity; + pbs.LightRadius = light.Radius; + break; + case 0x40: + pbs.ReadProjectionData(extraParam.ExtraParamData, 0); + break; + + } + + } - byte[] extraparams = new byte[bytelength]; - int position = 0; - - for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) - { - Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, - obj.ExtraParams[extparams].ExtraParamData.Length); - - position += obj.ExtraParams[extparams].ExtraParamData.Length; - } - - pbs.ExtraParams = extraparams; - pbs.PathBegin = (ushort) obj.PathBegin; pbs.PathCurve = (byte) obj.PathCurve; pbs.PathEnd = (ushort) obj.PathEnd; @@ -269,9 +316,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps pbs.TextureEntry = tmp.GetBytes(); prim.Shape = pbs; prim.Scale = obj.Scale; - prim.Shape.SculptEntry = true; - prim.Shape.SculptTexture = obj.SculptID; - prim.Shape.SculptType = (byte) SculptType.Mesh; + SceneObjectGroup grp = new SceneObjectGroup(); From 9f975ad5aacdca94b2c8531bb00ac486c6e5af52 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 20 Oct 2010 01:23:54 -0400 Subject: [PATCH 13/20] * One more goofy thing. I note that the sculpt texture id is broken out of the ExtraParams data in UploadObjectAsset. At this moment, if you're uploading a Sculpt, make sure to break out the Texture ID into the object data or it might not get applied appropriately. --- .../CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs index 465da290f0..09b97196bf 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -217,9 +217,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps switch ((ushort)extraParam.Type) { case (ushort)ExtraParamType.Sculpt: + Primitive.SculptData sculpt = new Primitive.SculptData(extraParam.ExtraParamData, 0); + pbs.SculptEntry = true; + pbs.SculptTexture = obj.SculptID; - pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptType = (byte)sculpt.Type; break; case (ushort)ExtraParamType.Flexible: From a7acb650d400a280a7b9edabd304376dff9c81af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 22:26:07 -0700 Subject: [PATCH 14/20] Deleted verbose debug messages that are bringing sims to an halt. Increased the user cache expiration period to 33 hours. --- .../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 4 ++-- .../Connectors/UserAccounts/UserAccountServiceConnector.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e7cfda1bf1..155335bded 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -36,7 +36,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { public class UserAccountCache { - private const double CACHE_EXPIRATION_SECONDS = 120.0; + private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! private static readonly ILog m_log = LogManager.GetLogger( @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts if (account != null) m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); - m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); + //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } public UserAccount Get(UUID userID, out bool inCache) diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 38c191a913..2a5df83193 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -113,7 +113,7 @@ namespace OpenSim.Services.Connectors public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID) { - m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); + //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); Dictionary sendData = new Dictionary(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); From 55974df14b6d64c1e1f9e386a3eacce3ba86dc98 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sat, 2 Oct 2010 19:17:02 -0400 Subject: [PATCH 15/20] * refactor refactor refactor ServerURI 4 lyfe --- OpenSim/Framework/RegionInfo.cs | 8 +++- .../Servers/HttpServer/BaseHttpServer.cs | 10 ++--- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 27 +++-------- .../World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 31 ++++++++----- .../Connectors/Land/LandServiceConnector.cs | 3 +- .../Neighbour/NeighbourServiceConnector.cs | 2 +- .../SimianGrid/SimianGridServiceConnector.cs | 4 +- .../Simulation/SimulationServiceConnector.cs | 45 +++---------------- .../Services/GridService/HypergridLinker.cs | 14 +++++- .../HypergridService/GatekeeperService.cs | 2 +- .../HypergridService/UserAgentService.cs | 8 ++-- OpenSim/Services/Interfaces/IGridService.cs | 8 +++- 14 files changed, 72 insertions(+), 94 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398a18..949a28985e 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -116,7 +116,13 @@ namespace OpenSim.Framework public string ServerURI { get { return m_serverURI; } - set { m_serverURI = value; } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } protected string m_serverURI; diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba8c1941a8..47e86ad56b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); -// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 74ad1685f9..f30a8504fe 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -327,8 +327,8 @@ namespace OpenSim //regionInfo.originRegionID = regionInfo.RegionID; // set initial ServerURI - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; regionInfo.HttpPort = m_httpServerPort; + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 38fff1cab3..3791e1df6f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -337,20 +337,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (sp.ClientView.TryGet(out ipepClient)) { capsPath - = "http://" - + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) - + ":" - + finalDestination.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } else { - capsPath - = "http://" - + finalDestination.ExternalHostName - + ":" - + finalDestination.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } #endregion @@ -382,8 +373,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort - + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; } // Expect avatar crossing is a heavy-duty function at the destination. @@ -516,8 +506,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + - "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; } @@ -842,7 +831,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + + cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) @@ -870,8 +859,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // TODO Should construct this behind a method string capsPath = - "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort - + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1190,8 +1178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort - + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index a182eeae7d..3ce964af49 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); + m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); MainServer.Instance.AddLLSDHandler( diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 479a80e297..89a8f7a1b8 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -108,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -117,16 +117,20 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + uuid); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } - if (hash["region_image"] != null) + if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - if (hash["external_name"] != null) + m_log.Debug(">> HERE, imageURL: " + imageURL); + } + if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; + m_log.Debug(">> HERE, externalName: " + externalName); + } } } @@ -208,8 +212,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -219,38 +223,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 8143b5a89f..4b25ac819a 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); - string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; - XmlRpcResponse response = request.Send(uri, 10000); + XmlRpcResponse response = request.Send(info.ServerURI, 10000); if (response.IsFault) { m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 0a982f8d57..9c57a40701 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; + string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 168b233893..8076fab589 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); - string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; - OSDMap extraData = new OSDMap { { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, @@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", regionInfo.RegionName }, { "MinPosition", minPosition.ToString() }, { "MaxPosition", maxPosition.ToString() }, - { "Address", httpAddress }, + { "Address", regionInfo.ServerURI }, { "Enabled", "1" }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index a5f748f0c4..07839d3b59 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,24 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = string.Empty; - - // HACK -- Simian grid make it work!!! - if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) - uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - else - { - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); - reason = e.Message; - return false; - } - } + string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); @@ -277,16 +260,7 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -385,7 +359,7 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); @@ -479,16 +453,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); @@ -538,7 +503,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; + = destination.ServerURI + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b86fb6f01c..757ae80a70 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region :[:] ", + "link-region [] ", "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region or : ", @@ -200,9 +200,15 @@ namespace OpenSim.Services.GridService } - // From the command line and the 2 above public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + { + TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + } + + // From the command line and the 2 above + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); @@ -509,12 +515,16 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; + string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; + if ( cmdparams.Length == 4 ) { + + } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 3f5c4f1400..9e961636ce 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService string regionimage = "regionImage" + region.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; + imageURL = region.ServerURI + "index.php?method=" + regionimage; return true; } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index eb6433cc6f..d5dda115c8 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -145,12 +145,12 @@ namespace OpenSim.Services.HypergridService region.RegionLocY = finalDestination.RegionLocY; // Generate a new service session - agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); + agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); bool success = false; string myExternalIP = string.Empty; - string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; + string gridName = gatekeeper.ServerURI; if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); else @@ -159,7 +159,7 @@ namespace OpenSim.Services.HypergridService if (!success) { m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", - agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); + agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); // restore the old travel info lock (m_TravelingAgents) @@ -210,7 +210,7 @@ namespace OpenSim.Services.HypergridService m_TravelingAgents[agentCircuit.SessionID] = travel; } travel.UserID = agentCircuit.AgentID; - travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; + travel.GridExternalName = region.ServerURI; travel.ServiceToken = agentCircuit.ServiceSessionID; if (old != null) travel.ClientIPAddress = old.ClientIPAddress; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 77230a33d7..bf441e6076 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -116,7 +116,13 @@ namespace OpenSim.Services.Interfaces public string ServerURI { get { return m_serverURI; } - set { m_serverURI = value; } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } protected string m_serverURI; From 19119d7705f8381a3c207d0e64a23243215a12b9 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 3 Oct 2010 18:03:53 -0400 Subject: [PATCH 16/20] * additional serveruri cleanup --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../InstantMessage/MessageTransferModule.cs | 6 ++-- .../World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 14 ++++----- .../Simulation/SimulationServiceConnector.cs | 10 +------ OpenSim/Services/GridService/GridService.cs | 2 +- .../Services/GridService/HypergridLinker.cs | 11 ++++--- .../LLLoginService/LLLoginResponse.cs | 29 +------------------ 8 files changed, 21 insertions(+), 55 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f30a8504fe..904a50c799 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -328,7 +328,7 @@ namespace OpenSim // set initial ServerURI regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 918fa04143..fdc48c6b69 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage try { - XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); + XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); Hashtable responseData = (Hashtable)GridResp.Value; @@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } catch (WebException e) { - m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", - reginfo.ExternalHostName, reginfo.HttpPort, e.Message); + m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", + reginfo.ServerURI, e.Message); } return false; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 3ce964af49..fdbbccfbab 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mreg != null) { - httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); + httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); lock (m_cachedRegionMapItemsAddress) { if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 89a8f7a1b8..2b19b8709f 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid protected override string AgentPath() { - return "/foreignagent/"; + return "foreignagent/"; } protected override string ObjectPath() { - return "/foreignobject/"; + return "foreignobject/"; } public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) @@ -86,12 +86,11 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); XmlRpcResponse response = null; try { - response = request.Send(uri, 10000); + response = request.Send(info.ServerURI, 10000); } catch (Exception e) { @@ -192,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { - response = request.Send(uri, 10000); + response = request.Send(gatekeeper.ServerURI, 10000); } catch (Exception e) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 07839d3b59..c4284eb920 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation protected virtual string AgentPath() { - return "/agent/"; + return "agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -106,8 +106,6 @@ namespace OpenSim.Services.Connectors.Simulation string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); - AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; @@ -261,7 +259,6 @@ namespace OpenSim.Services.Connectors.Simulation { // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; - //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -360,7 +357,6 @@ namespace OpenSim.Services.Connectors.Simulation agent = null; // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -381,7 +377,6 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -402,7 +397,6 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -411,7 +405,6 @@ namespace OpenSim.Services.Connectors.Simulation return true; } - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -455,7 +448,6 @@ namespace OpenSim.Services.Connectors.Simulation { string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e7988d6e93..125c2be8cf 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), + String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 757ae80a70..11df7e0b73 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -199,11 +199,14 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) { - TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); + } + + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); } // From the command line and the 2 above diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 0da1715849..f985ab21ba 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -333,34 +333,7 @@ namespace OpenSim.Services.LLLoginService private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) { - string capsSeedPath = String.Empty; - - // Don't use the following! It Fails for logging into any region not on the same port as the http server! - // Kept here so it doesn't happen again! - // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; - - #region IP Translation for NAT - if (ipepClient != null) - { - capsSeedPath - = "http://" - + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) - + ":" - + destination.HttpPort - + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); - } - else - { - capsSeedPath - = "http://" - + destination.ExternalHostName - + ":" - + destination.HttpPort - + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); - } - #endregion - - SeedCapability = capsSeedPath; + SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); } private void SetDefaultValues() From 58f75fa19d9aea18283ecdbd44559efb81781c9d Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Mon, 11 Oct 2010 16:53:00 -0400 Subject: [PATCH 17/20] * more url / hg cleanup --- OpenSim/Framework/Capabilities/CapsUtil.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 31 +++++++++++++++-- .../EntityTransfer/EntityTransferModule.cs | 34 ++++++------------- .../InterGrid/OpenGridProtocolModule.cs | 4 +-- .../Handlers/Hypergrid/HomeAgentHandlers.cs | 2 ++ .../Services/GridService/HypergridLinker.cs | 18 +++------- .../HypergridService/UserAgentService.cs | 1 + OpenSim/Services/Interfaces/IGridService.cs | 9 ++++- 8 files changed, 56 insertions(+), 45 deletions(-) diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs index 0334e4b4a2..faf2708541 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Capabilities/CapsUtil.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities /// public static string GetCapsSeedPath(string capsObjectPath) { - return "/CAPS/" + capsObjectPath + "0000/"; + return "CAPS/" + capsObjectPath + "0000/"; } /// diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 949a28985e..73b8bd0120 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -115,7 +115,13 @@ namespace OpenSim.Framework /// public string ServerURI { - get { return m_serverURI; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -147,6 +153,7 @@ namespace OpenSim.Framework public SimpleRegionInfo() { + m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -156,6 +163,7 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; + m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) @@ -166,6 +174,7 @@ namespace OpenSim.Framework m_externalHostName = externalUri; m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); + m_serverURI = string.Empty; } public SimpleRegionInfo(RegionInfo ConvertFrom) @@ -455,6 +464,7 @@ namespace OpenSim.Framework configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); configMember.performConfigurationRetrieve(); + m_serverURI = string.Empty; } public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -464,10 +474,12 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; + m_serverURI = string.Empty; } public RegionInfo() { + m_serverURI = string.Empty; } public EstateSettings EstateSettings @@ -557,10 +569,23 @@ namespace OpenSim.Framework /// /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// + public string ServerURI { - get { return m_serverURI; } - set { m_serverURI = value; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } public string RegionName diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3791e1df6f..54cc80f384 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -327,34 +327,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, it got this agent. Let's close some child agents sp.CloseChildAgents(newRegionX, newRegionY); - + IClientIPEndpoint ipepClient; if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); - #region IP Translation for NAT - IClientIPEndpoint ipepClient; + // Uses ipepClient above if (sp.ClientView.TryGet(out ipepClient)) { - capsPath - = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); - } - else - { - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); } #endregion + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { - #region IP Translation for NAT - // Uses ipepClient above - if (sp.ClientView.TryGet(out ipepClient)) - { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - } - #endregion - eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); // ES makes the client send a UseCircuitCode message to the destination, @@ -373,7 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } // Expect avatar crossing is a heavy-duty function at the destination. @@ -506,7 +493,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + m_log.Debug("Set callback URL to " + agent.CallbackURI); } @@ -832,7 +820,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + - "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; + "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { @@ -857,9 +845,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } - // TODO Should construct this behind a method - string capsPath = - neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1178,7 +1164,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index fd0e879e05..2dd7767d76 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid // DEPRECATED responseMap["seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); // REPLACEMENT responseMap["region_seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index f64a07973e..a1bcba6a37 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,6 +124,7 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; + string server_uri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -173,6 +174,7 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; + AgentCircuitData aCircuit = new AgentCircuitData(); try diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 11df7e0b73..74e864b8aa 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,20 +198,7 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); - } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); - } - - // From the command line and the 2 above - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); @@ -226,8 +213,11 @@ namespace OpenSim.Services.GridService // Big HACK for Simian Grid !!! // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) + if (externalHostName.Contains("/")) { regInfo.ServerURI = externalHostName; + } else { + regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); + } try { diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index d5dda115c8..aed2dc8bd2 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -136,6 +136,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); + m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index bf441e6076..6d3bff7683 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -115,7 +115,13 @@ namespace OpenSim.Services.Interfaces /// public string ServerURI { - get { return m_serverURI; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -170,6 +176,7 @@ namespace OpenSim.Services.Interfaces public GridRegion() { + m_serverURI = string.Empty; } public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) From 017b83d0a3e3ac6a1c8bc86b9bef1ee47cba059e Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Wed, 20 Oct 2010 02:36:59 -0400 Subject: [PATCH 18/20] * remove some spurious debug info * The last 4 commits are a patch from otakup0pe that's supposed to make URLs better somehow in an effort to make it easier to do hypergrid (I think).. But as it seems that I'm the only one who was able to apply the patch.. and I looked it over and it doesn't look like it breaks anything via the diffs.. I'll sign off on it. Signed-off-by: Teravus Ovares (Dan Olivares) --- .../Servers/HttpServer/BaseHttpServer.cs | 10 +++---- .../Region/Framework/Scenes/ScenePresence.cs | 2 ++ .../Hypergrid/GatekeeperServiceConnector.cs | 30 +++++++++---------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 47e86ad56b..0c1e5e013b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 13d99643bf..c223b4b50d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2976,6 +2976,8 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent) { + cAgent.CallbackURI = m_callbackURI; + cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 2b19b8709f..4231be1f66 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - m_log.Debug(">> HERE, uuid: " + regionID); + //m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - m_log.Debug(">> HERE, realHandle: " + realHandle); + //m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - m_log.Debug(">> HERE, imageURL: " + imageURL); + //m_log.Debug(">> HERE, imageURL: " + imageURL); } if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; - m_log.Debug(">> HERE, externalName: " + externalName); + //m_log.Debug(">> HERE, externalName: " + externalName); } } @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { @@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); + //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } @@ -210,8 +210,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - foreach (Object o in hash) - m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -221,41 +221,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - m_log.Debug(">> HERE, uuid: " + region.RegionID); + //m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - m_log.Debug(">> HERE, x: " + region.RegionLocX); + //m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - m_log.Debug(">> HERE, y: " + region.RegionLocY); + //m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - m_log.Debug(">> HERE, region_name: " + region.RegionName); + //m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; - m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - m_log.Debug(">> HERE, http_port: " + region.HttpPort); + //m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return From 9038218c2d67cd796242e17c7e65adbde05c8538 Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 20 Oct 2010 20:39:05 -0700 Subject: [PATCH 19/20] fix combining of multiple physics submeshes --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 72dce6ddcb..1257804cfa 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -349,6 +349,7 @@ namespace OpenSim.Region.Physics.Meshing OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3(); OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3(); + ushort faceIndexOffset = (ushort)coords.Count; byte[] posBytes = subMeshMap["Position"].AsBinary(); for (int i = 0; i < posBytes.Length; i += 6) @@ -368,9 +369,9 @@ namespace OpenSim.Region.Physics.Meshing byte[] triangleBytes = subMeshMap["TriangleList"].AsBinary(); for (int i = 0; i < triangleBytes.Length; i += 6) { - ushort v1 = Utils.BytesToUInt16(triangleBytes, i); - ushort v2 = Utils.BytesToUInt16(triangleBytes, i + 2); - ushort v3 = Utils.BytesToUInt16(triangleBytes, i + 4); + ushort v1 = (ushort)(Utils.BytesToUInt16(triangleBytes, i) + faceIndexOffset); + ushort v2 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 2) + faceIndexOffset); + ushort v3 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 4) + faceIndexOffset); Face f = new Face(v1, v2, v3); faces.Add(f); } From 1f7577b7351e8176e12d7e5f58f01427385958c7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 07:19:10 +0100 Subject: [PATCH 20/20] Skip empty strings in ParseString* functions --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8bf9482e03..cc6ded7d1d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8404,6 +8404,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (j = 0; j < seplen; j++) { + if (separray[j].ToString() == String.Empty) + active[j] = false; + if (active[j]) { // scan all of the markers @@ -8432,6 +8435,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) { + if (spcarray[j].ToString() == String.Empty) + active[j] = false; + if (active[j]) { // scan all of the markers