Added code to save and refire collision_start event if the colliders are not found in
local scene yet.dsg
parent
71d991fe8a
commit
fb716dbd68
|
@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
|
||||
private bool m_Enabled = false;
|
||||
protected List<Scene> m_Scenes = new List<Scene>();
|
||||
protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
|
||||
protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
|
||||
protected Dictionary<UUID, GridRegion> m_RegionInfoMap = new Dictionary<UUID, GridRegion>();
|
||||
|
||||
public event UndeliveredMessage OnUndeliveredMessage;
|
||||
|
@ -536,19 +536,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
|
||||
if (upd != null)
|
||||
{
|
||||
GridRegion reginfo = null;
|
||||
// Try to pull reginfo from our cache
|
||||
lock (m_RegionInfoMap)
|
||||
{
|
||||
if (!m_RegionInfoMap.TryGetValue(upd.RegionID, out reginfo))
|
||||
reginfo = null;
|
||||
}
|
||||
|
||||
// If it wasn't there, then look it up from grid.
|
||||
if (reginfo == null)
|
||||
{
|
||||
reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, upd.RegionID);
|
||||
{
|
||||
GridRegion reginfo = null;
|
||||
// Try to pull reginfo from our cache
|
||||
lock (m_RegionInfoMap)
|
||||
{
|
||||
if (!m_RegionInfoMap.TryGetValue(upd.RegionID, out reginfo))
|
||||
reginfo = null;
|
||||
}
|
||||
|
||||
// If it wasn't there, then look it up from grid.
|
||||
if (reginfo == null)
|
||||
{
|
||||
reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, upd.RegionID);
|
||||
}
|
||||
|
||||
// If we found the reginfo, send the IM to the region
|
||||
|
@ -573,13 +573,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
{
|
||||
m_UserRegionMap.Add(toAgentID, upd.RegionID);
|
||||
}
|
||||
}
|
||||
lock (m_RegionInfoMap)
|
||||
{
|
||||
// Since we never look it up again, we don't need to update it
|
||||
// but if it's not in the map yet, add it now.
|
||||
if (!m_RegionInfoMap.ContainsKey(upd.RegionID))
|
||||
m_RegionInfoMap.Add(upd.RegionID, reginfo);
|
||||
}
|
||||
lock (m_RegionInfoMap)
|
||||
{
|
||||
// Since we never look it up again, we don't need to update it
|
||||
// but if it's not in the map yet, add it now.
|
||||
if (!m_RegionInfoMap.ContainsKey(upd.RegionID))
|
||||
m_RegionInfoMap.Add(upd.RegionID, reginfo);
|
||||
}
|
||||
result(true);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
bool imresult = doDialogSending(reginfo, msgdata);
|
||||
if (!imresult)
|
||||
{
|
||||
SendGridDialogViaXMLRPCAsync(avatarID, objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels, prevRegionID);
|
||||
//SendGridDialogViaXMLRPCAsync(avatarID, objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels, prevRegionID);
|
||||
m_log.WarnFormat("Couldn't deliver dialog to {0}" + avatarID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
get { return m_isSyncRelay; }
|
||||
}
|
||||
|
||||
public class SyncMessageRecord
|
||||
{
|
||||
public SymmetricSyncMessage SyncMessage;
|
||||
public long ReceivedTime;
|
||||
}
|
||||
private List<SyncMessageRecord> m_savedSyncMessage = new List<SyncMessageRecord>();
|
||||
|
||||
//The following Sendxxx calls,send out a message immediately, w/o putting it in the SyncConnector's outgoing queue.
|
||||
//May need some optimization there on the priorities.
|
||||
|
||||
|
@ -2154,7 +2161,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
HandleRemoteEvent_PhysicsCollision(init_actorID, evSeqNum, data);
|
||||
break;
|
||||
case SymmetricSyncMessage.MsgType.ScriptCollidingStart:
|
||||
HandleRemoteEvent_ScriptCollidingStart(init_actorID, evSeqNum, data);
|
||||
HandleRemoteEvent_ScriptCollidingStart(init_actorID, evSeqNum, data, DateTime.Now.Ticks);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2403,16 +2410,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_scene.EventManager.TriggerOnAttachLocally(localID, itemID, avatarID);
|
||||
}
|
||||
|
||||
private void HandleRemoteEvent_ScriptCollidingStart(string actorID, ulong evSeqNum, OSDMap data)
|
||||
private void HandleRemoteEvent_ScriptCollidingStart(string actorID, ulong evSeqNum, OSDMap data, long recvTime)
|
||||
{
|
||||
if (!data.ContainsKey("primUUID") || !data.ContainsKey("collisionUUIDs"))
|
||||
{
|
||||
m_log.ErrorFormat("RemoteEvent_ScriptCollidingStart: either primUUID or collisionUUIDs is missing in incoming OSDMap");
|
||||
return;
|
||||
}
|
||||
|
||||
ColliderArgs StartCollidingMessage = new ColliderArgs();
|
||||
List<DetectedObject> colliding = new List<DetectedObject>();
|
||||
SceneObjectPart part=null;
|
||||
SceneObjectPart part = null;
|
||||
OSDArray collidersNotFound = new OSDArray();
|
||||
|
||||
try
|
||||
{
|
||||
UUID primUUID = data["primUUID"].AsUUID();
|
||||
|
@ -2430,7 +2440,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no collisionLocalIDs", LogHeader);
|
||||
return;
|
||||
}
|
||||
if(part.ParentGroup.IsDeleted == true)
|
||||
if (part.ParentGroup.IsDeleted == true)
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("HandleRemoteEvent_ScriptCollidingStart received for {0}", part.Name);
|
||||
|
@ -2473,8 +2483,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("HandleRemoteEvent_ScriptCollidingStart for SOP {0},{1} with another SOP/SP {2}, but the latter is not found in local Scene",
|
||||
m_log.WarnFormat("HandleRemoteEvent_ScriptCollidingStart for SOP {0},{1} with SOP/SP {2}, but the latter is not found in local Scene. Saved for later processing",
|
||||
part.Name, part.UUID, collidingUUID);
|
||||
collidersNotFound.Add(OSD.FromUUID(collidingUUID));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2485,6 +2496,27 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_log.ErrorFormat("HandleRemoteEvent_ScriptCollidingStart Error: {0}", e.Message);
|
||||
}
|
||||
|
||||
if (collidersNotFound.Count > 0)
|
||||
{
|
||||
|
||||
OSDMap newdata = new OSDMap();
|
||||
newdata["primUUID"] = OSD.FromUUID(part.UUID);
|
||||
newdata["collisionUUIDs"] = collidersNotFound;
|
||||
|
||||
newdata["actorID"] = OSD.FromString(actorID);
|
||||
newdata["seqNum"] = OSD.FromULong(evSeqNum);
|
||||
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.ScriptCollidingStart, OSDParser.SerializeJsonString(newdata));
|
||||
|
||||
SyncMessageRecord syncMsgToSave = new SyncMessageRecord();
|
||||
syncMsgToSave.ReceivedTime = recvTime;
|
||||
syncMsgToSave.SyncMessage = rsm;
|
||||
lock (m_savedSyncMessage)
|
||||
{
|
||||
m_savedSyncMessage.Add(syncMsgToSave);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (colliding.Count > 0)
|
||||
{
|
||||
StartCollidingMessage.Colliders = colliding;
|
||||
|
@ -2502,6 +2534,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
if (!data.ContainsKey("primUUID") || !data.ContainsKey("collisionUUIDs"))
|
||||
{
|
||||
m_log.ErrorFormat("RemoteEvent_PhysicsCollision: either primUUID or collisionUUIDs is missing in incoming OSDMap");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -2524,13 +2557,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
|
||||
// Build up the collision list. The contact point is ignored so we generate some default.
|
||||
CollisionEventUpdate e = new CollisionEventUpdate();
|
||||
/*
|
||||
foreach (uint collisionID in collisionLocalIDs)
|
||||
{
|
||||
// e.addCollider(collisionID, new ContactPoint());
|
||||
e.addCollider(collisionID, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
|
||||
}
|
||||
* */
|
||||
|
||||
for (int i = 0; i < collisionUUIDs.Count; i++)
|
||||
{
|
||||
OSD arg = collisionUUIDs[i];
|
||||
|
@ -2955,6 +2982,39 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
/// </summary>
|
||||
public void SyncOutPrimUpdates()
|
||||
{
|
||||
//we are riding on this periodic events to check if there are un-handled sync event messages
|
||||
if (m_savedSyncMessage.Count > 0)
|
||||
{
|
||||
System.Threading.ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
List<SyncMessageRecord> savedSyncMessage;
|
||||
lock (m_savedSyncMessage)
|
||||
{
|
||||
savedSyncMessage = new List<SyncMessageRecord>(m_savedSyncMessage);
|
||||
m_savedSyncMessage.Clear();
|
||||
}
|
||||
foreach (SyncMessageRecord syncMsgSaved in savedSyncMessage)
|
||||
{
|
||||
SymmetricSyncMessage msg = syncMsgSaved.SyncMessage;
|
||||
switch (msg.Type)
|
||||
{
|
||||
case SymmetricSyncMessage.MsgType.ScriptCollidingStart:
|
||||
{
|
||||
OSDMap data = DeserializeMessage(msg);
|
||||
string init_actorID = data["actorID"].AsString();
|
||||
ulong evSeqNum = data["seqNum"].AsULong();
|
||||
bool savedForLater = false;
|
||||
HandleRemoteEvent_ScriptCollidingStart(init_actorID, evSeqNum, data, syncMsgSaved.ReceivedTime);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!IsSyncingWithOtherSyncNodes())
|
||||
{
|
||||
//no SyncConnector connected. clear update queues and return.
|
||||
|
|
Loading…
Reference in New Issue