Browse Source

Merge branch 'master' into httptests

UbitUmarov 7 years ago
parent
commit
eea247fcc5

+ 4 - 3
OpenSim/Data/PGSQL/PGSQLSimulationData.cs

@@ -1789,6 +1789,7 @@ namespace OpenSim.Data.PGSQL
             prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
 
             prim.PassTouches = (bool)primRow["PassTouches"];
+            prim.PassCollisions = (bool)primRow["PassCollisions"];
 
             if (!(primRow["MediaURL"] is System.DBNull))
                 prim.MediaUrl = (string)primRow["MediaURL"];
@@ -2212,7 +2213,7 @@ namespace OpenSim.Data.PGSQL
             parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
 
             parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
-            parameters.Add(_Database.CreateParameter("PassCollisions", prim.PassCollisions));
+            parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions));
             
             
             if (prim.PassTouches)
@@ -2221,9 +2222,9 @@ namespace OpenSim.Data.PGSQL
                 parameters.Add(_Database.CreateParameter("PassTouches", false));
 
             if (prim.PassCollisions)
-                parameters.Add(_Database.CreateParameter("PassCollisions", 1));
+                parameters.Add(_Database.CreateParameter("PassCollisions", true));
             else
-                parameters.Add(_Database.CreateParameter("PassCollisions", 0));
+                parameters.Add(_Database.CreateParameter("PassCollisions", false));
 
             parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
             parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));

+ 14 - 0
OpenSim/Data/PGSQL/Resources/RegionStore.migrations

@@ -1211,3 +1211,17 @@ BEGIN TRANSACTION;
 ALTER TABLE prims ADD "PhysInertia" TEXT;
 
 COMMIT;
+
+
+:VERSION 47 #---- Convert field PassCollisions in table prims to BOOLEAN
+
+BEGIN TRANSACTION;
+
+ALTER TABLE "public"."prims" ALTER COLUMN "PassCollisions" DROP DEFAULT;
+ALTER TABLE "public"."prims"
+    ALTER COLUMN "PassCollisions" TYPE BOOLEAN
+        USING CASE WHEN "PassCollisions" = 0 THEN FALSE
+            WHEN "PassCollisions" = 1 THEN TRUE
+            ELSE NULL
+            END;
+COMMIT;

+ 34 - 30
OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs

@@ -74,21 +74,19 @@ namespace OpenSim.Framework
                 {
                     rwLock.EnterWriteLock();
                     gotLock = true;
+                    if (Dictionary1.ContainsKey(key1))
+                    {
+                        if (!Dictionary2.ContainsKey(key2))
+                            throw new ArgumentException("key1 exists in the dictionary but not key2");
+                    }
+                    else if (Dictionary2.ContainsKey(key2))
+                    {
+                        if (!Dictionary1.ContainsKey(key1))
+                            throw new ArgumentException("key2 exists in the dictionary but not key1");
+                    }
+                    Dictionary1[key1] = value;
+                    Dictionary2[key2] = value;
                 }
