aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-25 00:40:21 -0700
committerJohn Hurliman2009-10-25 00:40:21 -0700
commit730930955a7edc0bfa69ff1cac93acd024cf8d24 (patch)
treeae38c7d82245acdc4499d9b39a227eba541132bb
parent* Changed various modules to not initialize timers unless the module is initi... (diff)
downloadopensim-SC-730930955a7edc0bfa69ff1cac93acd024cf8d24.zip
opensim-SC-730930955a7edc0bfa69ff1cac93acd024cf8d24.tar.gz
opensim-SC-730930955a7edc0bfa69ff1cac93acd024cf8d24.tar.bz2
opensim-SC-730930955a7edc0bfa69ff1cac93acd024cf8d24.tar.xz
Changing Scene.ForEachClient to use the synchronous for loop instead of Parallel. This is quite possibly the source of some deadlocking, and at the very least the synchronous version gives better stack traces
* Lock the LLUDPClient RTO math * Add a helper function for backing off the RTO, and follow the optional advice in RFC 2988 to clear existing SRTT and RTTVAR values during a backoff * Removing the unused PrimitiveBaseShape.SculptImage parameter * Improved performance of SceneObjectPart instantiation * ZeroMesher now drops SculptData bytes like Meshmerizer, to allow the texture data to be GCed * Improved typecasting speed in MySQLLegacyRegionData.BuildShape() * Improved the instantiation of PrimitiveBaseShape
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs3
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs53
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs66
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs54
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs109
-rw-r--r--OpenSim/Region/Physics/Manager/ZeroMesher.cs3
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs2
10 files changed, 153 insertions, 145 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index fc05d1d..4d49733 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -167,9 +167,6 @@ namespace OpenSim.Data.MySQL
167 asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); 167 asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
168 } 168 }
169 } 169 }
170
171 if (asset != null)
172 UpdateAccessTime(asset);
173 } 170 }
174 catch (Exception e) 171 catch (Exception e)
175 { 172 {
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 801d6b9..c07963c 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -1430,37 +1430,36 @@ namespace OpenSim.Data.MySQL
1430 { 1430 {
1431 PrimitiveBaseShape s = new PrimitiveBaseShape(); 1431 PrimitiveBaseShape s = new PrimitiveBaseShape();
1432 s.Scale = new Vector3( 1432 s.Scale = new Vector3(
1433 Convert.ToSingle(row["ScaleX"]), 1433 (float)(double)row["ScaleX"],
1434 Convert.ToSingle(row["ScaleY"]), 1434 (float)(double)row["ScaleY"],
1435 Convert.ToSingle(row["ScaleZ"]) 1435 (float)(double)row["ScaleZ"]
1436 ); 1436 );
1437 // paths 1437 // paths
1438 s.PCode = Convert.ToByte(row["PCode"]); 1438 s.PCode = (byte)(int)row["PCode"];
1439 s.PathBegin = Convert.ToUInt16(row["PathBegin"]); 1439 s.PathBegin = (ushort)(int)row["PathBegin"];
1440 s.PathEnd = Convert.ToUInt16(row["PathEnd"]); 1440 s.PathEnd = (ushort)(int)row["PathEnd"];
1441 s.PathScaleX = Convert.ToByte(row["PathScaleX"]); 1441 s.PathScaleX = (byte)(int)row["PathScaleX"];
1442 s.PathScaleY = Convert.ToByte(row["PathScaleY"]); 1442 s.PathScaleY = (byte)(int)row["PathScaleY"];
1443 s.PathShearX = Convert.ToByte(row["PathShearX"]); 1443 s.PathShearX = (byte)(int)row["PathShearX"];
1444 s.PathShearY = Convert.ToByte(row["PathShearY"]); 1444 s.PathShearY = (byte)(int)row["PathShearY"];
1445 s.PathSkew = Convert.ToSByte(row["PathSkew"]); 1445 s.PathSkew = (sbyte)(int)row["PathSkew"];
1446 s.PathCurve = Convert.ToByte(row["PathCurve"]); 1446 s.PathCurve = (byte)(int)row["PathCurve"];
1447 s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); 1447 s.PathRadiusOffset = (sbyte)(int)row["PathRadiusOffset"];
1448 s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); 1448 s.PathRevolutions = (byte)(int)row["PathRevolutions"];
1449 s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); 1449 s.PathTaperX = (sbyte)(int)row["PathTaperX"];
1450 s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); 1450 s.PathTaperY = (sbyte)(int)row["PathTaperY"];
1451 s.PathTwist = Convert.ToSByte(row["PathTwist"]); 1451 s.PathTwist = (sbyte)(int)row["PathTwist"];
1452 s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); 1452 s.PathTwistBegin = (sbyte)(int)row["PathTwistBegin"];
1453 // profile 1453 // profile
1454 s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); 1454 s.ProfileBegin = (ushort)(int)row["ProfileBegin"];
1455 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); 1455 s.ProfileEnd = (ushort)(int)row["ProfileEnd"];
1456 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); 1456 s.ProfileCurve = (byte)(int)row["ProfileCurve"];
1457 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 1457 s.ProfileHollow = (ushort)(int)row["ProfileHollow"];
1458 byte[] textureEntry = (byte[]) row["Texture"]; 1458 s.TextureEntry = (byte[])row["Texture"];
1459 s.TextureEntry = textureEntry;
1460 1459
1461 s.ExtraParams = (byte[]) row["ExtraParams"]; 1460 s.ExtraParams = (byte[])row["ExtraParams"];
1462 1461
1463 s.State = Convert.ToByte(row["State"]); 1462 s.State = (byte)(int)row["State"];
1464 1463
1465 return s; 1464 return s;
1466 } 1465 }
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index b646f92..5e4d175 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Framework
76 { 76 {
77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
78 78
79 private static readonly Primitive.TextureEntry m_defaultTexture; 79 private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes();
80 80
81 private byte[] m_textureEntry; 81 private byte[] m_textureEntry;
82 82
@@ -104,33 +104,32 @@ namespace OpenSim.Framework
104 private HollowShape _hollowShape; 104 private HollowShape _hollowShape;
105 105
106 // Sculpted 106 // Sculpted
107 [XmlIgnore] private UUID _sculptTexture = UUID.Zero; 107 [XmlIgnore] private UUID _sculptTexture;
108 [XmlIgnore] private byte _sculptType = (byte)0; 108 [XmlIgnore] private byte _sculptType;
109 [XmlIgnore] private byte[] _sculptData = new byte[0]; 109 [XmlIgnore] private byte[] _sculptData = Utils.EmptyBytes;
110 [XmlIgnore] private Image _sculptBitmap = null;
111 110
112 // Flexi 111 // Flexi
113 [XmlIgnore] private int _flexiSoftness = 0; 112 [XmlIgnore] private int _flexiSoftness;
114 [XmlIgnore] private float _flexiTension = 0f; 113 [XmlIgnore] private float _flexiTension;
115 [XmlIgnore] private float _flexiDrag = 0f; 114 [XmlIgnore] private float _flexiDrag;
116 [XmlIgnore] private float _flexiGravity = 0f; 115 [XmlIgnore] private float _flexiGravity;
117 [XmlIgnore] private float _flexiWind = 0f; 116 [XmlIgnore] private float _flexiWind;
118 [XmlIgnore] private float _flexiForceX = 0f; 117 [XmlIgnore] private float _flexiForceX;
119 [XmlIgnore] private float _flexiForceY = 0f; 118 [XmlIgnore] private float _flexiForceY;
120 [XmlIgnore] private float _flexiForceZ = 0f; 119 [XmlIgnore] private float _flexiForceZ;
121 120
122 //Bright n sparkly 121 //Bright n sparkly
123 [XmlIgnore] private float _lightColorR = 0f; 122 [XmlIgnore] private float _lightColorR;
124 [XmlIgnore] private float _lightColorG = 0f; 123 [XmlIgnore] private float _lightColorG;
125 [XmlIgnore] private float _lightColorB = 0f; 124 [XmlIgnore] private float _lightColorB;
126 [XmlIgnore] private float _lightColorA = 1f; 125 [XmlIgnore] private float _lightColorA = 1.0f;
127 [XmlIgnore] private float _lightRadius = 0f; 126 [XmlIgnore] private float _lightRadius;
128 [XmlIgnore] private float _lightCutoff = 0f; 127 [XmlIgnore] private float _lightCutoff;
129 [XmlIgnore] private float _lightFalloff = 0f; 128 [XmlIgnore] private float _lightFalloff;
130 [XmlIgnore] private float _lightIntensity = 1f; 129 [XmlIgnore] private float _lightIntensity = 1.0f;
131 [XmlIgnore] private bool _flexiEntry = false; 130 [XmlIgnore] private bool _flexiEntry;
132 [XmlIgnore] private bool _lightEntry = false; 131 [XmlIgnore] private bool _lightEntry;
133 [XmlIgnore] private bool _sculptEntry = false; 132 [XmlIgnore] private bool _sculptEntry;
134 133
135 public byte ProfileCurve 134 public byte ProfileCurve
136 { 135 {
@@ -172,17 +171,11 @@ namespace OpenSim.Framework
172 } 171 }
173 } 172 }
174 173
175 static PrimitiveBaseShape()
176 {
177 m_defaultTexture =
178 new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f"));
179 }
180
181 public PrimitiveBaseShape() 174 public PrimitiveBaseShape()
182 { 175 {
183 PCode = (byte) PCodeEnum.Primitive; 176 PCode = (byte) PCodeEnum.Primitive;
184 ExtraParams = new byte[1]; 177 ExtraParams = new byte[1];
185 Textures = m_defaultTexture; 178 m_textureEntry = DEFAULT_TEXTURE;
186 } 179 }
187 180
188 public PrimitiveBaseShape(bool noShape) 181 public PrimitiveBaseShape(bool noShape)
@@ -192,7 +185,7 @@ namespace OpenSim.Framework
192 185
193 PCode = (byte)PCodeEnum.Primitive; 186 PCode = (byte)PCodeEnum.Primitive;
194 ExtraParams = new byte[1]; 187 ExtraParams = new byte[1];
195 Textures = m_defaultTexture; 188 m_textureEntry = DEFAULT_TEXTURE;
196 } 189 }
197 190
198 [XmlIgnore] 191 [XmlIgnore]
@@ -577,15 +570,6 @@ namespace OpenSim.Framework
577 } 570 }
578 } 571 }
579 572
580 public Image SculptBitmap {
581 get {
582 return _sculptBitmap;
583 }
584 set {
585 _sculptBitmap = value;
586 }
587 }
588
589 public int FlexiSoftness { 573 public int FlexiSoftness {
590 get { 574 get {
591 return _flexiSoftness; 575 return _flexiSoftness;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index d2cd6d9..0948e1c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -144,6 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
144 private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; 144 private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
145 /// <summary>A reference to the LLUDPServer that is managing this client</summary> 145 /// <summary>A reference to the LLUDPServer that is managing this client</summary>
146 private readonly LLUDPServer m_udpServer; 146 private readonly LLUDPServer m_udpServer;
147 /// <summary>Locks access to the variables used while calculating round-trip
148 /// packet times and the retransmission timeout</summary>
149 private readonly object m_roundTripCalcLock = new object();
147 150
148 /// <summary> 151 /// <summary>
149 /// Default constructor 152 /// Default constructor
@@ -484,29 +487,52 @@ namespace OpenSim.Region.ClientStack.LindenUDP
484 const float BETA = 0.25f; 487 const float BETA = 0.25f;
485 const float K = 4.0f; 488 const float K = 4.0f;
486 489
487 if (RTTVAR == 0.0f) 490 lock (m_roundTripCalcLock)
488 { 491 {
489 // First RTT measurement 492 if (RTTVAR == 0.0f)
490 SRTT = r; 493 {
491 RTTVAR = r * 0.5f; 494 // First RTT measurement
492 } 495 SRTT = r;
493 else 496 RTTVAR = r * 0.5f;
494 { 497 }
495 // Subsequence RTT measurement 498 else
496 RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r); 499 {
497 SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r; 500 // Subsequence RTT measurement
498 } 501 RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
502 SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
503 }
499 504
500 RTO = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); 505 int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
501 506
502 // Clamp the retransmission timeout to manageable values 507 // Clamp the retransmission timeout to manageable values
503 RTO = Utils.Clamp(RTO, 3000, 60000); 508 rto = Utils.Clamp(RTO, 3000, 60000);
509
510 RTO = rto;
511 }
504 512
505 //m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " + 513 //m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
506 // RTTVAR + " based on new RTT of " + r + "ms"); 514 // RTTVAR + " based on new RTT of " + r + "ms");
507 } 515 }
508 516
509 /// <summary> 517 /// <summary>
518 /// Exponential backoff of the retransmission timeout, per section 5.5
519 /// of RFC 2988
520 /// </summary>
521 public void BackoffRTO()
522 {
523 lock (m_roundTripCalcLock)
524 {
525 // Reset SRTT and RTTVAR, we assume they are bogus since things
526 // didn't work out and we're backing off the timeout
527 SRTT = 0.0f;
528 RTTVAR = 0.0f;
529
530 // Double the retransmission timeout
531 RTO = Math.Min(RTO * 2, 60000);
532 }
533 }
534
535 /// <summary>
510 /// Does an early check to see if this queue empty callback is already 536 /// Does an early check to see if this queue empty callback is already
511 /// running, then asynchronously firing the event 537 /// running, then asynchronously firing the event
512 /// </summary> 538 /// </summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 1dd58bf..82ae640 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -431,8 +431,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
431 { 431 {
432 m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); 432 m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
433 433
434 // Backoff the RTO 434 // Exponential backoff of the retransmission timeout
435 udpClient.RTO = Math.Min(udpClient.RTO * 2, 60000); 435 udpClient.BackoffRTO();
436 436
437 // Resend packets 437 // Resend packets
438 for (int i = 0; i < expiredPackets.Count; i++) 438 for (int i = 0; i < expiredPackets.Count; i++)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 47b13bd..f052c65 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4246,7 +4246,7 @@ namespace OpenSim.Region.Framework.Scenes
4246 4246
4247 public void ForEachClient(Action<IClientAPI> action) 4247 public void ForEachClient(Action<IClientAPI> action)
4248 { 4248 {
4249 ClientManager.ForEach(action); 4249 ClientManager.ForEachSync(action);
4250 } 4250 }
4251 4251
4252 public void ForEachSOG(Action<SceneObjectGroup> action) 4252 public void ForEachSOG(Action<SceneObjectGroup> action)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index dd8da20..34ada4c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1334,7 +1334,7 @@ namespace OpenSim.Region.Framework.Scenes
1334 (parcel.LandData.GroupID != GroupID || 1334 (parcel.LandData.GroupID != GroupID ||
1335 parcel.LandData.GroupID == UUID.Zero)) 1335 parcel.LandData.GroupID == UUID.Zero))
1336 { 1336 {
1337 if ((DateTime.Now - RootPart.Rezzed).TotalMinutes > 1337 if ((DateTime.UtcNow - RootPart.Rezzed).TotalMinutes >
1338 parcel.LandData.OtherCleanTime) 1338 parcel.LandData.OtherCleanTime)
1339 { 1339 {
1340 DetachFromBackup(); 1340 DetachFromBackup();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 7193002..d84c35c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -102,16 +102,16 @@ namespace OpenSim.Region.Framework.Scenes
102 102
103 #region Fields 103 #region Fields
104 104
105 public bool AllowedDrop = false; 105 public bool AllowedDrop;
106 106
107 [XmlIgnore] 107 [XmlIgnore]
108 public bool DIE_AT_EDGE = false; 108 public bool DIE_AT_EDGE;
109 109
110 // TODO: This needs to be persisted in next XML version update! 110 // TODO: This needs to be persisted in next XML version update!
111 [XmlIgnore] 111 [XmlIgnore]
112 public int[] PayPrice = {-2,-2,-2,-2,-2}; 112 public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
113 [XmlIgnore] 113 [XmlIgnore]
114 public PhysicsActor PhysActor = null; 114 public PhysicsActor PhysActor;
115 115
116 //Xantor 20080528 Sound stuff: 116 //Xantor 20080528 Sound stuff:
117 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. 117 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
@@ -130,55 +130,56 @@ namespace OpenSim.Region.Framework.Scenes
130 public double SoundRadius; 130 public double SoundRadius;
131 131
132 [XmlIgnore] 132 [XmlIgnore]
133 public uint TimeStampFull = 0; 133 public uint TimeStampFull;
134 134
135 [XmlIgnore] 135 [XmlIgnore]
136 public uint TimeStampLastActivity = 0; // Will be used for AutoReturn 136 public uint TimeStampLastActivity; // Will be used for AutoReturn
137 137
138 [XmlIgnore] 138 [XmlIgnore]
139 public uint TimeStampTerse = 0; 139 public uint TimeStampTerse;
140 140
141 [XmlIgnore] 141 [XmlIgnore]
142 public UUID FromItemID = UUID.Zero; 142 public UUID FromItemID;
143 143
144 /// <value> 144 /// <value>
145 /// The UUID of the user inventory item from which this object was rezzed if this is a root part. 145 /// The UUID of the user inventory item from which this object was rezzed if this is a root part.
146 /// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item. 146 /// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
147 /// </value> 147 /// </value>
148 private UUID m_fromUserInventoryItemID = UUID.Zero; 148 private UUID m_fromUserInventoryItemID;
149 149
150 [XmlIgnore] 150 [XmlIgnore]
151 public UUID FromUserInventoryItemID 151 public UUID FromUserInventoryItemID
152 { 152 {
153 get { return m_fromUserInventoryItemID; } 153 get { return m_fromUserInventoryItemID; }
154 } 154 }
155 155
156 [XmlIgnore] 156 [XmlIgnore]
157 public bool IsAttachment = false; 157 public bool IsAttachment;
158 158
159 [XmlIgnore] 159 [XmlIgnore]
160 public scriptEvents AggregateScriptEvents = 0; 160 public scriptEvents AggregateScriptEvents;
161 161
162 [XmlIgnore] 162 [XmlIgnore]
163 public UUID AttachedAvatar = UUID.Zero; 163 public UUID AttachedAvatar;
164 164
165 [XmlIgnore] 165 [XmlIgnore]
166 public Vector3 AttachedPos = Vector3.Zero; 166 public Vector3 AttachedPos;
167 167
168 [XmlIgnore] 168 [XmlIgnore]
169 public uint AttachmentPoint = (byte)0; 169 public uint AttachmentPoint;
170 170
171 [XmlIgnore] 171 [XmlIgnore]
172 public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f); 172 public PhysicsVector RotationAxis = new PhysicsVector(1f, 1f, 1f);
173 173
174 [XmlIgnore] 174 [XmlIgnore]
175 public bool VolumeDetectActive = false; // XmlIgnore set to avoid problems with persistance until I come to care for this 175 public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this
176 // Certainly this must be a persistant setting finally 176 // Certainly this must be a persistant setting finally
177 177
178 [XmlIgnore] 178 [XmlIgnore]
179 public bool IsWaitingForFirstSpinUpdatePacket = false; 179 public bool IsWaitingForFirstSpinUpdatePacket;
180
180 [XmlIgnore] 181 [XmlIgnore]
181 public Quaternion SpinOldOrientation = new Quaternion(); 182 public Quaternion SpinOldOrientation = Quaternion.Identity;
182 183
183 /// <summary> 184 /// <summary>
184 /// This part's inventory 185 /// This part's inventory
@@ -191,34 +192,32 @@ namespace OpenSim.Region.Framework.Scenes
191 protected SceneObjectPartInventory m_inventory; 192 protected SceneObjectPartInventory m_inventory;
192 193
193 [XmlIgnore] 194 [XmlIgnore]
194 public bool Undoing = false; 195 public bool Undoing;
195 196
196 [XmlIgnore] 197 [XmlIgnore]
197 private PrimFlags LocalFlags = 0; 198 private PrimFlags LocalFlags;
198 [XmlIgnore] 199 [XmlIgnore]
199 private float m_damage = -1.0f; 200 private float m_damage = -1.0f;
200 private byte[] m_TextureAnimation; 201 private byte[] m_TextureAnimation;
201 private byte m_clickAction = 0; 202 private byte m_clickAction;
202 private Color m_color = Color.Black; 203 private Color m_color = Color.Black;
203 private string m_description = String.Empty; 204 private string m_description = String.Empty;
204 private readonly List<uint> m_lastColliders = new List<uint>(); 205 private readonly List<uint> m_lastColliders = new List<uint>();
205 // private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; 206 private int m_linkNum;
206 private int m_linkNum = 0;
207 [XmlIgnore] 207 [XmlIgnore]
208 private int m_scriptAccessPin = 0; 208 private int m_scriptAccessPin;
209 [XmlIgnore] 209 [XmlIgnore]
210 private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); 210 private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
211 private string m_sitName = String.Empty; 211 private string m_sitName = String.Empty;
212 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 212 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
213 private Vector3 m_sitTargetPosition = Vector3.Zero; 213 private Vector3 m_sitTargetPosition;
214 private string m_sitAnimation = "SIT"; 214 private string m_sitAnimation = "SIT";
215 private string m_text = String.Empty; 215 private string m_text = String.Empty;
216 private string m_touchName = String.Empty; 216 private string m_touchName = String.Empty;
217 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 217 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
218 private UUID _creatorID; 218 private UUID _creatorID;
219 219
220 220 private bool m_passTouches;
221 private bool m_passTouches = false;
222 221
223 /// <summary> 222 /// <summary>
224 /// Only used internally to schedule client updates. 223 /// Only used internally to schedule client updates.
@@ -236,28 +235,28 @@ namespace OpenSim.Region.Framework.Scenes
236 //unkown if this will be kept, added as a way of removing the group position from the group class 235 //unkown if this will be kept, added as a way of removing the group position from the group class
237 protected Vector3 m_groupPosition; 236 protected Vector3 m_groupPosition;
238 protected uint m_localId; 237 protected uint m_localId;
239 protected Material m_material = (Material)3; // Wood 238 protected Material m_material = OpenMetaverse.Material.Wood;
240 protected string m_name; 239 protected string m_name;
241 protected Vector3 m_offsetPosition; 240 protected Vector3 m_offsetPosition;
242 241
243 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. 242 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
244 protected SceneObjectGroup m_parentGroup; 243 protected SceneObjectGroup m_parentGroup;
245 protected byte[] m_particleSystem = new byte[0]; 244 protected byte[] m_particleSystem = Utils.EmptyBytes;
246 protected ulong m_regionHandle; 245 protected ulong m_regionHandle;
247 protected Quaternion m_rotationOffset; 246 protected Quaternion m_rotationOffset;
248 protected PrimitiveBaseShape m_shape = null; 247 protected PrimitiveBaseShape m_shape;
249 protected UUID m_uuid; 248 protected UUID m_uuid;
250 protected Vector3 m_velocity; 249 protected Vector3 m_velocity;
251 250
252 // TODO: Those have to be changed into persistent properties at some later point, 251 // TODO: Those have to be changed into persistent properties at some later point,
253 // or sit-camera on vehicles will break on sim-crossing. 252 // or sit-camera on vehicles will break on sim-crossing.
254 private Vector3 m_cameraEyeOffset = new Vector3(0.0f, 0.0f, 0.0f); 253 private Vector3 m_cameraEyeOffset;
255 private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f); 254 private Vector3 m_cameraAtOffset;
256 private bool m_forceMouselook = false; 255 private bool m_forceMouselook;
257 256
258 // TODO: Collision sound should have default. 257 // TODO: Collision sound should have default.
259 private UUID m_collisionSound = UUID.Zero; 258 private UUID m_collisionSound;
260 private float m_collisionSoundVolume = 0.0f; 259 private float m_collisionSoundVolume;
261 260
262 #endregion Fields 261 #endregion Fields
263 262
@@ -269,9 +268,9 @@ namespace OpenSim.Region.Framework.Scenes
269 public SceneObjectPart() 268 public SceneObjectPart()
270 { 269 {
271 // It's not necessary to persist this 270 // It's not necessary to persist this
272 m_TextureAnimation = new byte[0]; 271 m_TextureAnimation = Utils.EmptyBytes;
273 m_particleSystem = new byte[0]; 272 m_particleSystem = Utils.EmptyBytes;
274 Rezzed = DateTime.Now; 273 Rezzed = DateTime.UtcNow;
275 274
276 m_inventory = new SceneObjectPartInventory(this); 275 m_inventory = new SceneObjectPartInventory(this);
277 } 276 }
@@ -290,8 +289,8 @@ namespace OpenSim.Region.Framework.Scenes
290 { 289 {
291 m_name = "Primitive"; 290 m_name = "Primitive";
292 291
293 Rezzed = DateTime.Now; 292 Rezzed = DateTime.UtcNow;
294 _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 293 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
295 _ownerID = ownerID; 294 _ownerID = ownerID;
296 _creatorID = _ownerID; 295 _creatorID = _ownerID;
297 _lastOwnerID = UUID.Zero; 296 _lastOwnerID = UUID.Zero;
@@ -299,19 +298,19 @@ namespace OpenSim.Region.Framework.Scenes
299 Shape = shape; 298 Shape = shape;
300 // Todo: Add More Object Parameter from above! 299 // Todo: Add More Object Parameter from above!
301 _ownershipCost = 0; 300 _ownershipCost = 0;
302 _objectSaleType = (byte) 0; 301 _objectSaleType = 0;
303 _salePrice = 0; 302 _salePrice = 0;
304 _category = (uint) 0; 303 _category = 0;
305 _lastOwnerID = _creatorID; 304 _lastOwnerID = _creatorID;
306 // End Todo: /// 305 // End Todo: ///
307 GroupPosition = groupPosition; 306 GroupPosition = groupPosition;
308 OffsetPosition = offsetPosition; 307 OffsetPosition = offsetPosition;
309 RotationOffset = rotationOffset; 308 RotationOffset = rotationOffset;
310 Velocity = new Vector3(0, 0, 0); 309 Velocity = Vector3.Zero;
311 AngularVelocity = new Vector3(0, 0, 0); 310 AngularVelocity = Vector3.Zero;
312 Acceleration = new Vector3(0, 0, 0); 311 Acceleration = Vector3.Zero;
313 m_TextureAnimation = new byte[0]; 312 m_TextureAnimation = Utils.EmptyBytes;
314 m_particleSystem = new byte[0]; 313 m_particleSystem = Utils.EmptyBytes;
315 314
316 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 315 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
317 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 316 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
@@ -3548,7 +3547,7 @@ if (m_shape != null) {
3548 // in SL. 3547 // in SL.
3549 // 3548 //
3550 if (ParentGroup.RootPart != this) 3549 if (ParentGroup.RootPart != this)
3551 ParentGroup.RootPart.Rezzed = DateTime.Now; 3550 ParentGroup.RootPart.Rezzed = DateTime.UtcNow;
3552 3551
3553 ParentGroup.HasGroupChanged = true; 3552 ParentGroup.HasGroupChanged = true;
3554 ScheduleFullUpdate(); 3553 ScheduleFullUpdate();
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
index f9d0f2a..81eeed2 100644
--- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs
+++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
@@ -67,6 +67,9 @@ namespace OpenSim.Region.Physics.Manager
67 67
68 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) 68 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
69 { 69 {
70 // Remove the reference to the encoded JPEG2000 data so it can be GCed
71 primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
72
70 return null; 73 return null;
71 } 74 }
72 } 75 }
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index f609e73..01093e2 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -281,7 +281,7 @@ namespace OpenSim.Region.Physics.Meshing
281 281
282 if (idata == null) 282 if (idata == null)
283 { 283 {
284 if (primShape.SculptData.Length == 0) 284 if (primShape.SculptData == null || primShape.SculptData.Length == 0)
285 return null; 285 return null;
286 286
287 try 287 try