Formatting cleanup. Minor refactoring.

This commit is contained in:
Jeff Ames
2008-03-18 14:51:42 +00:00
parent 9c428d9935
commit bf8b5844f2
17 changed files with 203 additions and 284 deletions

View File

@@ -212,6 +212,7 @@ namespace OpenSim.Region.Communications.Local
}
return mapBlocks;
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{
if (m_regionListeners.ContainsKey(regionHandle))
@@ -245,7 +246,7 @@ namespace OpenSim.Region.Communications.Local
return false;
}
// This function Is only here to keep this class in line with the Grid Interface.
// This function is only here to keep this class in line with the Grid Interface.
// It never gets called.
public virtual Dictionary<string, string> GetGridSettings()
{
@@ -291,14 +292,15 @@ namespace OpenSim.Region.Communications.Local
}
return false;
}
/// <summary>
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
///
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
//should change from agentCircuitData
// TODO: should change from agentCircuitData
{
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
@@ -352,8 +354,6 @@ namespace OpenSim.Region.Communications.Local
return false;
}
public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
{
if (m_regionListeners.ContainsKey(regionHandle))

View File

@@ -68,7 +68,6 @@ namespace OpenSim.Region.Communications.Local
authUsers = authenticate;
}
public override UserProfileData GetTheUser(string firstname, string lastname)
{
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
@@ -189,6 +188,7 @@ namespace OpenSim.Region.Communications.Local
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
}
}
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
{
LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList();
@@ -199,10 +199,10 @@ namespace OpenSim.Region.Communications.Local
buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms;
buddyitem.BuddyRightsGiven = (int)fl.FriendPerms;
buddylistreturn.AddNewBuddy(buddyitem);
}
return buddylistreturn;
}
protected override InventoryData CreateInventoryData(LLUUID userID)
{
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);

View File

