* Enabled dead region tracking for ChildAgentDataUpdates

** If the region fails 3 times, then ChildAgentDataUpdates no longer get sent to that region
* Enabled Child_Get_Tasks in grid mode.   
* When Child_Get_Tasks is enabled on neighbor regions, the neighbor region uses the client's draw distance to send out prim.   This is a lot less likely to flood the client now since the ChildAgentDataUpdate contains both the throttle settings and the draw distance.   This means that with this enabled, you can see prim in other regions in grid mode.   Very experimental.
ThreadPoolClientBranch
Teravus Ovares 2008-01-22 08:52:51 +00:00
parent 7d61705c3c
commit 5cf96daaf2
11 changed files with 278 additions and 114 deletions

View File

@ -46,5 +46,8 @@ namespace OpenSim.Framework
public Guid AgentID; public Guid AgentID;
public float godlevel; public float godlevel;
public byte[] throttles; public byte[] throttles;
public bool alwaysrun;
public Guid ActiveGroupID;
public uint GroupAccess;
} }
} }

View File

@ -613,6 +613,9 @@ namespace OpenSim.Framework
void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout,
uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
byte[] GetThrottlesPacked(float multiplier);
void SetDebug(int newDebug); void SetDebug(int newDebug);
void InPacket(Packet NewPack); void InPacket(Packet NewPack);
void Close(bool ShutdownCircuit); void Close(bool ShutdownCircuit);

View File

@ -276,8 +276,8 @@ namespace OpenSim
m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
} }
if (!m_sandbox) //if (!m_sandbox)
m_SendChildAgentTaskData = false; //m_SendChildAgentTaskData = false;
m_networkServersInfo.loadFromConfiguration(m_config); m_networkServersInfo.loadFromConfiguration(m_config);
@ -485,8 +485,8 @@ namespace OpenSim
if (m_SendChildAgentTaskData) if (m_SendChildAgentTaskData)
{ {
MainLog.Instance.Error("WARNING", MainLog.Instance.Error("WARNING",
"Send Child Agent Task Updates is enabled. This is for testing only. It doesn't work on grid mode!"); "Send Child Agent Task Updates is enabled. This is for testing only.");
Thread.Sleep(12000); //Thread.Sleep(12000);
} }
return return
new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache,

View File