-
-                if (Dictionary1.ContainsKey(key1))
-                {
-                    if (!Dictionary2.ContainsKey(key2))
-                        throw new ArgumentException("key1 exists in the dictionary but not key2");
-                }
-                else if (Dictionary2.ContainsKey(key2))
-                {
-                    if (!Dictionary1.ContainsKey(key1))
-                        throw new ArgumentException("key2 exists in the dictionary but not key1");
-                }
-
-                Dictionary1[key1] = value;
-                Dictionary2[key2] = value;
             }
             finally
             {
@@ -112,10 +110,9 @@ namespace OpenSim.Framework
                 {
                     rwLock.EnterWriteLock();
                     gotLock = true;
+                    Dictionary1.Remove(key1);
+                    success = Dictionary2.Remove(key2);
                 }
-
-                Dictionary1.Remove(key1);
-                success = Dictionary2.Remove(key2);
             }
             finally
             {
@@ -151,8 +148,12 @@ namespace OpenSim.Framework
                     {
                         if (kvp.Value.Equals(value))
                         {
-                            Dictionary1.Remove(key1);
-                            Dictionary2.Remove(kvp.Key);
+                            try { }
+                            finally
+                            {
+                                Dictionary1.Remove(key1);
+                                Dictionary2.Remove(kvp.Key);
+                            }
                             found = true;
                             break;
                         }
@@ -193,8 +194,12 @@ namespace OpenSim.Framework
                     {
                         if (kvp.Value.Equals(value))
                         {
-                            Dictionary2.Remove(key2);
-                            Dictionary1.Remove(kvp.Key);
+                            try { }
+                            finally
+                            {
+                                Dictionary2.Remove(key2);
+                                Dictionary1.Remove(kvp.Key);
+                            }
                             found = true;
                             break;
                         }
@@ -224,10 +229,9 @@ namespace OpenSim.Framework
                 {
                     rwLock.EnterWriteLock();
                     gotLock = true;
+                    Dictionary1.Clear();
+                    Dictionary2.Clear();
                 }
-
-                Dictionary1.Clear();
-                Dictionary2.Clear();
             }
             finally
             {
@@ -485,15 +489,15 @@ namespace OpenSim.Framework
                     try {}
                     finally
                     {
-                        rwLock.EnterUpgradeableReadLock();
+                        rwLock.EnterWriteLock();
                         gotWriteLock = true;
-                    }
 
-                    for (int i = 0; i < list.Count; i++)
-                        Dictionary1.Remove(list[i]);
+                        for (int i = 0; i < list.Count; i++)
+                            Dictionary1.Remove(list[i]);
 
-                    for (int i = 0; i < list2.Count; i++)
-                        Dictionary2.Remove(list2[i]);
+                        for (int i = 0; i < list2.Count; i++)
+                            Dictionary2.Remove(list2[i]);
+                    }
                 }
                 finally
                 {

+ 2 - 0
OpenSim/Framework/ILandChannel.cs

@@ -76,6 +76,8 @@ namespace OpenSim.Region.Framework.Interfaces
         /// <returns></returns>
         ILandObject GetLandObject(int localID);
 
+        ILandObject GetLandObject(UUID GlobalID);
+
         /// <summary>
         /// Clear the land channel of all parcels.
         /// </summary>

+ 2 - 0
OpenSim/Framework/ILandObject.cs

@@ -189,5 +189,7 @@ namespace OpenSim.Framework
         /// </summary>
         /// <returns>The music url.</returns>
         string GetMusicUrl();
+
+        void Clear();
     }
 }

+ 8 - 4
OpenSim/Framework/LandData.cs

@@ -97,7 +97,9 @@ namespace OpenSim.Framework
         private bool _mediaLoop = false;
         private bool _obscureMusic = false;
         private bool _obscureMedia = false;
-        private float _dwell = 0;
+
+        private float m_dwell = 0;
+        public double LastDwellTimeMS;
 
         public bool SeeAVs { get; set; }
         public bool AnyAVSounds { get; set; }
@@ -111,11 +113,12 @@ namespace OpenSim.Framework
         {
             get
             {
-                return _dwell;
+                return m_dwell;
             }
             set
             {
-                _dwell = value;
+                m_dwell = value;
+                LastDwellTimeMS = Util.GetTimeStampMS();
             }
         }
 
@@ -735,6 +738,7 @@ namespace OpenSim.Framework
             SeeAVs = true;
             AnyAVSounds = true;
             GroupAVSounds = true;
+            LastDwellTimeMS = Util.GetTimeStampMS();
         }
 
         /// <summary>
@@ -784,7 +788,7 @@ namespace OpenSim.Framework
             landData._obscureMedia = _obscureMedia;
             landData._simwideArea = _simwideArea;
             landData._simwidePrims = _simwidePrims;
-            landData._dwell = _dwell;
+            landData.m_dwell = m_dwell;
             landData.SeeAVs = SeeAVs;
             landData.AnyAVSounds = AnyAVSounds;
             landData.GroupAVSounds = GroupAVSounds;

