aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs71
1 files changed, 53 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index c51f235..d929be2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -92,7 +92,39 @@ namespace OpenSim.Region.Environment.Scenes
92 /// Signal whether the non-inventory attributes of any prims in the group have changed 92 /// Signal whether the non-inventory attributes of any prims in the group have changed
93 /// since the group's last persistent backup 93 /// since the group's last persistent backup
94 /// </summary> 94 /// </summary>
95 public bool HasGroupChanged = false; 95 private bool m_hasGroupChanged = false;
96 private long timeFirstChanged;
97 private long timeLastChanged;
98
99 public bool HasGroupChanged
100 {
101 set
102 {
103 if (value)
104 {
105 timeLastChanged = DateTime.Now.Ticks;
106 if (!m_hasGroupChanged)
107 timeFirstChanged = DateTime.Now.Ticks;
108 }
109 m_hasGroupChanged = value;
110 }
111
112 get { return m_hasGroupChanged; }
113 }
114
115 private bool isTimeToPersist()
116 {
117 if (IsSelected || IsDeleted || IsAttachment)
118 return false;
119 if (!m_hasGroupChanged)
120 return false;
121 if (m_scene.ShuttingDown)
122 return true;
123 long currentTime = DateTime.Now.Ticks;
124 if (currentTime - timeLastChanged > m_scene.m_dontPersistBefore || currentTime - timeFirstChanged > m_scene.m_persistAfter)
125 return true;
126 return false;
127 }
96 128
97 /// <value> 129 /// <value>
98 /// Is this scene object acting as an attachment? 130 /// Is this scene object acting as an attachment?
@@ -1190,25 +1222,28 @@ namespace OpenSim.Region.Environment.Scenes
1190 1222
1191 try 1223 try
1192 { 1224 {
1193 ILandObject parcel = m_scene.LandChannel.GetLandObject( 1225 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart
1194 m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
1195
1196 if (parcel != null && parcel.landData != null &&
1197 parcel.landData.OtherCleanTime != 0)
1198 { 1226 {
1199 if (parcel.landData.OwnerID != OwnerID && 1227 ILandObject parcel = m_scene.LandChannel.GetLandObject(
1200 (parcel.landData.GroupID != GroupID || 1228 m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
1201 parcel.landData.GroupID == UUID.Zero)) 1229
1230 if (parcel != null && parcel.landData != null &&
1231 parcel.landData.OtherCleanTime != 0)
1202 { 1232 {
1203 if ((DateTime.Now - RootPart.Rezzed).TotalMinutes > 1233 if (parcel.landData.OwnerID != OwnerID &&
1204 parcel.landData.OtherCleanTime) 1234 (parcel.landData.GroupID != GroupID ||
1235 parcel.landData.GroupID == UUID.Zero))
1205 { 1236 {
1206 m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1237 if ((DateTime.Now - RootPart.Rezzed).TotalMinutes >
1207 m_scene.AddReturn(OwnerID, Name, AbsolutePosition); 1238 parcel.landData.OtherCleanTime)
1208 m_scene.DeRezObject(null, RootPart.LocalId, 1239 {
1209 RootPart.GroupID, 9, UUID.Zero); 1240 m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
1241 m_scene.AddReturn(OwnerID, Name, AbsolutePosition);
1242 m_scene.DeRezObject(null, RootPart.LocalId,
1243 RootPart.GroupID, 9, UUID.Zero);
1210 1244
1211 return; 1245 return;
1246 }
1212 } 1247 }
1213 } 1248 }
1214 } 1249 }
@@ -1216,7 +1251,7 @@ namespace OpenSim.Region.Environment.Scenes
1216 if (HasGroupChanged) 1251 if (HasGroupChanged)
1217 { 1252 {
1218 // don't backup while it's selected or you're asking for changes mid stream. 1253 // don't backup while it's selected or you're asking for changes mid stream.
1219 if (!(IsSelected || IsDeleted || IsAttachment)) 1254 if (isTimeToPersist())
1220 { 1255 {
1221 m_log.DebugFormat( 1256 m_log.DebugFormat(
1222 "[SCENE]: Storing {0}, {1} in {2}", 1257 "[SCENE]: Storing {0}, {1} in {2}",
@@ -1227,9 +1262,9 @@ namespace OpenSim.Region.Environment.Scenes
1227 backup_group.RootPart.Acceleration = RootPart.Acceleration; 1262 backup_group.RootPart.Acceleration = RootPart.Acceleration;
1228 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1263 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
1229 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 1264 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1265 HasGroupChanged = false;
1230 1266
1231 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1267 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
1232 HasGroupChanged = false;
1233 1268
1234 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); }); 1269 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); });
1235 1270