@ -641,7 +641,8 @@ namespace OpenSim.Region.ClientStack
} }
mov.Data.LookAt = look; mov.Data.LookAt = look;
OutPacket(mov, ThrottleOutPacketType.Task); // Hack to get this out immediately and skip the throttles
OutPacket(mov, ThrottleOutPacketType.Unknown);
} }
/// <summary> /// <summary>
@ -824,7 +825,8 @@ namespace OpenSim.Region.ClientStack
newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port;
newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL);
OutPacket(newSimPack, ThrottleOutPacketType.Task); // Hack to get this out immediately and skip throttles
OutPacket(newSimPack, ThrottleOutPacketType.Unknown);
} }
public void SendMapBlock(List<MapBlockData> mapBlocks) public void SendMapBlock(List<MapBlockData> mapBlocks)
@ -858,7 +860,9 @@ namespace OpenSim.Region.ClientStack
tpLocal.Info.LocationID = 2; tpLocal.Info.LocationID = 2;
tpLocal.Info.LookAt = lookAt; tpLocal.Info.LookAt = lookAt;
tpLocal.Info.Position = position; tpLocal.Info.Position = position;
OutPacket(tpLocal, ThrottleOutPacketType.Task);
// Hack to get this out immediately and skip throttles
OutPacket(tpLocal, ThrottleOutPacketType.Unknown);
} }
public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
@ -884,7 +888,9 @@ namespace OpenSim.Region.ClientStack
teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; teleport.Info.SimPort = (ushort)newRegionEndPoint.Port;
teleport.Info.LocationID = 4; teleport.Info.LocationID = 4;
teleport.Info.TeleportFlags = 1 << 4; teleport.Info.TeleportFlags = 1 << 4;
OutPacket(teleport, ThrottleOutPacketType.Task);
// Hack to get this out immediately and skip throttles.
OutPacket(teleport, ThrottleOutPacketType.Unknown);
} }
/// <summary> /// <summary>
@ -895,7 +901,9 @@ namespace OpenSim.Region.ClientStack
TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed); TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
tpFailed.Info.AgentID = AgentId; tpFailed.Info.AgentID = AgentId;
tpFailed.Info.Reason = Helpers.StringToField(reason); tpFailed.Info.Reason = Helpers.StringToField(reason);
OutPacket(tpFailed, ThrottleOutPacketType.Task);
// Hack to get this out immediately and skip throttles
OutPacket(tpFailed, ThrottleOutPacketType.Unknown);
} }
/// <summary> /// <summary>
@ -906,7 +914,9 @@ namespace OpenSim.Region.ClientStack
//TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart); //TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
TeleportStartPacket tpStart = new TeleportStartPacket(); TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 16; // Teleport via location tpStart.Info.TeleportFlags = 16; // Teleport via location
OutPacket(tpStart, ThrottleOutPacketType.Task);
// Hack to get this out immediately and skip throttles
OutPacket(tpStart, ThrottleOutPacketType.Unknown);
} }
public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
@ -2222,6 +2232,11 @@ namespace OpenSim.Region.ClientStack
*/ */
} }
public byte[] GetThrottlesPacked(float multiplier)
{
return m_packetQueue.GetThrottlesPacked(multiplier);
}
public void SetChildAgentThrottle(byte[] throttles) public void SetChildAgentThrottle(byte[] throttles)
{ {
m_packetQueue.SetThrottleFromClient(throttles); m_packetQueue.SetThrottleFromClient(throttles);

View File

@ -356,7 +356,7 @@ namespace OpenSim.Region.ClientStack
return (int) (((float) value/(float) curmax)*newmax); return (int) (((float) value/(float) curmax)*newmax);
} }
private byte[] GetThrottlesPacked(float multiplier) public byte[] GetThrottlesPacked(float multiplier)
{ {
int singlefloat = 4; int singlefloat = 4;
float tResend = ResendThrottle.Throttle*multiplier; float tResend = ResendThrottle.Throttle*multiplier;

View File

@ -50,6 +50,7 @@ namespace OpenSim.Region.Communications.OGS1
private LocalBackEndServices m_localBackend = new LocalBackEndServices(); private LocalBackEndServices m_localBackend = new LocalBackEndServices();
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>(); private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>();
private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>();
private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
public BaseHttpServer httpListener; public BaseHttpServer httpListener;
@ -498,6 +499,16 @@ namespace OpenSim.Region.Communications.OGS1
#region Methods called by regions in this instance #region Methods called by regions in this instance
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
int failures = 0;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionHandle))
{
failures = m_deadRegionCache[regionHandle];
}
}
if (failures <= 3)
{ {
RegionInfo regInfo = null; RegionInfo regInfo = null;
try try
@ -514,8 +525,8 @@ namespace OpenSim.Region.Communications.OGS1
bool retValue = false; bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof (OGS1InterRegionRemoting), typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress + "tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort + ":" + regInfo.RemotingPort +
"/InterRegions"); "/InterRegions");
@ -529,52 +540,62 @@ namespace OpenSim.Region.Communications.OGS1
Console.WriteLine("remoting object not found"); Console.WriteLine("remoting object not found");
} }
remObject = null; remObject = null;
MainLog.Instance.Verbose("INTER", //MainLog.Instance.Verbose("INTER",
gdebugRegionName + //gdebugRegionName +
": OGS1 tried to Update Child Agent data on outside region and got " + //": OGS1 tried to Update Child Agent data on outside region and got " +
retValue.ToString()); //retValue.ToString());
return retValue; return retValue;
} }
NoteDeadRegion(regionHandle);
return false; return false;
} }
catch (RemotingException e) catch (RemotingException e)
{ {
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
return false; return false;
} }
catch (SocketException e) catch (SocketException e)
{ {
MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + " " +
regInfo.RegionLocX + "," + regInfo.RegionLocY); regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
return false; return false;
} }
catch (InvalidCredentialException e) catch (InvalidCredentialException e)
{ {
MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
return false; return false;
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " +
regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
return false; return false;
} }
catch (Exception e) catch (Exception e)
{ {
MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + NoteDeadRegion(regionHandle);
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
return false; return false;
} }
} }
else
{
//MainLog.Instance.Verbose("INTERREGION", "Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString());
return false;
}
}
/// <summary> /// <summary>
/// ///
@ -622,11 +643,12 @@ namespace OpenSim.Region.Communications.OGS1
return retValue; return retValue;
} }
NoteDeadRegion(regionHandle);
return false; return false;
} }
catch (RemotingException e) catch (RemotingException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -634,6 +656,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (SocketException e) catch (SocketException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " +
regInfo.RegionLocX + "," + regInfo.RegionLocY); regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -641,6 +664,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (InvalidCredentialException e) catch (InvalidCredentialException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -648,6 +672,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " +
regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -655,6 +680,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (Exception e) catch (Exception e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -813,11 +839,12 @@ namespace OpenSim.Region.Communications.OGS1
return retValue; return retValue;
} }
NoteDeadRegion(regionHandle);
return false; return false;
} }
catch (RemotingException e) catch (RemotingException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -825,6 +852,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (SocketException e) catch (SocketException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " +
regInfo.RegionLocX + "," + regInfo.RegionLocY); regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -832,6 +860,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (InvalidCredentialException e) catch (InvalidCredentialException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -839,6 +868,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " +
regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -846,6 +876,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (Exception e) catch (Exception e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -895,10 +926,12 @@ namespace OpenSim.Region.Communications.OGS1
} }
//TODO need to see if we know about where this region is and use .net remoting //TODO need to see if we know about where this region is and use .net remoting
// to inform it. // to inform it.
NoteDeadRegion(regionHandle);
return false; return false;
} }
catch (RemotingException e) catch (RemotingException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -906,6 +939,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch catch
{ {
NoteDeadRegion(regionHandle);
return false; return false;
} }
} }
@ -945,10 +979,12 @@ namespace OpenSim.Region.Communications.OGS1
} }
//TODO need to see if we know about where this region is and use .net remoting //TODO need to see if we know about where this region is and use .net remoting
// to inform it. // to inform it.
NoteDeadRegion(regionHandle);
return false; return false;
} }
catch (RemotingException e) catch (RemotingException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString()); MainLog.Instance.Debug(e.ToString());
@ -956,6 +992,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch catch
{ {
NoteDeadRegion(regionHandle);
return false; return false;
} }
} }
@ -994,10 +1031,12 @@ namespace OpenSim.Region.Communications.OGS1
} }
//TODO need to see if we know about where this region is and use .net remoting //TODO need to see if we know about where this region is and use .net remoting
// to inform it. // to inform it.
NoteDeadRegion(regionHandle);
return false; return false;
} }
catch (RemotingException e) catch (RemotingException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName +
" " + regInfo.RegionLocX + "," + regInfo.RegionLocY); " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
//MainLog.Instance.Debug(e.ToString()); //MainLog.Instance.Debug(e.ToString());
@ -1006,6 +1045,7 @@ namespace OpenSim.Region.Communications.OGS1
catch (SocketException e) catch (SocketException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress + regInfo.RemotingAddress +
":" + regInfo.RemotingPort + ":" + regInfo.RemotingPort +
@ -1016,6 +1056,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (InvalidCredentialException e) catch (InvalidCredentialException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress + regInfo.RemotingAddress +
":" + regInfo.RemotingPort + ":" + regInfo.RemotingPort +
@ -1025,6 +1066,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress + regInfo.RemotingAddress +
":" + regInfo.RemotingPort + ":" + regInfo.RemotingPort +
@ -1034,6 +1076,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (WebException e) catch (WebException e)
{ {
NoteDeadRegion(regionHandle);
MainLog.Instance.Warn("WebException exception: Unable to connect to adjacent region using tcp://" + MainLog.Instance.Warn("WebException exception: Unable to connect to adjacent region using tcp://" +
regInfo.RemotingAddress + regInfo.RemotingAddress +
":" + regInfo.RemotingPort + ":" + regInfo.RemotingPort +
@ -1043,6 +1086,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
catch (Exception e) catch (Exception e)
{ {
NoteDeadRegion(regionHandle);
// This line errors with a Null Reference Exception.. Why? @.@ // This line errors with a Null Reference Exception.. Why? @.@
//MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
// ":" + regInfo.RemotingPort + // ":" + regInfo.RemotingPort +
@ -1091,11 +1135,21 @@ namespace OpenSim.Region.Communications.OGS1
{ {
MainLog.Instance.Verbose("INTER", MainLog.Instance.Verbose("INTER",
gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX +
"," + regionData.RegionLocY + ")"); "," + regionData.RegionLocY + "). Giving this region a fresh set of 'dead' tries");
try try
{ {
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionData.RegionHandle))
{
m_deadRegionCache.Remove(regionData.RegionHandle);
}
}
return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle);
} }
catch (RemotingException e) catch (RemotingException e)
@ -1107,7 +1161,7 @@ namespace OpenSim.Region.Communications.OGS1
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{ {
MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update"); //MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update");
try try
{ {
@ -1227,6 +1281,20 @@ namespace OpenSim.Region.Communications.OGS1
} }
socket.Close(); socket.Close();
} }
public void NoteDeadRegion(ulong regionhandle)
{
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionhandle))
{
m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1;
}
else
{
m_deadRegionCache.Add(regionhandle, 1);
}
}
}
} }
} }