+ 6 - 1
OpenSim/Region/Application/Application.cs

@@ -74,7 +74,12 @@ namespace OpenSim
             AppDomain.CurrentDomain.UnhandledException +=
                 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
 
-            ServicePointManager.DefaultConnectionLimit = 12;
+            if(Util.IsWindows())
+                ServicePointManager.DefaultConnectionLimit = 32;
+            else
+                ServicePointManager.DefaultConnectionLimit = 12;
+
+            ServicePointManager.Expect100Continue = false;
             ServicePointManager.UseNagleAlgorithm = false;
 
             // Add the arguments supplied when running the application to the configuration

+ 1 - 5
OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs

@@ -3111,10 +3111,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 
         public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
         {
-            float dwell = 0.0f;
-            IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
-            if (dwellModule != null)
-                dwell = dwellModule.GetDwell(land.GlobalID);
             ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
             reply.AgentData.AgentID = m_agentId;
             reply.Data.ParcelID = parcelID;
@@ -3141,7 +3137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
             reply.Data.GlobalZ = pos.Z;
             reply.Data.SimName = Utils.StringToBytes(info.RegionName);
             reply.Data.SnapshotID = land.SnapshotID;
-            reply.Data.Dwell = dwell;
+            reply.Data.Dwell = land.Dwell;
             reply.Data.SalePrice = land.SalePrice;
             reply.Data.AuctionID = (int)land.AuctionID;
 

+ 5 - 1
OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs

@@ -151,7 +151,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
                     x = rx - s.RegionInfo.WorldLocX;
                     y = ry - s.RegionInfo.WorldLocY;
                     regionAccess = s.RegionInfo.AccessLevel;
-                    return s.GetLandData(x, y);
+                    LandData land = s.GetLandData(x, y);
+                    IDwellModule dwellModule = s.RequestModuleInterface<IDwellModule>();
+                    if (dwellModule != null)
+                        land.Dwell = dwellModule.GetDwell(land);
+                    return land; 
                 }
             }
             m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle);

+ 4 - 0
OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs

@@ -143,6 +143,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
                 {
                     LandData land = s.GetLandData(x, y);
                     regionAccess = s.RegionInfo.AccessLevel;
+                    IDwellModule dwellModule = s.RequestModuleInterface<IDwellModule>();
+                    if (dwellModule != null)
+                        land.Dwell = dwellModule.GetDwell(land);
+
                     return land;
                 }
             }

+ 23 - 4
OpenSim/Region/CoreModules/World/Land/DwellModule.cs

@@ -53,7 +53,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
 namespace OpenSim.Region.CoreModules.World.Land
 {
     [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")]
-    public class DefaultDwellModule : IDwellModule, INonSharedRegionModule
+    public class DefaultDwellModule : INonSharedRegionModule, IDwellModule
     {
         private Scene m_scene;
         private IConfigSource m_Config;
@@ -88,16 +88,21 @@ namespace OpenSim.Region.CoreModules.World.Land
                 return;
 
             m_scene = scene;
-
-            m_scene.EventManager.OnNewClient += OnNewClient;
+            m_scene.RegisterModuleInterface<IDwellModule>(this);
         }
 
         public void RegionLoaded(Scene scene)
         {
+            if (!m_Enabled)
+                return;
+            m_scene.EventManager.OnNewClient += OnNewClient;
         }
 
         public void RemoveRegion(Scene scene)
         {
+            if (!m_Enabled)
+                return;
+            m_scene.EventManager.OnNewClient -= OnNewClient;
         }
 
         public void Close()
@@ -115,12 +120,26 @@ namespace OpenSim.Region.CoreModules.World.Land
             if (parcel == null)
                 return;
 
-            client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell);
+            LandData land = parcel.LandData;
+            if(land!= null)
+                client.SendParcelDwellReply(localID, land.GlobalID, land.Dwell);
         }
 
