* The rest of the fix necessary for mantis #766 - terse updates broken

* Even very rapid linking/delinking should now behave normally.  Terse updates still occur as before
* Hopefully this ends the recent linking problems - please let us know if there are more
0.6.0-stable
Justin Clarke Casey 2008-03-14 18:21:21 +00:00
parent 01faa86c1a
commit 87067bff1e
3 changed files with 43 additions and 16 deletions

View File

@ -948,7 +948,18 @@ namespace OpenSim.Region.Environment.Scenes
public void LinkToGroup(SceneObjectGroup objectGroup) public void LinkToGroup(SceneObjectGroup objectGroup)
{ {
if (objectGroup.RootPart.UpdateFlag > 0) if (objectGroup.RootPart.UpdateFlag > 0)
{
// I've never actually seen this happen, though I think it's theoretically possible
m_log.ErrorFormat(
"[SCENE OBJECT GROUP]: Aborted linking {0}, {1} to {2}, {3} as it has yet to finish delinking",
objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
return; return;
}
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
SceneObjectPart linkPart = objectGroup.m_rootPart; SceneObjectPart linkPart = objectGroup.m_rootPart;
@ -1017,13 +1028,25 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="partID"></param> /// <param name="partID"></param>
public void DelinkFromGroup(uint partID) public void DelinkFromGroup(uint partID)
{ {
// Don't try and update if we're already in the middle of updating
if (RootPart.UpdateFlag > 0) if (RootPart.UpdateFlag > 0)
{
// I've never actually seen this happen, though I think it's theoretically possible
m_log.WarnFormat(
"[SCENE OBJECT GROUP]: Aborted delink update for {0}, {1} as it has yet to finish linking",
RootPart.Name, RootPart.UUID);
return; return;
}
SceneObjectPart linkPart = GetChildPart(partID); SceneObjectPart linkPart = GetChildPart(partID);
if (null != linkPart) if (null != linkPart)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
LLQuaternion worldRot = linkPart.GetWorldRotation(); LLQuaternion worldRot = linkPart.GetWorldRotation();
// Remove the part from this object // Remove the part from this object
@ -1645,7 +1668,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// /// Send a full update to the client for the given part
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="part"></param> /// <param name="part"></param>
@ -1662,7 +1685,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// /// Send a terse update to the client for the given part
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="part"></param> /// <param name="part"></param>

View File

@ -270,7 +270,6 @@ namespace OpenSim.Region.Environment.Scenes
m_groupPosition.Y = PhysActor.Position.Y; m_groupPosition.Y = PhysActor.Position.Y;
m_groupPosition.Z = PhysActor.Position.Z; m_groupPosition.Z = PhysActor.Position.Z;
} }
return m_groupPosition; return m_groupPosition;
} }
set set
@ -1116,7 +1115,10 @@ namespace OpenSim.Region.Environment.Scenes
int timeNow = Util.UnixTimeSinceEpoch(); int timeNow = Util.UnixTimeSinceEpoch();
if (timeNow == TimeStampFull) // If multiple updates are scheduled on the same second, we still need to perform all of them
// So we'll force the issue by bumping up the timestamp so that later processing sees these need
// to be peformed.
if (timeNow <= TimeStampFull)
{ {
TimeStampFull += 1; TimeStampFull += 1;
} }
@ -1126,6 +1128,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_updateFlag = 2; m_updateFlag = 2;
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
// UUID, Name, TimeStampFull);
} }
public void AddFlag(LLObject.ObjectFlags flag) public void AddFlag(LLObject.ObjectFlags flag)
@ -1155,7 +1161,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// /// Schedule a terse update for this prim. Terse updates only send position,
/// rotation, velocity, rotational velocity and shape information.
/// </summary> /// </summary>
public void ScheduleTerseUpdate() public void ScheduleTerseUpdate()
{ {
@ -1169,6 +1176,9 @@ namespace OpenSim.Region.Environment.Scenes
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 1; m_updateFlag = 1;
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}",
// UUID, Name, TimeStampTerse);
} }
} }
@ -1836,7 +1846,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// /// Send a terse update to the client.
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void SendTerseUpdate(IClientAPI remoteClient) public void SendTerseUpdate(IClientAPI remoteClient)

View File

@ -472,20 +472,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
ScenePartUpdate update = m_updateTimes[part.UUID]; ScenePartUpdate update = m_updateTimes[part.UUID];
// Two updates can occur with the same timestamp (especially // We deal with the possibility that two updates occur at the same unix time
// since our timestamp resolution is to the nearest second). Therefore, we still need // at the update point itself.
// to send an update even if the last full update time is identical to the part's
// update timestamp.
//
// If we don't do this, various events (such as linking and delinking in the same
// second), will stop working properly!
if (update.LastFullUpdateTime < part.TimeStampFull) if (update.LastFullUpdateTime < part.TimeStampFull)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampFull); // part.Name, part.UUID, part.TimeStampFull);
//need to do a full update
part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID));
// We'll update to the part's timestamp rather than the current time to // We'll update to the part's timestamp rather than the current time to