@@ -134,7 +134,8 @@ namespace OpenSim.Region.Communications.OGS1
{
GridReq = new XmlRpcRequest("simulator_login", SendParams);
GridResp = GridReq.Send(serversInfo.GridURL, 16000);
} catch (Exception ex)
}
catch (Exception ex)
{
m_log.Error("Unable to connect to grid. Grid server not running?");
throw(ex);
@@ -182,7 +183,8 @@ namespace OpenSim.Region.Communications.OGS1
Hashtable griddatahash = GridRespData;
// Process Response
if (GridRespData.ContainsKey("error")) {
if (GridRespData.ContainsKey("error"))
{
string errorstring = (string)GridRespData["error"];
m_log.Error("Unable to connect to grid: " + errorstring);
return false;
@@ -202,7 +204,6 @@ namespace OpenSim.Region.Communications.OGS1
returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]);
}
m_queuedGridSettings.Clear();
}
@@ -308,10 +309,7 @@ namespace OpenSim.Region.Communications.OGS1
return regionInfo;
}
if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo))
{
}
else
if (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo))
{
try
{
@@ -366,54 +364,51 @@ namespace OpenSim.Region.Communications.OGS1
// Don't use this method. It's only for SLURLS and Logins
RegionInfo regionInfo = null;
try
{
Hashtable requestData = new Hashtable();
requestData["region_name_search"] = regionName;
requestData["authkey"] = serversInfo.GridSendKey;
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
Hashtable responseData = (Hashtable) GridResp.Value;
if (responseData.ContainsKey("error"))
{
Hashtable requestData = new Hashtable();
requestData["region_name_search"] = regionName;
requestData["authkey"] = serversInfo.GridSendKey;
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
Hashtable responseData = (Hashtable) GridResp.Value;
if (responseData.ContainsKey("error"))
{
m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]);
return null;
}
uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
string internalIpStr = (string) responseData["sim_ip"];
uint port = Convert.ToUInt32(responseData["sim_port"]);
string externalUri = (string) responseData["sim_uri"];
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
string neighbourExternalUri = externalUri;
regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
regionInfo.RemotingAddress = internalIpStr;
regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
regionInfo.RegionName = (string) responseData["region_name"];
m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo);
m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]);
return null;
}
catch (WebException)
{
m_log.Error("[OGS1 GRID SERVICES]: " +
"Region lookup failed for: " + regionName +
" - Is the GridServer down?");
}
uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
string internalIpStr = (string) responseData["sim_ip"];
uint port = Convert.ToUInt32(responseData["sim_port"]);
string externalUri = (string) responseData["sim_uri"];
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
string neighbourExternalUri = externalUri;
regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
regionInfo.RemotingAddress = internalIpStr;
regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
regionInfo.RegionName = (string) responseData["region_name"];
m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo);
}
catch (WebException)
{
m_log.Error("[OGS1 GRID SERVICES]: " +
"Region lookup failed for: " + regionName +
" - Is the GridServer down?");
}
return regionInfo;
}
/// <summary>
///
/// </summary>
@@ -465,9 +460,6 @@ namespace OpenSim.Region.Communications.OGS1
return neighbours;
}
/// <summary>
/// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
/// </summary>
@@ -519,7 +511,6 @@ namespace OpenSim.Region.Communications.OGS1
return response;
}
// Grid Request Processing
/// <summary>
/// Received from the user server when a user starts logging in. This call allows
@@ -596,7 +587,6 @@ namespace OpenSim.Region.Communications.OGS1
InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate;
InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection;
}
#region Methods called by regions in this instance
@@ -629,10 +619,10 @@ namespace OpenSim.Region.Communications.OGS1
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
@@ -738,29 +728,27 @@ namespace OpenSim.Region.Communications.OGS1
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found");
}
remObject = null;
m_log.Info("[OGS1 GRID SERVICES]: " +
gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
agentData.firstname + " " + agentData.lastname + " and got " +
retValue.ToString());
return retValue;
if (remObject != null)
{
retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
}
else
{
m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found");
}
remObject = null;
m_log.Info("[OGS1 GRID SERVICES]: " +
gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
agentData.firstname + " " + agentData.lastname + " and got " +
retValue.ToString());
return retValue;
}
NoteDeadRegion(regionHandle);
return false;
@@ -849,14 +837,12 @@ namespace OpenSim.Region.Communications.OGS1
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
typeof (
OGS1InterRegionRemoting),
"tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
typeof(OGS1InterRegionRemoting),
"tcp://" +
regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
@@ -939,7 +925,7 @@ namespace OpenSim.Region.Communications.OGS1
/// <returns></returns>
public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
{
int failures = 0;
int failures = 0;
lock (m_deadRegionCache)
{
if (m_deadRegionCache.ContainsKey(regionHandle))
@@ -963,12 +949,11 @@ namespace OpenSim.Region.Communications.OGS1
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
@@ -980,7 +965,6 @@ namespace OpenSim.Region.Communications.OGS1
}
remObject = null;
return retValue;
}
NoteDeadRegion(regionHandle);
@@ -1050,10 +1034,11 @@ namespace OpenSim.Region.Communications.OGS1
{
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
typeof (OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
typeof (OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
@@ -1106,10 +1091,11 @@ namespace OpenSim.Region.Communications.OGS1
{
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
typeof (OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
typeof (OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
@@ -1181,10 +1167,11 @@ namespace OpenSim.Region.Communications.OGS1
{
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue =
@@ -1211,7 +1198,6 @@ namespace OpenSim.Region.Communications.OGS1
//m_log.Debug(e.ToString());
return false;
}
catch (SocketException e)
{
NoteDeadRegion(regionHandle);
@@ -1312,7 +1298,6 @@ namespace OpenSim.Region.Communications.OGS1
{
if (m_deadRegionCache.ContainsKey(regionData.RegionHandle))
{
m_deadRegionCache.Remove(regionData.RegionHandle);
}
}
@@ -1356,7 +1341,6 @@ namespace OpenSim.Region.Communications.OGS1
m_localBackend.TriggerExpectPrim(regionHandle, primID, objData);
return true;
//m_localBackend.
}
catch (RemotingException e)
{

View File

@@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
{
m_log.Warn("Terrain commands have been depreciated.");
m_log.Warn("Terrain commands have been deprecated.");
return false;
}
@@ -332,11 +332,11 @@ namespace OpenSim.Region.Environment.Scenes
public void SetCurrentSceneTimePhase(int timePhase)
{
ForEachCurrentScene(delegate(Scene scene)
{
scene.SetTimePhase(
timePhase)
;
});
{
scene.SetTimePhase(
timePhase)
;
});
}
public void ForceCurrentSceneClientUpdate()

View File

@@ -33,9 +33,7 @@ using OpenSim.Framework;
namespace OpenSim.Region.Physics.Manager
{
public delegate void PositionUpdate(PhysicsVector position);
public delegate void VelocityUpdate(PhysicsVector velocity);
public delegate void OrientationUpdate(Quaternion orientation);
public enum ActorTypes : int
@@ -50,7 +48,6 @@ namespace OpenSim.Region.Physics.Manager
{
// Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
public int m_colliderType;
public int m_GenericStartEnd;
//public uint m_LocalID;
@@ -88,13 +85,10 @@ namespace OpenSim.Region.Physics.Manager
}
}
public abstract class PhysicsActor
{
public delegate void RequestTerseUpdate();
public delegate void CollisionUpdate(EventArgs e);
public delegate void OutOfBounds(PhysicsVector pos);
#pragma warning disable 67
@@ -138,9 +132,7 @@ namespace OpenSim.Region.Physics.Manager
if (handler != null)
{
handler();
handler();
}
}
@@ -150,9 +142,10 @@ namespace OpenSim.Region.Physics.Manager
// a race condition if the last subscriber unsubscribes
// immediately after the null check and before the event is raised.
OutOfBounds handler = OnOutOfBounds;
if (handler != null)
{
handler(pos);
handler(pos);
}
}
@@ -162,54 +155,34 @@ namespace OpenSim.Region.Physics.Manager
if (handler != null)
{
handler(e);
handler(e);
}
}
public abstract PhysicsVector Position { get; set; }
public abstract float Mass { get; }
public abstract PhysicsVector Force { get; }
public abstract PhysicsVector GeometricCenter { get; }
public abstract PhysicsVector CenterOfMass { get; }
public abstract PhysicsVector Velocity { get; set; }
public abstract float CollisionScore { get;}
public abstract PhysicsVector Acceleration { get; }
public abstract Quaternion Orientation { get; set; }
public abstract int PhysicsActorType { get; set; }
public abstract bool IsPhysical { get; set; }
public abstract bool Flying { get; set; }
public abstract bool SetAlwaysRun { get; set; }
public abstract bool ThrottleUpdates { get; set; }
public abstract bool IsColliding { get; set; }
public abstract bool CollidingGround { get; set; }
public abstract bool CollidingObj { get; set; }
public abstract bool FloatOnWater { set; }
public abstract PhysicsVector RotationalVelocity { get; set; }
public abstract bool Kinematic { get; set; }
public abstract float Buoyancy { get; set; }
public abstract void AddForce(PhysicsVector force);
public abstract void SetMomentum(PhysicsVector momentum);
}
public class NullPhysicsActor : PhysicsActor
@@ -246,7 +219,8 @@ namespace OpenSim.Region.Physics.Manager
set { return; }
}
public override float Buoyancy {
public override float Buoyancy
{
get { return 0f; }
set { return; }
}
@@ -256,7 +230,6 @@ namespace OpenSim.Region.Physics.Manager
set { return; }
}
public override bool CollidingGround
{
get { return false; }
@@ -313,10 +286,8 @@ namespace OpenSim.Region.Physics.Manager
public override void CrossingFailure()
{
}
public override Quaternion Orientation
{
get { return Quaternion.Identity; }
@@ -366,17 +337,14 @@ namespace OpenSim.Region.Physics.Manager
public override void link(PhysicsActor obj)
{
}
public override void delink()
{
}
public override void AddForce(PhysicsVector force)
{
return;
}
public override PhysicsVector RotationalVelocity
@@ -387,7 +355,6 @@ namespace OpenSim.Region.Physics.Manager
public override void SetMomentum(PhysicsVector momentum)
{
return;
}
}
}

View File

@@ -142,7 +142,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
}
public void SenseOnce(uint m_localID, LLUUID m_itemID,
string name, LLUUID keyID, int type, double range, double arc, SceneObjectPart host)
string name, LLUUID keyID, int type,
double range, double arc, SceneObjectPart host)
{
// Add to timer
SenseRepeatClass ts = new SenseRepeatClass();
@@ -210,7 +211,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
foreach (EntityBase ent in m_CmdManager.m_ScriptEngine.World.Entities.Values)
{
LLVector3 toRegionPos = ent.AbsolutePosition + regionPos;
double dis = Math.Abs((double)Util.GetDistanceTo(toRegionPos, fromRegionPos));
if (dis <= ts.range)