+
         public int GetDwell(UUID parcelID)
         {
+            ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID);
+            if (parcel != null && parcel.LandData != null)
+               return (int)(parcel.LandData.Dwell);
+            return 0;
+        }
+
+        public int GetDwell(LandData land)
+        {
+            if (land != null)
+               return (int)(land.Dwell);
             return 0;
         }
+
     }
 }

+ 9 - 0
OpenSim/Region/CoreModules/World/Land/LandChannel.cs

@@ -106,6 +106,15 @@ namespace OpenSim.Region.CoreModules.World.Land
             return null;
         }
 
+        public ILandObject GetLandObject(UUID GlobalID)
+        {
+            if (m_landManagementModule != null)
+            {
+                return m_landManagementModule.GetLandObject(GlobalID);
+            }
+            return null;
+        }
+
         public ILandObject GetLandObject(Vector3 position)
         {
             return GetLandObject(position.X, position.Y);

+ 47 - 18
OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs

@@ -92,6 +92,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         //ubit: removed the readonly so i can move it around
         private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
+        private Dictionary<UUID, int> m_landUUIDList = new Dictionary<UUID, int>();
 
         private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
 
@@ -249,7 +250,10 @@ namespace OpenSim.Region.CoreModules.World.Land
             lock (m_landList)
             {
                 if (m_landList.TryGetValue(local_id, out land))
+                {
                     land.LandData = newData;
+                    m_landUUIDList[newData.GlobalID] = local_id;
+                }
             }
 
             if (land != null)
@@ -270,7 +274,11 @@ namespace OpenSim.Region.CoreModules.World.Land
             //Remove all the land objects in the sim and add a blank, full sim land object set to public
             lock (m_landList)
             {
+                foreach(ILandObject parcel in m_landList.Values)
+                    parcel.Clear();
+
                 m_landList.Clear();
+                m_landUUIDList.Clear();
                 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
 
                 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
@@ -588,10 +596,8 @@ namespace OpenSim.Region.CoreModules.World.Land
         /// The land object being added.
         /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted.
         /// </param>
-        public ILandObject AddLandObject(ILandObject land)
+        public ILandObject AddLandObject(ILandObject new_land)
         {
-            ILandObject new_land = land.Copy();
-
             // Only now can we add the prim counts to the land object - we rely on the global ID which is generated
             // as a random UUID inside LandData initialization
             if (m_primCountModule != null)
@@ -656,6 +662,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                 }
 
                 m_landList.Add(newLandLocalID, new_land);
+                m_landUUIDList[new_land.LandData.GlobalID] = newLandLocalID;
                 m_lastLandLocalID++;
             }
 
@@ -690,6 +697,9 @@ namespace OpenSim.Region.CoreModules.World.Land
 
                 land = m_landList[local_id];
                 m_landList.Remove(local_id);
+                if(land.LandData != null)
+                    m_landUUIDList.Remove(land.LandData.GlobalID);
+                land.Clear();
             }
 
             m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
@@ -740,11 +750,29 @@ namespace OpenSim.Region.CoreModules.World.Land
                     }
                 }
             }
-
+            master.LandData.Dwell += slave.LandData.Dwell;
             removeLandObject(slave.LandData.LocalID);
             UpdateLandObject(master.LandData.LocalID, master.LandData);
         }
 