View File

@ -537,20 +537,24 @@ namespace OpenSim.Region.Environment.Scenes
// the initial update for and what we'll use to limit the // the initial update for and what we'll use to limit the
// space we check for new objects on movement. // space we check for new objects on movement.
if (presence.IsChildAgent) if (presence.IsChildAgent && m_parentScene.m_sendTasksToChild)
{ {
//Vector3 avPosition = new Vector3(presence.AbsolutePosition.X,presence.AbsolutePosition.Y,presence.AbsolutePosition.Z); LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition;
//LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition,oLoc);
//Vector3 objPosition = new Vector3(oLoc.X,oLoc.Y,oLoc.Z);
//float distResult = Vector3Distance(avPosition, objPosition); //MainLog.Instance.Verbose("DISTANCE", distResult.ToString());
//if (distResult > 512)
//{ if (distResult > 60)
//int x = 0; {
//} int x = 0;
//if (distResult < presence.DrawDistance) }
//{ if (distResult < presence.DrawDistance)
{
// Send Only if we don't already know about it.
// KnownPrim also makes the prim known when called.
if (!presence.KnownPrim(((SceneObjectGroup) ent).UUID))
((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
//} }
} }
else else
{ {

View File

@ -1394,6 +1394,8 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneGridService.KillObject = SendKillObject; m_sceneGridService.KillObject = SendKillObject;
} }
@ -1492,20 +1494,26 @@ namespace OpenSim.Region.Environment.Scenes
public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{ {
ScenePresence childAgentUpdate = GetScenePresence(new LLUUID(cAgentData.AgentID)); ScenePresence childAgentUpdate = GetScenePresence(new LLUUID(cAgentData.AgentID));
if (!(childAgentUpdate.Equals(null))) if (childAgentUpdate != null)
{ {
// I can't imagine *yet* why we would get an update if the agent is a root agent.. // 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.. // however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent) if (childAgentUpdate.IsChildAgent)
{ {
uint rRegionX = (uint)(cAgentData.regionHandle >> 40);
uint rRegionY = (((uint)(cAgentData.regionHandle)) >> 8);
uint tRegionX = RegionInfo.RegionLocX;
uint tRegionY = RegionInfo.RegionLocY;
//Send Data to ScenePresence //Send Data to ScenePresence
childAgentUpdate.ChildAgentDataUpdate(cAgentData); childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
// Not Implemented: // Not Implemented:
//TODO: Do we need to pass the message on to one of our neighbors? //TODO: Do we need to pass the message on to one of our neighbors?
}
} }
return true; return true;
} }
return false;
}
/// <summary> /// <summary>
/// Tell a single agent to disconnect from the region. /// Tell a single agent to disconnect from the region.
@ -1614,6 +1622,11 @@ namespace OpenSim.Region.Environment.Scenes
return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
} }
public void SendOutChildAgentUpdates(ChildAgentDataUpdate cadu, ScenePresence presence)
{
m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
}
#endregion #endregion
#region Module Methods #region Module Methods

View File

@ -332,7 +332,7 @@ namespace OpenSim.Region.Environment.Scenes
//bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
} }
public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData); public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ScenePresence presence);
/// <summary> /// <summary>
/// This informs all neighboring regions about the settings of it's child agent. /// This informs all neighboring regions about the settings of it's child agent.
@ -341,18 +341,22 @@ namespace OpenSim.Region.Environment.Scenes
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
/// ///
/// </summary> /// </summary>
private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData) private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ScenePresence presence)
{
//MainLog.Instance.Notice("INTERGRID", "Informing neighbors about my agent.");
foreach (ulong regionHandle in presence.KnownChildRegions)
{ {
MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent.");
bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
if (regionAccepted) if (regionAccepted)
{ {
MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent"); //MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent");
} }
else else
{ {
MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); //MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent");
}
} }
} }
@ -362,11 +366,11 @@ namespace OpenSim.Region.Environment.Scenes
icon.EndInvoke(iar); icon.EndInvoke(iar);
} }
public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence)
{ {
// This assumes that we know what our neighbors are. // This assumes that we know what our neighbors are.
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
d.BeginInvoke(regionHandle, cAgentData, d.BeginInvoke(cAgentData,presence,
SendChildAgentDataUpdateCompleted, SendChildAgentDataUpdateCompleted,
d); d);
} }
@ -374,11 +378,8 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void SendCloseChildAgentDelegate( ScenePresence presence); public delegate void SendCloseChildAgentDelegate( ScenePresence presence);
/// <summary> /// <summary>
/// This informs all neighboring regions about the settings of it's child agent. /// This Closes child agents on neighboring regions
/// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
///
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
///
/// </summary> /// </summary>
private void SendCloseChildAgentAsync(ScenePresence presence) private void SendCloseChildAgentAsync(ScenePresence presence)
{ {

View File

@ -55,6 +55,7 @@ namespace OpenSim.Region.Environment.Scenes
private LLVector3 m_requestedSitOffset = new LLVector3(); private LLVector3 m_requestedSitOffset = new LLVector3();
private float m_sitAvatarHeight = 2.0f; private float m_sitAvatarHeight = 2.0f;
private float m_godlevel = 0; private float m_godlevel = 0;
private LLVector3 m_LastChildAgentUpdatePosition = new LLVector3();
private int m_perfMonMS = 0; private int m_perfMonMS = 0;
@ -90,6 +91,8 @@ namespace OpenSim.Region.Environment.Scenes
private LLQuaternion m_headrotation = new LLQuaternion(); private LLQuaternion m_headrotation = new LLQuaternion();
private byte m_state = (byte) 0; private byte m_state = (byte) 0;
private List<LLUUID> m_knownPrimUUID = new List<LLUUID>();
// Agent's Draw distance. // Agent's Draw distance.
protected float m_DrawDistance = 0f; protected float m_DrawDistance = 0f;
@ -136,6 +139,17 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_physicsActor; } get { return m_physicsActor; }
} }
public bool KnownPrim(LLUUID primID)
{
if (m_knownPrimUUID.Contains(primID))
{
return true;
}
m_knownPrimUUID.Add(primID);
return false;
}
public bool Updated public bool Updated
{ {
set { m_updateflag = value; } set { m_updateflag = value; }
@ -499,7 +513,7 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid);
//if (!m_gotAllObjectsInScene) //if (!m_gotAllObjectsInScene)
//{ //{
//m_scene.SendAllSceneObjectsToClient(this); m_scene.SendAllSceneObjectsToClient(this);
//m_gotAllObjectsInScene = true; //m_gotAllObjectsInScene = true;
//} //}
} }
@ -1408,6 +1422,29 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.NotifyMyCoarseLocationChange(); m_scene.NotifyMyCoarseLocationChange();
} }
} }
// Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
if (Util.GetDistanceTo(AbsolutePosition,m_LastChildAgentUpdatePosition) > 32)
{
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
cadu.ActiveGroupID=LLUUID.Zero.UUID;
cadu.AgentID = UUID.UUID;
cadu.alwaysrun = m_setAlwaysRun;
cadu.AVHeight = m_avHeight;
LLVector3 tempCameraCenter = new LLVector3(m_CameraCenter.x, m_CameraCenter.y, m_CameraCenter.z);
cadu.cameraPosition = new sLLVector3(tempCameraCenter);
cadu.drawdistance = m_DrawDistance;
cadu.godlevel = m_godlevel;
cadu.GroupAccess = 0;
cadu.Position = new sLLVector3(AbsolutePosition);
cadu.regionHandle = m_scene.RegionInfo.RegionHandle;
cadu.throttles = ControllingClient.GetThrottlesPacked(1f);
cadu.Velocity = new sLLVector3(Velocity);
m_scene.SendOutChildAgentUpdates(cadu,this);
m_LastChildAgentUpdatePosition.X = AbsolutePosition.X;
m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y;
m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z;
}
} }
#endregion #endregion
@ -1532,15 +1569,30 @@ namespace OpenSim.Region.Environment.Scenes
/// This updates important decision making data about a child agent /// This updates important decision making data about a child agent
/// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
/// </summary> /// </summary>
public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData) public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
{ {
// //
int shiftx = ((int)rRegionX - (int)tRegionX) * 256;
int shifty = ((int)rRegionY - (int)tRegionY) * 256;
m_DrawDistance = cAgentData.drawdistance; m_DrawDistance = cAgentData.drawdistance;
m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z); m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z);
// It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
m_CameraCenter = m_CameraCenter =
new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
m_godlevel = cAgentData.godlevel; m_godlevel = cAgentData.godlevel;
SetHeight(cAgentData.AVHeight);
ControllingClient.SetChildAgentThrottle(cAgentData.throttles); ControllingClient.SetChildAgentThrottle(cAgentData.throttles);
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
if (m_scene.m_sendTasksToChild)
m_scene.SendAllSceneObjectsToClient(this);
//cAgentData.AVHeight; //cAgentData.AVHeight;
//cAgentData.regionHandle; //cAgentData.regionHandle;
//m_velocity = cAgentData.Velocity; //m_velocity = cAgentData.Velocity;

View File

@ -226,6 +226,11 @@ namespace SimpleApp
public virtual void SetChildAgentThrottle(byte[] throttle) public virtual void SetChildAgentThrottle(byte[] throttle)
{ {
} }
public byte[] GetThrottlesPacked(float multiplier)
{
return new byte[0];
}
public virtual void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId) public virtual void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
{ {