From d9a300fa8e680ec3f41f966e87408e58f3aa0e39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Jun 2017 20:19:13 +0100 Subject: some cleanup.. remove some stats that only some do look at once on a lifetime --- OpenSim/Framework/ClientInfo.cs | 10 -- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 65 ++---------- .../CoreModules/Avatar/Friends/FriendsModule.cs | 5 +- .../CoreModules/Avatar/Friends/HGFriendsModule.cs | 4 +- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 110 --------------------- 5 files changed, 13 insertions(+), 181 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs index 98e4465..a1ca9bc 100644 --- a/OpenSim/Framework/ClientInfo.cs +++ b/OpenSim/Framework/ClientInfo.cs @@ -36,14 +36,8 @@ namespace OpenSim.Framework public readonly DateTime StartedTime = DateTime.Now; public AgentCircuitData agentcircuit = null; - public Dictionary needAck; - - public List out_packets = new List(); - public Dictionary pendingAcks = new Dictionary(); public EndPoint proxyEP; - public uint sequence; - public byte[] usecircuit; public EndPoint userEP; public int resendThrottle; @@ -59,9 +53,5 @@ namespace OpenSim.Framework public int targetThrottle; public int maxThrottle; - - public Dictionary SyncRequests = new Dictionary(); - public Dictionary AsyncRequests = new Dictionary(); - public Dictionary GenericRequests = new Dictionary(); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 54359eb..01c1fb9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -706,36 +706,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// true if the handler was added. This is currently always the case. public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) { - return AddLocalPacketHandler(packetType, handler, doAsync, false); - } - - /// - /// Add a handler for the given packet type. - /// - /// - /// - /// - /// If true, when the packet is received handle it on a different thread. Whether this is given direct to - /// a threadpool thread or placed in a queue depends on the inEngine parameter. - /// - /// - /// If async is false then this parameter is ignored. - /// If async is true and inEngine is false, then the packet is sent directly to a - /// threadpool thread. - /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine. - /// This may result in slower handling but reduces the risk of overloading the simulator when there are many - /// simultaneous async requests. - /// - /// true if the handler was added. This is currently always the case. - public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync, bool inEngine) - { bool result = false; lock (m_packetHandlers) { if (!m_packetHandlers.ContainsKey(packetType)) { m_packetHandlers.Add( - packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine }); + packetType, new PacketProcessor() { method = handler, Async = doAsync}); result = true; } } @@ -770,31 +747,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketProcessor pprocessor; if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor)) { - ClientInfo cinfo = UDPClient.GetClientInfo(); //there is a local handler for this packet type if (pprocessor.Async) { - if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString())) - cinfo.AsyncRequests[packet.Type.ToString()] = 0; - cinfo.AsyncRequests[packet.Type.ToString()]++; - object obj = new AsyncPacketProcess(this, pprocessor.method, packet); -/* - if (pprocessor.InEngine) - m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); - else - Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString()); -*/ m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); result = true; } else { - if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString())) - cinfo.SyncRequests[packet.Type.ToString()] = 0; - cinfo.SyncRequests[packet.Type.ToString()]++; - result = pprocessor.method(this, packet); } } @@ -809,11 +771,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } if (found) { - ClientInfo cinfo = UDPClient.GetClientInfo(); - if (!cinfo.GenericRequests.ContainsKey(packet.Type.ToString())) - cinfo.GenericRequests[packet.Type.ToString()] = 0; - cinfo.GenericRequests[packet.Type.ToString()]++; - result = method(this, packet); } } @@ -5995,10 +5952,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); - AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage, true, true); - AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest, true, true); + AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); + AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); - AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate, true, true); + AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage); AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); @@ -6040,8 +5997,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams); AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate); AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects); - AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect, true, true); - AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect, true, true); + AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect); + AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect); AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition); AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); @@ -6185,8 +6142,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete); AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete); AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate); - AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate, true, true); - AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate, true, true); + AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate); + AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate); AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights); AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery); AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry); @@ -13436,7 +13393,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendAssetNotFound(req); return; } - } if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) @@ -13513,11 +13469,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public bool Async { get; set; } - /// - /// If async is true, should this packet be handled in the async engine or given directly to a threadpool - /// thread? - /// - public bool InEngine { get; set; } } public class AsyncPacketProcess diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 91f19e3..772485c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -247,11 +247,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { FriendInfo[] friends = GetFriendsFromCache(principalID); FriendInfo finfo = GetFriend(friends, friendID); - if (finfo != null) + if (finfo != null && finfo.TheirFlags != -1) { return finfo.TheirFlags; } - return 0; } @@ -756,7 +755,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friend == null) return; - if((friend.TheirFlags & (int)FriendRights.CanSeeOnMap) == 0) + if(friend.TheirFlags == -1 || (friend.TheirFlags & (int)FriendRights.CanSeeOnMap) == 0) return; Scene hunterScene = (Scene)remoteClient.Scene; diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 82154bc..fae1e05 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -214,7 +214,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendInfo[] friends = GetFriendsFromCache(client.AgentId); foreach (FriendInfo f in friends) { - client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags); + int rights = f.TheirFlags; + if(rights != -1 ) + client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, rights); } } } diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 3be5a07..490809e 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -124,15 +124,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); - - scene.AddCommand( - "Comms", this, "show client stats", - "show client stats [first_name last_name]", - "Show client request stats", - "Without the 'first_name last_name' option, all clients are shown." - + " With the 'first_name last_name' option only a specific client is shown.", - (mod, cmd) => MainConsole.Instance.Output(HandleClientStatsReport(cmd))); - } public void RemoveRegion(Scene scene) @@ -540,107 +531,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden return report.ToString(); } - /// - /// Show client stats data - /// - /// - /// - protected string HandleClientStatsReport(string[] showParams) - { - // NOTE: This writes to m_log on purpose. We want to store this information - // in case we need to analyze it later. - // - if (showParams.Length <= 4) - { - m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}", "Region", "Name", "Root", "Time", "Reqs/min", "AgentUpdates"); - foreach (Scene scene in m_scenes.Values) - { - scene.ForEachClient( - delegate(IClientAPI client) - { - if (client is LLClientView) - { - LLClientView llClient = client as LLClientView; - ClientInfo cinfo = llClient.UDPClient.GetClientInfo(); - int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); - avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); - - string childAgentStatus; - - if (llClient.SceneAgent != null) - childAgentStatus = llClient.SceneAgent.IsChildAgent ? "N" : "Y"; - else - childAgentStatus = "Off!"; - - m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}", - scene.RegionInfo.RegionName, llClient.Name, - childAgentStatus, - (DateTime.Now - cinfo.StartedTime).Minutes, - avg_reqs, - string.Format( - "{0} ({1:0.00}%)", - llClient.TotalAgentUpdates, - cinfo.SyncRequests.ContainsKey("AgentUpdate") - ? (float)cinfo.SyncRequests["AgentUpdate"] / llClient.TotalAgentUpdates * 100 - : 0)); - } - }); - } - return string.Empty; - } - - string fname = "", lname = ""; - - if (showParams.Length > 3) - fname = showParams[3]; - if (showParams.Length > 4) - lname = showParams[4]; - - foreach (Scene scene in m_scenes.Values) - { - scene.ForEachClient( - delegate(IClientAPI client) - { - if (client is LLClientView) - { - LLClientView llClient = client as LLClientView; - - if (llClient.Name == fname + " " + lname) - { - - ClientInfo cinfo = llClient.GetClientInfo(); - AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(llClient.CircuitCode); - if (aCircuit == null) // create a dummy one - aCircuit = new AgentCircuitData(); - - if (!llClient.SceneAgent.IsChildAgent) - m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0); - - int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); - avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); - - m_log.InfoFormat("[INFO]:"); - m_log.InfoFormat("[INFO]: {0} # {1} # Time: {2}min # Avg Reqs/min: {3}", scene.RegionInfo.RegionName, - (llClient.SceneAgent.IsChildAgent ? "Child" : "Root"), (DateTime.Now - cinfo.StartedTime).Minutes, avg_reqs); - - Dictionary sortedDict = (from entry in cinfo.AsyncRequests orderby entry.Value descending select entry) - .ToDictionary(pair => pair.Key, pair => pair.Value); - PrintRequests("TOP ASYNC", sortedDict, cinfo.AsyncRequests.Values.Sum()); - - sortedDict = (from entry in cinfo.SyncRequests orderby entry.Value descending select entry) - .ToDictionary(pair => pair.Key, pair => pair.Value); - PrintRequests("TOP SYNC", sortedDict, cinfo.SyncRequests.Values.Sum()); - - sortedDict = (from entry in cinfo.GenericRequests orderby entry.Value descending select entry) - .ToDictionary(pair => pair.Key, pair => pair.Value); - PrintRequests("TOP GENERIC", sortedDict, cinfo.GenericRequests.Values.Sum()); - } - } - }); - } - return string.Empty; - } - private void PrintRequests(string type, Dictionary sortedDict, int sum) { m_log.InfoFormat("[INFO]:"); -- cgit v1.1 From 1c64b5018ac93abf7ffc150fb66066041c9a0902 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Jun 2017 22:05:53 +0100 Subject: fix llsd DeserialiseOSDMap cast from boolean to int, this seems to fix alchemy beta 5.0 scripts upload, but this viewer seems to be of no use for opensim, sice it does crash.. insists lbsa is at second life etc --- OpenSim/Capabilities/LLSDHelpers.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/LLSDHelpers.cs b/OpenSim/Capabilities/LLSDHelpers.cs index 8f1a40e..d582267 100644 --- a/OpenSim/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Capabilities/LLSDHelpers.cs @@ -157,6 +157,11 @@ namespace OpenSim.Framework.Capabilities // the LLSD map/array types in the array need to be deserialised // but first we need to know the right class to deserialise them into. } + else if(enumerator.Value is Boolean && field.FieldType == typeof(int) ) + { + int i = (bool)enumerator.Value ? 1 : 0; + field.SetValue(obj, (object)i); + } else { field.SetValue(obj, enumerator.Value); -- cgit v1.1 From 969d5f742cc3721a4eb53125410660dd7410ce45 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Jun 2017 04:20:32 +0100 Subject: update inventory item permissions on deattach --- .../Avatar/Attachments/AttachmentsModule.cs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index cf188aa..5bca482 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Services.Interfaces; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.CoreModules.Avatar.Attachments { @@ -896,6 +897,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (item != null) { + // attach is rez, need to update permissions + item.Flags &= ~(uint)(InventoryItemFlags.ObjectSlamPerm | InventoryItemFlags.ObjectOverwriteBase | + InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | + InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); + + uint permsBase = (uint)(PermissionMask.Copy | PermissionMask.Transfer | + PermissionMask.Modify | PermissionMask.Move | + PermissionMask.Export | PermissionMask.FoldedMask); + + permsBase &= grp.CurrentAndFoldedNextPermissions(); + permsBase |= (uint)PermissionMask.Move; + item.BasePermissions = permsBase; + item.CurrentPermissions = permsBase; + item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask | (uint)PermissionMask.Move; + item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; + item.GroupPermissions = permsBase & grp.RootPart.GroupMask; + item.CurrentPermissions &= + ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify | + (uint)PermissionMask.Move | + (uint)PermissionMask.Export | + (uint)PermissionMask.FoldedMask); // Preserve folded permissions ?? + AssetBase asset = m_scene.CreateAsset( grp.GetPartName(grp.LocalId), grp.GetPartDescription(grp.LocalId), -- cgit v1.1 From 822574df9f3889c877035d302f9060769ed27e70 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Jun 2017 20:28:20 +0100 Subject: change the clock source for EnvironmentTickCount so it does get a bit more resolution if avaiable (1ms) specially on windows. This until all calls to this are removed. Coment out some stats in workpool/threads creation path --- OpenSim/Framework/Util.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 9a1e348..a855767 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2617,7 +2617,7 @@ namespace OpenSim.Framework public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context, bool dotimeout = true) { Interlocked.Increment(ref numTotalThreadFuncsCalled); - +/* if (context != null) { if (!m_fireAndForgetCallsMade.ContainsKey(context)) @@ -2630,7 +2630,7 @@ namespace OpenSim.Framework else m_fireAndForgetCallsInProgress[context]++; } - +*/ WaitCallback realCallback; bool loggingEnabled = LogThreadPool > 0; @@ -2647,8 +2647,8 @@ namespace OpenSim.Framework Culture.SetCurrentCulture(); callback(o); - if (context != null) - m_fireAndForgetCallsInProgress[context]--; +// if (context != null) +// m_fireAndForgetCallsInProgress[context]--; }; } else @@ -2688,8 +2688,8 @@ namespace OpenSim.Framework if ((loggingEnabled || (threadFuncOverloadMode == 1)) && threadInfo.LogThread) m_log.DebugFormat("Exit threadfunc {0} ({1})", threadFuncNum, FormatDuration(threadInfo.Elapsed())); - if (context != null) - m_fireAndForgetCallsInProgress[context]--; +// if (context != null) +// m_fireAndForgetCallsInProgress[context]--; } }; } @@ -2967,7 +2967,8 @@ namespace OpenSim.Framework /// public static Int32 EnvironmentTickCount() { - return Environment.TickCount & EnvironmentTickCountMask; + double now = GetTimeStampMS(); + return (int)now; } const Int32 EnvironmentTickCountMask = 0x3fffffff; @@ -2993,7 +2994,8 @@ namespace OpenSim.Framework /// subtraction of passed prevValue from current Environment.TickCount public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) { - return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); + double now = GetTimeStampMS(); + return EnvironmentTickCountSubtract((int)now, prevValue); } // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount -- cgit v1.1