+        public ILandObject GetLandObject(UUID globalID)
+        {
+            lock (m_landList)
+            {
+                int lid = -1;
+                if(m_landUUIDList.TryGetValue(globalID, out lid) && lid >= 0)
+                {
+                    if (m_landList.ContainsKey(lid))
+                    {
+                        return m_landList[lid];
+                    }
+                    else
+                        m_landUUIDList.Remove(globalID); // auto heal
+                }
+            }
+            return null;
+        }
+
         public ILandObject GetLandObject(int parcelLocalID)
         {
             lock (m_landList)
@@ -1351,7 +1379,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client)
         {
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(local_id, out land);
@@ -1360,7 +1388,7 @@ namespace OpenSim.Region.CoreModules.World.Land
             if (land != null)
             {
                 m_scene.EventManager.TriggerParcelPrimCountUpdate();
-                m_landList[local_id].SendLandObjectOwners(remote_client);
+                land.SendLandObjectOwners(remote_client);
             }
             else
             {
@@ -1370,7 +1398,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client)
         {
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(local_id, out land);
@@ -1393,7 +1421,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client)
         {
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(local_id, out land);
@@ -1417,7 +1445,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client)
         {
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(local_id, out land);
@@ -1503,17 +1531,16 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client)
         {
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(parcelLocalID, out land);
             }
 
-            if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land))
-                return;
-
             if (land != null)
             {
+                if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land))
+                    return;
                 land.DeedToGroup(groupID);
             }
         }
@@ -1587,8 +1614,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         private void IncomingLandObjectFromStorage(LandData data)
         {
-            ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
-            new_land.LandData = data.Copy();
+            ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene, data);
 
             new_land.SetLandBitmapFromByteArray();
             AddLandObject(new_land);
@@ -1763,7 +1789,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                 land_update.GroupAVSounds = true;
             }
 
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(parcelID, out land);
@@ -1926,6 +1952,9 @@ namespace OpenSim.Region.CoreModules.World.Land
                 if (data.RegionHandle == m_scene.RegionInfo.RegionHandle)
                 {
                     info = new GridRegion(m_scene.RegionInfo);
+                    IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
+                    if (dwellModule != null)
+                        data.LandData.Dwell = dwellModule.GetDwell(data.LandData);
                 }
                 else
                 {
@@ -1951,7 +1980,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
         {
-            ILandObject land;
+            ILandObject land = null;
             lock (m_landList)
             {
                 m_landList.TryGetValue(localID, out land);
@@ -2248,7 +2277,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId))
                     return;
 
-                ILandObject lo;
+                ILandObject lo = null;
 
                 lock (m_landList)
                 {

+ 55 - 2
OpenSim/Region/CoreModules/World/Land/LandObject.cs

@@ -58,6 +58,7 @@ namespace OpenSim.Region.CoreModules.World.Land
 
         protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
         protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30);  // cache invalidation after 30 seconds
+        IDwellModule m_dwellModule;
 
         private bool[,] m_landBitmap;
         public bool[,] LandBitmap
@@ -268,27 +269,48 @@ namespace OpenSim.Region.CoreModules.World.Land
         {
             LandData = landData.Copy();
             m_scene = scene;
+            m_scene.EventManager.OnFrame += OnFrame;
+            m_dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
         }
 
-        public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
+        public LandObject(UUID owner_id, bool is_group_owned, Scene scene, LandData data = null)
         {
             m_scene = scene;
             if (m_scene == null)
                 LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit];
             else
+            {
                 LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
+                m_dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
+            }
+
+            if(data == null)
+                LandData = new LandData();
+            else
+                LandData = data;
 
-            LandData = new LandData();
             LandData.OwnerID = owner_id;
             if (is_group_owned)
                 LandData.GroupID = owner_id;
             else
                 LandData.GroupID = UUID.Zero;
+            
             LandData.IsGroupOwned = is_group_owned;
 
+            if(m_dwellModule == null)
+                LandData.Dwell = 0;
+
             m_scene.EventManager.OnFrame += OnFrame;
         }
 
+        public void Clear()
+        {
+            if(m_scene != null)
+                 m_scene.EventManager.OnFrame -= OnFrame;
+            LandData = null;     
+        }
+
+
         #endregion
 
         #region Member Functions
@@ -1812,6 +1834,37 @@ namespace OpenSim.Region.CoreModules.World.Land
                 ExpireAccessList();
                 m_expiryCounter = 0;
             }
