* Hooked up the GridComm event ChildDataUpdate to the scene.

* Added List<RegionInfo> m_neighbours to Scene 
* Hooked up the OnRegionUp event to m_neighbours list 
* Modified RegionInfo to have a bool commFailTF value so that we can skip neighbors that fail.  (when the region comes up, this gets reset to false and the region will try again.
* Added SetChildAgentThrottle(byte[]) to IClientAPI 
* Several other insignificant changes related to passing child pertanant agent data from sim to sim.
afrisby
Teravus Ovares 2007-12-10 00:46:56 +00:00
parent be5d8811be
commit e595f82489
8 changed files with 117 additions and 7 deletions

View File

@ -480,7 +480,7 @@ namespace OpenSim.Framework
void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations);
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
void SetChildAgentThrottle(byte[] throttle);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color,
uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction);

View File

@ -186,6 +186,7 @@ namespace OpenSim.Framework
public string DataStore = "";
public bool isSandbox = false;
public bool commFailTF = false;
public LLUUID MasterAvatarAssignedUUID = LLUUID.Zero;
public string MasterAvatarFirstName = "";

View File

@ -2015,7 +2015,10 @@ namespace OpenSim.Region.ClientStack
this.OutPacket(mbReply, ThrottleOutPacketType.Land);
*/
}
public void SetChildAgentThrottle(byte[] throttles)
{
PacketQueue.SetThrottleFromClient(throttles);
}
// Previously ClientView.PacketQueue
protected PacketQueue PacketQueue;

View File

@ -710,9 +710,10 @@ namespace OpenSim.Region.Communications.OGS1
}
catch (Exception e)
{
MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one");
// This line errors with a Null Reference Exception.. Why? @.@
//MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
// ":" + regInfo.RemotingPort +
//"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one");
MainLog.Instance.Debug(e.ToString());
return false;
}

View File

@ -60,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
protected Timer m_restartWaitTimer = new Timer();
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
public InnerScene m_innerScene;
@ -266,13 +267,37 @@ namespace OpenSim.Region.Environment.Scenes
public override bool OtherRegionUp(RegionInfo otherRegion)
{
// Another region is up. We have to tell all our ScenePresences about it
// Another region is up.
// We have to tell all our ScenePresences about it..
//and add it to the neighbor list.
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
{
if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) && (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1))
{
for (int i = 0; i < m_neighbours.Count; i++)
{
// The purpose of this loop is to re-update the known neighbors
// when another region comes up on top of another one.
// The latest region in that location ends up in the
// 'known neighbors list'
// Additionally, the commFailTF property gets reset to false.
if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
{
m_neighbours[i] = otherRegion;
}
}
// If the value isn't in the neighbours, add it.
// If the RegionInfo isn't exact but is for the same XY World location,
// then the above loop will fix that.
if (!(m_neighbours.Contains(otherRegion)))
{
m_neighbours.Add(otherRegion);
}
if (!(m_regionRestartNotifyList.Contains(otherRegion)))
{
m_regionRestartNotifyList.Add(otherRegion);
@ -1112,6 +1137,7 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
m_sceneGridService.OnCloseAgentConnection += CloseConnection;
m_sceneGridService.OnRegionUp += OtherRegionUp;
m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
m_sceneGridService.KillObject = SendKillObject;
}
@ -1121,6 +1147,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void UnRegisterReginWithComms()
{
m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
m_sceneGridService.OnRegionUp -= OtherRegionUp;
m_sceneGridService.OnExpectUser -= NewUserConnection;
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
@ -1182,6 +1209,24 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
ScenePresence childAgentUpdate = GetScenePresence(new LLUUID(cAgentData.AgentID));
if (!(childAgentUpdate.Equals(null)))
{
// I can't imagine *yet* why we would get an update if the agent is a root agent..
// however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent)
{
//Send Data to ScenePresence
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
// Not Implemented:
//TODO: Do we need to pass the message on to one of our neighbors?
}
}
return true;
}
/// <summary>
///
/// </summary>

View File

@ -23,6 +23,7 @@ namespace OpenSim.Region.Environment.Scenes
public event CloseAgentConnection OnCloseAgentConnection;
public event PrimCrossing OnPrimCrossingIntoRegion;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
public KillObjectDelegate KillObject;
public string _debugRegionName = "";
@ -59,6 +60,8 @@ namespace OpenSim.Region.Environment.Scenes
regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
regionCommsHost.OnCloseAgentConnection += CloseConnection;
regionCommsHost.OnRegionUp += newRegionUp;
regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
}
else
{
@ -70,6 +73,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (regionCommsHost != null)
{
regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
regionCommsHost.OnRegionUp -= newRegionUp;
regionCommsHost.OnExpectUser -= NewUserConnection;
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
@ -105,6 +109,14 @@ namespace OpenSim.Region.Environment.Scenes
}
return true;
}
protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
if (OnChildAgentUpdate != null)
OnChildAgentUpdate(regionHandle, cAgentData);
return true;
}
protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
@ -262,6 +274,37 @@ namespace OpenSim.Region.Environment.Scenes
//bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent.");
bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle,cAgentData);
if (regionAccepted)
{
MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent");
}
else
{
MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent");
}
}
private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
{
SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate)iar.AsyncState;
icon.EndInvoke(iar);
}
public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
// This assumes that we know what our neighbors are.
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
d.BeginInvoke(regionHandle, cAgentData,
SendChildAgentDataUpdateCompleted,
d);
}
/// <summary>
///

View File

@ -53,6 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
private uint m_requestedSitTargetID = 0;
private LLVector3 m_requestedSitOffset = new LLVector3();
private float m_sitAvatarHeight = 2.0f;
private float m_godlevel = 0;
private bool m_isTyping = false;
private bool m_setAlwaysRun = false;
@ -1255,7 +1256,20 @@ namespace OpenSim.Region.Environment.Scenes
respondPacket.AgentData = adb;
ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task);
}
public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData)
{
//
m_DrawDistance = cAgentData.drawdistance;
m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z);
m_CameraCenter = new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
m_godlevel = cAgentData.godlevel;
ControllingClient.SetChildAgentThrottle(cAgentData.throttles);
//cAgentData.AVHeight;
//cAgentData.regionHandle;
//m_velocity = cAgentData.Velocity;
}
/// <summary>
///
/// </summary>

View File

@ -202,10 +202,13 @@ namespace SimpleApp
{
}
public virtual void SendKillObject(ulong regionHandle, uint localID)
{
}
public virtual void SetChildAgentThrottle(byte[] throttle)
{
}
public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId)
{
}