From 55e04e6c68766399695a27d071c9298d90eafe13 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 14 Dec 2010 08:11:49 -0800 Subject: Fixes mantis #5270 -- Map tiles for hyperlinks not showing in world map for grided sims. --- .../Grid/RemoteGridServiceConnector.cs | 109 ++++++++++++++++----- .../CoreModules/World/WorldMap/MapSearchModule.cs | 4 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- 3 files changed, 90 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 16e25e6..dfba0d6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -41,8 +41,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { - public class RemoteGridServicesConnector : - GridServicesConnector, ISharedRegionModule, IGridService + public class RemoteGridServicesConnector : ISharedRegionModule, IGridService { private static readonly ILog m_log = LogManager.GetLogger( @@ -51,6 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid private bool m_Enabled = false; private IGridService m_LocalGridService; + private IGridService m_RemoteGridService; public RemoteGridServicesConnector() { @@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid get { return "RemoteGridServicesConnector"; } } - public override void Initialise(IConfigSource source) + public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) @@ -97,9 +97,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return; } - base.Initialise(source); - m_LocalGridService = new LocalGridServicesConnector(source); + m_RemoteGridService = new GridServicesConnector(source); } public void PostInitialise() @@ -135,61 +134,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region IGridService - public override string RegisterRegion(UUID scopeID, GridRegion regionInfo) + public string RegisterRegion(UUID scopeID, GridRegion regionInfo) { string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo); if (msg == String.Empty) - return base.RegisterRegion(scopeID, regionInfo); + return m_RemoteGridService.RegisterRegion(scopeID, regionInfo); return msg; } - public override bool DeregisterRegion(UUID regionID) + public bool DeregisterRegion(UUID regionID) { if (m_LocalGridService.DeregisterRegion(regionID)) - return base.DeregisterRegion(regionID); + return m_RemoteGridService.DeregisterRegion(regionID); return false; } - public override List GetNeighbours(UUID scopeID, UUID regionID) + public List GetNeighbours(UUID scopeID, UUID regionID) { - return base.GetNeighbours(scopeID, regionID); + return m_RemoteGridService.GetNeighbours(scopeID, regionID); } - public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) + public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) { GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); if (rinfo == null) - rinfo = base.GetRegionByUUID(scopeID, regionID); + rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID); return rinfo; } - public override GridRegion GetRegionByPosition(UUID scopeID, int x, int y) + public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); if (rinfo == null) - rinfo = base.GetRegionByPosition(scopeID, x, y); + rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); return rinfo; } - public override GridRegion GetRegionByName(UUID scopeID, string regionName) + public GridRegion GetRegionByName(UUID scopeID, string regionName) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); if (rinfo == null) - rinfo = base.GetRegionByName(scopeID, regionName); + rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); return rinfo; } - public override List GetRegionsByName(UUID scopeID, string name, int maxNumber) + public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { List rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); - List grinfo = base.GetRegionsByName(scopeID, name, maxNumber); + List grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber); if (grinfo != null) { @@ -202,13 +201,79 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return rinfo; } - // Let's not override GetRegionRange -- let's get them all from the grid server + public virtual List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) + { + List rinfo = m_LocalGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionRange {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public List GetDefaultRegions(UUID scopeID) + { + List rinfo = m_LocalGridService.GetDefaultRegions(scopeID); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetDefaultRegions {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetDefaultRegions(scopeID); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public List GetFallbackRegions(UUID scopeID, int x, int y) + { + List rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetFallbackRegions {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetFallbackRegions(scopeID, x, y); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public List GetHyperlinks(UUID scopeID) + { + List rinfo = m_LocalGridService.GetHyperlinks(scopeID); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetHyperlinks {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetHyperlinks(scopeID); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } - public override int GetRegionFlags(UUID scopeID, UUID regionID) + public int GetRegionFlags(UUID scopeID, UUID regionID) { int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID); if (flags == -1) - flags = base.GetRegionFlags(scopeID, regionID); + flags = m_RemoteGridService.GetRegionFlags(scopeID, regionID); return flags; } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 9f88517..bdd1a0b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -93,13 +93,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } // try to fetch from GridServer - List regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); + List regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); if (regionInfos == null) { m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region regionInfos = new List(); - GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); + GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); if (info != null) regionInfos.Add(info); } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 9869f4a..6d9afce 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -593,7 +593,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (!m_blacklistedregions.ContainsKey(regionhandle)) m_blacklistedregions.Add(regionhandle, Environment.TickCount); } - m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); + //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); } } -- cgit v1.1 From 5ce296e08de8875da6feddd4a9edf4b16558009d Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 14 Dec 2010 09:14:34 -0800 Subject: Workaround to allow llHTTPRequest to POST data to Lighthttpd which doesn't support Expect: 100-Continue --- .../Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d78931a..e4a2461 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -341,6 +341,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest try { Request = (HttpWebRequest) WebRequest.Create(Url); + + //This works around some buggy HTTP Servers like Lighttpd + Request.ServicePoint.Expect100Continue = false; + Request.Method = HttpMethod; Request.ContentType = HttpMIMEType; -- cgit v1.1 From 10ae5454cbc0bb5ffab518203023d76abdd762cd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 14 Dec 2010 12:16:51 -0800 Subject: Made the map thread request the map items asynchronously, as the name suggested -- but with a cap of 20 async requests max at any given time. --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 80 +++++++++++++++++++--- 1 file changed, 71 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 6d9afce..e3ba190 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -33,6 +33,7 @@ using System.Drawing.Imaging; using System.IO; using System.Net; using System.Reflection; +using System.Runtime.Remoting.Messaging; using System.Threading; using log4net; using Nini.Config; @@ -413,11 +414,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } } + private int nAsyncRequests = 0; /// /// Processing thread main() loop for doing remote mapitem requests /// public void process() { + const int MAX_ASYNC_REQUESTS = 20; try { while (true) @@ -437,10 +440,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap dorequest = false; } - if (dorequest) + if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle)) { - OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); - RequestMapItemsCompleted(response); + while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break + Thread.Sleep(80); + + RequestMapItemsDelegate d = RequestMapItemsAsync; + d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null); + //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); + //RequestMapItemsCompleted(response); + Interlocked.Increment(ref nAsyncRequests); } } @@ -469,8 +478,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// Sends the mapitem response to the IClientAPI /// /// The OSDMap Response for the mapitem - private void RequestMapItemsCompleted(OSDMap response) + private void RequestMapItemsCompleted(IAsyncResult iar) { + AsyncResult result = (AsyncResult)iar; + RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate; + + OSDMap response = (OSDMap)icon.EndInvoke(iar); + + Interlocked.Decrement(ref nAsyncRequests); + + if (!response.ContainsKey("requestID")) + return; + UUID requestID = response["requestID"].AsUUID(); if (requestID != UUID.Zero) @@ -538,6 +557,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap EnqueueMapItemRequest(st); } + private delegate OSDMap RequestMapItemsDelegate(UUID id, uint flags, + uint EstateID, bool godlike, uint itemtype, ulong regionhandle); /// /// Does the actual remote mapitem request /// This should be called from an asynchronous thread @@ -552,9 +573,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// passed in from packet /// Region we're looking up /// - private OSDMap RequestMapItemsAsync(string httpserver, UUID id, uint flags, + private OSDMap RequestMapItemsAsync(UUID id, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { + string httpserver = ""; bool blacklisted = false; lock (m_blacklistedregions) { @@ -638,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap os = mapitemsrequest.GetRequestStream(); os.Write(buffer, 0, buffer.Length); //Send it os.Close(); - //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from Sim {0}", httpserver); + //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver); } catch (WebException ex) { @@ -654,15 +676,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return responseMap; } + catch + { + m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); + responseMap["connect"] = OSD.FromBoolean(false); + return responseMap; + } string response_mapItems_reply = null; { // get the response + StreamReader sr = null; try { WebResponse webResponse = mapitemsrequest.GetResponse(); if (webResponse != null) { - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); response_mapItems_reply = sr.ReadToEnd().Trim(); } else @@ -683,6 +712,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return responseMap; } + catch + { + m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); + responseMap["connect"] = OSD.FromBoolean(false); + lock (m_blacklistedregions) + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Add(regionhandle, Environment.TickCount); + } + + return responseMap; + } + finally + { + if (sr != null) + sr.Close(); + } + OSD rezResponse = null; try { @@ -691,14 +738,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap responseMap = (OSDMap)rezResponse; responseMap["requestID"] = OSD.FromUUID(requestID); } - catch (Exception) + catch (Exception ex) { - //m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); + m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); responseMap["connect"] = OSD.FromBoolean(false); + lock (m_blacklistedregions) + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Add(regionhandle, Environment.TickCount); + } return responseMap; } } + + if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + { + m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); + m_blacklistedregions.Add(regionhandle, Environment.TickCount); + } + } + return responseMap; } -- cgit v1.1 From ff8ff773e7a848eed14519a122ad118042549a8e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 14 Dec 2010 12:58:32 -0800 Subject: Relax a highly constraining lock on m_entityUpdates that may be preventing reprioritizations from actually happening. #LoginLag --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 253 +++++++++++---------- 1 file changed, 127 insertions(+), 126 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c934b9e..979dd47 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3557,107 +3557,109 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; int updatesThisCall = 0; - lock (m_entityUpdates.SyncRoot) + EntityUpdate update; + while (updatesThisCall < maxUpdates) { - EntityUpdate update; - while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) - { - if (update.Entity is SceneObjectPart) + lock (m_entityUpdates.SyncRoot) + if (!m_entityUpdates.TryDequeue(out update)) + break; + + if (update.Entity is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)update.Entity; + + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + if (m_killRecord.Contains(part.LocalId)) { - SceneObjectPart part = (SceneObjectPart)update.Entity; - - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - if (m_killRecord.Contains(part.LocalId)) - { - // m_log.WarnFormat( - // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", - // part.LocalId, Name); - continue; - } + // m_log.WarnFormat( + // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", + // part.LocalId, Name); + continue; + } - if (part.ParentGroup.IsAttachment && m_disableFacelights) + if (part.ParentGroup.IsAttachment && m_disableFacelights) + { + if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && + part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) { - if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && - part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) - { - part.Shape.LightEntry = false; - } + part.Shape.LightEntry = false; } } + } - ++updatesThisCall; + ++updatesThisCall; - #region UpdateFlags to packet type conversion + #region UpdateFlags to packet type conversion - PrimUpdateFlags updateFlags = update.Flags; + PrimUpdateFlags updateFlags = update.Flags; - bool canUseCompressed = true; - bool canUseImproved = true; + bool canUseCompressed = true; + bool canUseImproved = true; - // Compressed object updates only make sense for LL primitives - if (!(update.Entity is SceneObjectPart)) + // Compressed object updates only make sense for LL primitives + if (!(update.Entity is SceneObjectPart)) + { + canUseCompressed = false; + } + + if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + { + canUseCompressed = false; + canUseImproved = false; + } + else + { + if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || + updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || + updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { canUseCompressed = false; } - if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || + updateFlags.HasFlag(PrimUpdateFlags.ParentID) || + updateFlags.HasFlag(PrimUpdateFlags.Scale) || + updateFlags.HasFlag(PrimUpdateFlags.PrimData) || + updateFlags.HasFlag(PrimUpdateFlags.Text) || + updateFlags.HasFlag(PrimUpdateFlags.NameValue) || + updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || + updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || + updateFlags.HasFlag(PrimUpdateFlags.Sound) || + updateFlags.HasFlag(PrimUpdateFlags.Particles) || + updateFlags.HasFlag(PrimUpdateFlags.Material) || + updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || + updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { - canUseCompressed = false; canUseImproved = false; } - else - { - if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || - updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || - updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseCompressed = false; - } + } - if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || - updateFlags.HasFlag(PrimUpdateFlags.ParentID) || - updateFlags.HasFlag(PrimUpdateFlags.Scale) || - updateFlags.HasFlag(PrimUpdateFlags.PrimData) || - updateFlags.HasFlag(PrimUpdateFlags.Text) || - updateFlags.HasFlag(PrimUpdateFlags.NameValue) || - updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || - updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || - updateFlags.HasFlag(PrimUpdateFlags.Sound) || - updateFlags.HasFlag(PrimUpdateFlags.Particles) || - updateFlags.HasFlag(PrimUpdateFlags.Material) || - updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || - updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseImproved = false; - } - } + #endregion UpdateFlags to packet type conversion - #endregion UpdateFlags to packet type conversion + #region Block Construction - #region Block Construction + // TODO: Remove this once we can build compressed updates + canUseCompressed = false; - // TODO: Remove this once we can build compressed updates - canUseCompressed = false; - - if (!canUseImproved && !canUseCompressed) + if (!canUseImproved && !canUseCompressed) + { + if (update.Entity is ScenePresence) + { + objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); + } + else { - if (update.Entity is ScenePresence) - { - objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); - } - else - { // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) // { // SceneObjectPart sop = (SceneObjectPart)update.Entity; @@ -3686,71 +3688,70 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } // else // { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); + objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); // } - } - } - else if (!canUseImproved) - { - compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); - } - else - { - terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); } - - #endregion Block Construction + } + else if (!canUseImproved) + { + compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); + } + else + { + terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); } - #region Packet Sending + #endregion Block Construction + } + + #region Packet Sending - const float TIME_DILATION = 1.0f; - ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + const float TIME_DILATION = 1.0f; + ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - if (objectUpdateBlocks.IsValueCreated) - { - List blocks = objectUpdateBlocks.Value; + if (objectUpdateBlocks.IsValueCreated) + { + List blocks = objectUpdateBlocks.Value; - ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true); - } + OutPacket(packet, ThrottleOutPacketType.Task, true); + } - if (compressedUpdateBlocks.IsValueCreated) - { - List blocks = compressedUpdateBlocks.Value; + if (compressedUpdateBlocks.IsValueCreated) + { + List blocks = compressedUpdateBlocks.Value; - ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; + ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true); - } + OutPacket(packet, ThrottleOutPacketType.Task, true); + } - if (terseUpdateBlocks.IsValueCreated) - { - List blocks = terseUpdateBlocks.Value; + if (terseUpdateBlocks.IsValueCreated) + { + List blocks = terseUpdateBlocks.Value; - ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true); - } + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending -- cgit v1.1 From c620e4c8228d275cfe9659d55ca9ec0c2d7c1b1a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 14 Dec 2010 22:25:01 +0000 Subject: add infrastructure for groups module tests --- .../Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs new file mode 100644 index 0000000..f9a736f --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -0,0 +1,54 @@ +/* + * 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.Reflection; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests +{ + /// + /// Basic groups module tests + /// + [TestFixture] + public class GroupsModuleTests + { + [Test] + public void TestBasic() + { + TestHelper.InMethod(); + } + } +} \ No newline at end of file -- cgit v1.1 From 42c9c30e4c3102d1f34e28353ddec23c854c5d35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 14 Dec 2010 22:57:36 +0000 Subject: Add mock group services connector and use this in tests --- .../Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | 4 +--- .../Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index a046e09..5c779de 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -27,14 +27,12 @@ using System; using System.Collections.Generic; - using OpenMetaverse; - using OpenSim.Framework; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - interface IGroupsServicesConnector + public interface IGroupsServicesConnector { UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index f9a736f..bc55b04 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -27,6 +27,7 @@ using System; using System.Reflection; +using Nini.Config; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; @@ -49,6 +50,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests public void TestBasic() { TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Groups"); + config.Set("Enabled", true); + config.Set("Module", "GroupsModule"); + config.Set("DebugEnabled", true); + SceneSetupHelpers.SetupSceneModules( + scene, configSource, new object[] { new MockGroupsServicesConnector() }); } } } \ No newline at end of file -- cgit v1.1 From 81bccd6d132956e2de9e5ad473f87931df76cde8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 14 Dec 2010 23:36:34 +0000 Subject: Start implementing a test for 'share with group' object functionality. Not yet complete. While implementing this, a bug was fixed in scene setup helpers where module RegionLoaded() was called immediately after AddRegion() instead of waiting for all AddRegions() to complete. Also, XmlRpcGroupsModule non-message functionality will now work without a message transfer module (as indicated in the comments but with a contradictory implementation) --- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 87 ++++++++++++++++++++++ .../Avatar/XmlRpcGroups/GroupsModule.cs | 6 +- 2 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs new file mode 100644 index 0000000..bceacda --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -0,0 +1,87 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.CoreModules.Avatar.InstantMessage; +using OpenSim.Region.CoreModules.World.Permissions; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + [TestFixture] + public class SceneObjectUserGroupTests + { + /// + /// Test share with group object functionality + /// + /// This test is not yet fully implemented + [Test] + public void TestShareWithGroup() + { + TestHelper.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + + IConfig startupConfig = configSource.AddConfig("Startup"); + startupConfig.Set("serverside_object_permissions", true); + + IConfig groupsConfig = configSource.AddConfig("Groups"); + groupsConfig.Set("Enabled", true); + groupsConfig.Set("Module", "GroupsModule"); + groupsConfig.Set("DebugEnabled", true); + + SceneSetupHelpers.SetupSceneModules( + scene, configSource, new object[] + { new PermissionsModule(), + new GroupsModule(), + new MockGroupsServicesConnector() }); + + TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); + + IGroupsModule groupsModule = scene.RequestModuleInterface(); + + groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index ccf5289..4aab87f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -163,9 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_msgTransferModule == null) { m_groupsEnabled = false; - m_log.Error("[GROUPS]: Could not get MessageTransferModule"); - Close(); - return; + m_log.Warn("[GROUPS]: Could not get MessageTransferModule"); } } @@ -1299,7 +1297,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); localClient.SendInstantMessage(msg); } - else + else if (m_msgTransferModule != null) { if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is not local, delivering via TransferModule", msgTo); m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success?"Succeeded":"Failed"); }); -- cgit v1.1 From 92727ad596a46990d76aad2cf0c75083df2f9c4a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 14 Dec 2010 23:41:36 +0000 Subject: minor: disable debug logging for previous test --- OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index bceacda..c78038f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestShareWithGroup() { TestHelper.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); -- cgit v1.1 From 3643be1c974971fcfab8a1dff2e4a7acb9ec07e1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 14 Dec 2010 23:46:02 +0000 Subject: Rename SceneObjectUserTests to SceneObjectDeRezTests to better reflect its contents --- .../Scenes/Tests/SceneObjectDeRezTests.cs | 129 +++++++++++++++++++++ .../Framework/Scenes/Tests/SceneObjectUserTests.cs | 129 --------------------- 2 files changed, 129 insertions(+), 129 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs new file mode 100644 index 0000000..b3b99f4 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.CoreModules.World.Permissions; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Tests manipulation of scene objects by users. + /// + /// + /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. + /// FIXME: These tests are very incomplete - they only test for a few conditions. + [TestFixture] + public class SceneObjectUserTests + { + /// + /// Test deleting an object from a scene. + /// + [Test] + public void TestDeRezSceneObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Startup"); + config.Set("serverside_object_permissions", true); + SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); + + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. + AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; + sogd.Enabled = false; + + SceneObjectPart part + = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); + part.Name = "obj1"; + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + List localIds = new List(); + localIds.Add(part.LocalId); + + scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); + sogd.InventoryDeQueueAndDelete(); + + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + Assert.That(retrievedPart, Is.Null); + } + + /// + /// Test deleting an object from a scene where the deleter is not the owner + /// + /// + /// This test assumes that the deleter is not a god. + [Test] + public void TestDeRezSceneObjectNotOwner() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); + UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Startup"); + config.Set("serverside_object_permissions", true); + SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); + + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. + AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; + sogd.Enabled = false; + + SceneObjectPart part + = new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); + part.Name = "obj1"; + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + List localIds = new List(); + localIds.Add(part.LocalId); + + scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); + sogd.InventoryDeQueueAndDelete(); + + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs deleted file mode 100644 index b3b99f4..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using Nini.Config; -using NUnit.Framework; -using NUnit.Framework.SyntaxHelpers; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Region.CoreModules.World.Permissions; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; -using OpenSim.Tests.Common.Setup; - -namespace OpenSim.Region.Framework.Scenes.Tests -{ - /// - /// Tests manipulation of scene objects by users. - /// - /// - /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. - /// FIXME: These tests are very incomplete - they only test for a few conditions. - [TestFixture] - public class SceneObjectUserTests - { - /// - /// Test deleting an object from a scene. - /// - [Test] - public void TestDeRezSceneObject() - { - TestHelper.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - - TestScene scene = SceneSetupHelpers.SetupScene(); - IConfigSource configSource = new IniConfigSource(); - IConfig config = configSource.AddConfig("Startup"); - config.Set("serverside_object_permissions", true); - SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); - - // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. - AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; - - SceneObjectPart part - = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); - part.Name = "obj1"; - scene.AddNewSceneObject(new SceneObjectGroup(part), false); - List localIds = new List(); - localIds.Add(part.LocalId); - - scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); - sogd.InventoryDeQueueAndDelete(); - - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); - Assert.That(retrievedPart, Is.Null); - } - - /// - /// Test deleting an object from a scene where the deleter is not the owner - /// - /// - /// This test assumes that the deleter is not a god. - [Test] - public void TestDeRezSceneObjectNotOwner() - { - TestHelper.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); - - TestScene scene = SceneSetupHelpers.SetupScene(); - IConfigSource configSource = new IniConfigSource(); - IConfig config = configSource.AddConfig("Startup"); - config.Set("serverside_object_permissions", true); - SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); - - // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. - AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; - - SceneObjectPart part - = new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); - part.Name = "obj1"; - scene.AddNewSceneObject(new SceneObjectGroup(part), false); - List localIds = new List(); - localIds.Add(part.LocalId); - - scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); - sogd.InventoryDeQueueAndDelete(); - - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); - Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); - } - } -} \ No newline at end of file -- cgit v1.1 From a4309578e24e57f596a881ba5e55b81cca74c3ec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 14 Dec 2010 16:04:28 -0800 Subject: Another stab at #LoginLag. Looking forward to hear the feedback! This makes updates for self movement as absolute top priority, going in to the unthrottled category. Self only, not other avies. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 979dd47..2a59a0c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3553,6 +3553,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); + OpenSim.Framework.Lazy> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy>(); if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; int updatesThisCall = 0; @@ -3698,7 +3699,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) + // Self updates go into a special list + terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + else + // Everything else goes here + terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); } #endregion Block Construction @@ -3708,7 +3714,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - + + if (terseAgentUpdateBlocks.IsValueCreated) + { + List blocks = terseAgentUpdateBlocks.Value; + + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; + + OutPacket(packet, ThrottleOutPacketType.Unknown, true); + } + if (objectUpdateBlocks.IsValueCreated) { List blocks = objectUpdateBlocks.Value; -- cgit v1.1 From 6b135ee371a0a78e299357b1c7086c2949059991 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 15 Dec 2010 00:14:43 +0000 Subject: fix mistake in last change of local.include --- OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index b3b99f4..39116b6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -43,13 +43,14 @@ using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.Framework.Scenes.Tests { /// - /// Tests manipulation of scene objects by users. + /// Tests derez of scene objects by users. /// - /// + /// /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. - /// FIXME: These tests are very incomplete - they only test for a few conditions. + /// TODO: These tests are very incomplete - they only test for a few conditions. + /// [TestFixture] - public class SceneObjectUserTests + public class SceneObjectDeRezTests { /// /// Test deleting an object from a scene. @@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); sogd.InventoryDeQueueAndDelete(); + // Object should still be in the scene. SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); } -- cgit v1.1