+
+            // need to update dwell here bc landdata has no parent info
+            if(LandData != null && m_dwellModule != null)
+            {
+                double now = Util.GetTimeStampMS();
+                double elapsed = now - LandData.LastDwellTimeMS;
+                if(elapsed > 150000) //2.5 minutes resolution / throttle
+                {
+                    float dwell = LandData.Dwell;
+                    double cur = dwell * 60000.0;
+                    double decay = 1.5e-8 * cur * elapsed;
+                    cur -= decay;
+                    if(cur < 0)
+                        cur = 0;
+
+                    UUID lgid = LandData.GlobalID;
+                    m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
+                    {
+                        if(sp.IsNPC || sp.IsLoggingIn || sp.IsDeleted || sp.currentParcelUUID != lgid)
+                            return;
+                        cur += (now - sp.ParcelDwellTickMS);
+                        sp.ParcelDwellTickMS = now;
+                    });
+                
+                    float newdwell = (float)(cur * 1.666666666667e-5); 
+                    LandData.Dwell = newdwell;
+
+                    if(Math.Abs(newdwell - dwell) >= 0.9)
+                        m_scene.EventManager.TriggerLandObjectAdded(this);
+                }
+            }
         }
 
         private void ExpireAccessList()

+ 1 - 0
OpenSim/Region/Framework/Interfaces/IDwellModule.cs

@@ -33,5 +33,6 @@ namespace OpenSim.Region.Framework.Interfaces
     public interface IDwellModule
     {
         int GetDwell(UUID parcelID);
+        int GetDwell(LandData land);
     }
 }

+ 3 - 0
OpenSim/Region/Framework/Scenes/ScenePresence.cs

@@ -170,6 +170,7 @@ namespace OpenSim.Region.Framework.Scenes
         private bool m_previusParcelHide = false;
         private bool m_currentParcelHide = false;
         private object parcelLock = new Object();
+        public double ParcelDwellTickMS;
 
         public UUID currentParcelUUID
         {
@@ -182,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
                     bool checksame = true;
                     if (value != m_currentParcelUUID)
                     {
+                        ParcelDwellTickMS = Util.GetTimeStampMS();
                         m_previusParcelHide = m_currentParcelHide;
                         m_previusParcelUUID = m_currentParcelUUID;
                         checksame = false;
@@ -2141,6 +2143,7 @@ namespace OpenSim.Region.Framework.Scenes
                 m_previusParcelUUID = UUID.Zero;
                 m_currentParcelHide = false;
                 m_currentParcelUUID = UUID.Zero;
+                ParcelDwellTickMS = Util.GetTimeStampMS();
 
                 if(!IsNPC)
                 {

+ 10 - 4
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs

@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
             ts.arc = arc;
             ts.host = host;
 
-            ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
+            ts.next = DateTime.UtcNow.AddSeconds(ts.interval);
 
             AddSenseRepeater(ts);
         }
@@ -196,14 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
         public void CheckSenseRepeaterEvents()
         {
             // Go through all timers
-            foreach (SensorInfo ts in SenseRepeaters)
+
+            List<SensorInfo> curSensors;
+            lock(SenseRepeatListLock)
+                curSensors = SenseRepeaters;
+
+            DateTime now = DateTime.UtcNow;
+            foreach (SensorInfo ts in curSensors)
             {
                 // Time has passed?
-                if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
+                if (ts.next < now)
                 {
                     SensorSweep(ts);
                     // set next interval
-                    ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
+                    ts.next = now.AddSeconds(ts.interval);
                 }
             }
         }

+ 1 - 0
OpenSim/Server/Handlers/Land/LandHandlers.cs

@@ -85,6 +85,7 @@ namespace OpenSim.Server.Handlers.Land
                 hash["SnapshotID"] = landData.SnapshotID.ToString();
                 hash["UserLocation"] = landData.UserLocation.ToString();
                 hash["RegionAccess"] = regionAccess.ToString();
+                hash["Dwell"] = landData.Dwell.ToString();
             }
 
             XmlRpcResponse response = new XmlRpcResponse();

+ 2 - 2
OpenSim/Server/ServerMain.cs

@@ -76,8 +76,8 @@ namespace OpenSim.Server
 
         public static int Main(string[] args)
         {
-            // Make sure we don't get outbound connections queueing
-            ServicePointManager.DefaultConnectionLimit = 50;
+            ServicePointManager.DefaultConnectionLimit = 64;
+            ServicePointManager.Expect100Continue = false;
             ServicePointManager.UseNagleAlgorithm = false;
             ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
 

+ 2 - 0
OpenSim/Services/Connectors/Land/LandServicesConnector.cs

@@ -117,6 +117,8 @@ namespace OpenSim.Services.Connectors
                             landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
                             if (hash["RegionAccess"] != null)
                                 regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]);
+                            if(hash["Dwell"] != null)
+                                landData.Dwell = Convert.ToSingle((string)hash["Dwell"]);
                             m_log.DebugFormat("[LAND CONNECTOR]: Got land data for parcel {0}", landData.Name);
                         }
                         catch (Exception e)

+ 6 - 5
OpenSim/Services/HypergridService/GatekeeperService.cs

@@ -376,7 +376,8 @@ namespace OpenSim.Services.HypergridService
                 return false;
             }
 
-            if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
+            UUID agentID = aCircuit.AgentID;
+            if(agentID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
             {
                 // really?
                 reason = "Invalid account ID";
@@ -385,21 +386,21 @@ namespace OpenSim.Services.HypergridService
 
             if(m_GridUserService != null)
             {
-                string PrincipalIDstr = account.PrincipalID.ToString();
+                string PrincipalIDstr = agentID.ToString();
                 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr);
 
                 if(!m_allowDuplicatePresences)
                 {
                     if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero)
                     {
-                        if(SendAgentGodKillToRegion(UUID.Zero, account.PrincipalID, guinfo))
+                        if(SendAgentGodKillToRegion(UUID.Zero, agentID, guinfo))
                         {
                             m_log.InfoFormat(
                                 "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in",
                                 account.FirstName, account.LastName);
-                            reason = "You appear to be already logged in on destiny grid " +
+                            reason = "You appear to be already logged in on the destination grid " +
                                     "Please wait a a minute or two and retry. " +
-                                    "If this takes longer than a few minutes please contact the grid owner. ";
+                                    "If this takes longer than a few minutes please contact the grid owner.";
                             return false;
                         }
                     }

+ 5 - 0
OpenSim/Tests/Common/Mock/TestLandChannel.cs

@@ -96,6 +96,11 @@ namespace OpenSim.Tests.Common
             return GetNoLand();
         }
 
+        public ILandObject GetLandObject(UUID ID)
+        {
+            return GetNoLand();
+        }
+
         public ILandObject GetLandObject(float x, float y)
         {
             return GetNoLand();

+ 1 - 0
bin/OpenSim.exe.config

@@ -8,6 +8,7 @@
   </runtime>
   <appSettings>
   </appSettings>
+  
   <log4net>
     <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
       <filter type="log4net.Filter.LoggerMatchFilter">

+ 1 - 0
bin/Robust.exe.config

@@ -8,6 +8,7 @@
   </runtime>
   <appSettings>
   </appSettings>
+
   <log4net>
     <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
       <filter type="log4net.Filter.LoggerMatchFilter">

+ 0 - 2
prebuild.xml

@@ -497,7 +497,6 @@
       <Reference name="OpenSim.Framework.Monitoring"/>
       <Reference name="OpenSim.Framework.Servers"/>
       <Reference name="OpenSim.Framework.Servers.HttpServer"/>
-      <Reference name="Mono.Posix" path="../../../bin/"/>
       <Reference name="Nini" path="../../../bin/"/>
       <Reference name="log4net" path="../../../bin/"/>
 
@@ -1792,7 +1791,6 @@
       <Reference name="System.Core"/>
       <Reference name="System.Xml"/>
       <Reference name="Mono.Addins" path="../../../bin/"/>
-      <Reference name="Mono.Posix" path="../../../bin/"/>
       <Reference name="NDesk.Options" path="../../../bin/"/>
       <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
       <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>