* Cleaning code still.

0.6.0-stable
Adam Frisby 2008-05-01 16:41:01 +00:00
parent c803e0cca1
commit fc6c4dc399
41 changed files with 845 additions and 809 deletions

View File

@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
for (int i = 0; i < regionsToLoad.Length; i++)
{
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() +
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId +
")");
openSim.CreateRegion(regionsToLoad[i], true);
}
@ -106,7 +106,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
if (regionhandle == regionsToLoad[i].RegionHandle)
{
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId.ToString() + ")");
Thread.CurrentThread.ManagedThreadId + ")");
openSim.CreateRegion(regionsToLoad[i], true);
}
}

View File

@ -54,6 +54,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private BaseHttpServer m_httpd;
private string requiredPassword = String.Empty;
#region IApplicationPlugin Members
public void Initialise(OpenSimMain openSim)
{
try
@ -82,6 +84,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
}
public void Close()
{
}
#endregion
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
@ -90,8 +98,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable responseData = new Hashtable();
m_log.Info("[RADMIN]: Request to restart Region.");
try {
checkStringParameters(request, new string[] { "password", "regionID" });
try
{
checkStringParameters(request, new[] {"password", "regionID"});
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@ -130,8 +139,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable();
try {
checkStringParameters(request, new string[] { "password", "message" });
try
{
checkStringParameters(request, new[] {"password", "message"});
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@ -168,12 +178,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
foreach (string k in requestData.Keys)
{
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
k, (string)requestData[k], ((string)requestData[k]).Length);
k, requestData[k], ((string) requestData[k]).Length);
}
Hashtable responseData = new Hashtable();
try {
checkStringParameters(request, new string[] { "password", "filename", "regionid"});
try
{
checkStringParameters(request, new[] {"password", "filename", "regionid"});
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@ -217,7 +228,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable();
try {
try
{
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
throw new Exception("wrong password");
@ -232,7 +244,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
requestData.ContainsKey("milliseconds"))
{
timeout = (Int32) requestData["milliseconds"];
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((timeout / 1000)) +
" second(s). Please save what you are doing and log out.");
}
else
@ -243,7 +255,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Perform shutdown
Timer shutdownTimer = new Timer(timeout); // Wait before firing
shutdownTimer.AutoReset = false;
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
shutdownTimer.Elapsed += shutdownTimer_Elapsed;
shutdownTimer.Start();
responseData["success"] = "true";
@ -345,13 +357,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable();
try {
checkStringParameters(request, new string[] { "password",
try
{
checkStringParameters(request, new[]
{
"password",
"region_name",
"region_master_first", "region_master_last",
"region_master_password",
"listen_ip", "external_address"});
checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"});
"listen_ip", "external_address"
});
checkIntegerParams(request, new[] {"region_x", "region_y", "listen_port"});
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
@ -424,9 +440,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
String.Format("{0}x{1}-{2}.xml",
region.RegionLocX.ToString(),
region.RegionLocY.ToString(),
regionID.ToString()));
region.RegionLocX,
region.RegionLocY,
regionID));
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionConfigPath);
region.SaveRegionToFile("dynamic region", regionConfigPath);
@ -500,9 +516,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
// check completeness
checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname", "user_password" });
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
checkStringParameters(request, new[]
{
"password", "user_firstname",
"user_lastname", "user_password"
});
checkIntegerParams(request, new[] {"start_region_x", "start_region_y"});
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
@ -521,7 +540,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY);
if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
if (userID == LLUUID.Zero)
throw new Exception(String.Format("failed to create new user {0} {1}",
firstname, lastname));
responseData["success"] = "true";
@ -556,7 +576,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
// check completeness
foreach (string p in new string[] { "password", "filename" })
foreach (string p in new[] {"password", "filename"})
{
if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p));
@ -573,7 +593,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
LLUUID region_uuid = (string) requestData["region_uuid"];
if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
throw new Exception(String.Format("failed to switch to region {0}", region_uuid));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
}
else if (requestData.Contains("region_name"))
@ -606,9 +626,5 @@ namespace OpenSim.ApplicationPlugins.RemoteController
return response;
}
public void Close()
{
}
}
}

View File

@ -70,7 +70,7 @@ namespace OpenSim.Data.MSSQL
override public AssetBase FetchAsset(LLUUID assetID)
{
AssetBase asset = null;
AssetBase asset;
Dictionary<string, string> param = new Dictionary<string, string>();
param["id"] = assetID.ToString();

View File

@ -46,14 +46,48 @@ namespace OpenSim.Grid.AssetServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public AssetConfig m_config;
public static OpenAsset_Main assetserver;
// Temporarily hardcoded - should be a plugin
protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
private IAssetProvider m_assetProvider;
public AssetConfig m_config;
public OpenAsset_Main()
{
m_console = new ConsoleBase("OpenAsset", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice(
@"shutdown - shutdown this asset server (USE CAUTION!)
stats - statistical information for this server");
break;
case "stats":
m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
#endregion
[STAThread]
public static void Main(string[] args)
@ -78,13 +112,6 @@ namespace OpenSim.Grid.AssetServer
}
}
public OpenAsset_Main()
{
m_console = new ConsoleBase("OpenAsset", this);
MainConsole.Instance = m_console;
}
public void Startup()
{
m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
@ -160,7 +187,7 @@ namespace OpenSim.Grid.AssetServer
catch (Exception e)
{
m_log.Warn("[ASSET]: setupDB() - Exception occured");
m_log.Warn("[ASSET]: " + e.ToString());
m_log.Warn("[ASSET]: " + e);
}
}
@ -173,29 +200,5 @@ namespace OpenSim.Grid.AssetServer
{
m_assetProvider.CreateAsset(asset);
}
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice(
@"shutdown - shutdown this asset server (USE CAUTION!)
stats - statistical information for this server");
break;
case "stats":
m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
}
}

View File

@ -43,8 +43,8 @@ namespace OpenSim.Grid.AssetServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IAssetProvider m_assetProvider;
private OpenAsset_Main m_assetManager;
private IAssetProvider m_assetProvider;
/// <summary>
/// Constructor.
@ -64,7 +64,7 @@ namespace OpenSim.Grid.AssetServer
string param = GetParam(path);
byte[] result = new byte[] {};
string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
if (p.Length > 0)
{
@ -99,7 +99,7 @@ namespace OpenSim.Grid.AssetServer
"[REST]: GET:/asset found {0} with name {1}, size {2} bytes",
assetID, asset.Name, result.Length);
Array.Resize<byte>(ref result, (int) ms.Length);
Array.Resize(ref result, (int) ms.Length);
}
else
{
@ -118,8 +118,15 @@ namespace OpenSim.Grid.AssetServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IAssetProvider m_assetProvider;
private OpenAsset_Main m_assetManager;
private IAssetProvider m_assetProvider;
public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
: base("POST", "/assets")
{
m_assetManager = assetManager;
m_assetProvider = assetProvider;
}
public override byte[] Handle(string path, Stream request)
{
@ -139,12 +146,5 @@ namespace OpenSim.Grid.AssetServer
return new byte[] {};
}
public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
: base("POST", "/assets")
{
m_assetManager = assetManager;
m_assetProvider = assetProvider;
}
}
}

View File

@ -44,11 +44,11 @@ namespace OpenSim.Grid.GridServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
private readonly Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
// This is here so that the grid server can hand out MessageServer settings to regions on registration
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
private readonly List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
private readonly Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
public GridConfig Config;
@ -152,7 +152,7 @@ namespace OpenSim.Grid.GridServer
}
catch
{
m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key);
m_log.Warn("[storage]: Unable to find region " + handle + " via " + kvp.Key);
}
}
return null;
@ -228,10 +228,10 @@ namespace OpenSim.Grid.GridServer
response += "<neighbour>";
response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
response += "<sim_port>" + neighbour.serverPort + "</sim_port>";
response += "<locx>" + neighbour.regionLocX + "</locx>";
response += "<locy>" + neighbour.regionLocY + "</locy>";
response += "<regionhandle>" + neighbour.regionHandle + "</regionhandle>";
response += "</neighbour>";
}
}
@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer
catch (FormatException e)
{
m_log.Info("[GRID]: Invalid login parameters, ignoring.");
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() );
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e);
}
existingSim = GetRegion(sim.regionHandle);
@ -360,8 +360,8 @@ namespace OpenSim.Grid.GridServer
catch (Exception e)
{
m_log.Warn("[storage]: " +
"Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key);
m_log.Warn("[storage]: " + e.ToString());
"Unable to add region " + sim.UUID + " via " + kvp.Key);
m_log.Warn("[storage]: " + e);
}
}
@ -375,7 +375,8 @@ namespace OpenSim.Grid.GridServer
{
m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName +
" at location " + sim.regionLocX +
" " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
" " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey +
") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
}
else
{
@ -389,7 +390,8 @@ namespace OpenSim.Grid.GridServer
}
else
{
m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY +
" currently occupied by " + existingSim.regionName);
return ErrorResponse("Another region already exists at that location. Try another");
}
}
@ -464,7 +466,7 @@ namespace OpenSim.Grid.GridServer
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
{
NeighbourBlock = new Hashtable();
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString();
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP).ToString();
NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
@ -532,7 +534,6 @@ namespace OpenSim.Grid.GridServer
sim.regionSecret = regionsecret;
else
sim.regionSecret = Config.SimRecvKey;
}
else
{
@ -577,7 +578,9 @@ namespace OpenSim.Grid.GridServer
sim.regionRecvKey = (string) requestData["recvkey"];
sim.regionSendKey = (string) requestData["authkey"];
}
catch (KeyNotFoundException) { }
catch (KeyNotFoundException)
{
}
sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
sim.serverURI = (string) requestData["server_uri"];
@ -690,7 +693,7 @@ namespace OpenSim.Grid.GridServer
}
else
{
m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " +
m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " +
(string) requestData["region_handle"]);
responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
responseData["sim_port"] = simData.serverPort.ToString();
@ -750,8 +753,8 @@ namespace OpenSim.Grid.GridServer
Hashtable simProfileBlock = new Hashtable();
simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " +
aSim.Value.regionLocY.ToString());
Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " +
aSim.Value.regionLocY);
simProfileBlock["name"] = aSim.Value.regionName;
simProfileBlock["access"] = 21;
simProfileBlock["region-flags"] = 512;
@ -761,15 +764,15 @@ namespace OpenSim.Grid.GridServer
// For Sugilite compatibility
simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
simProfileBlock["sim_ip"] = aSim.Value.serverIP;
simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
simProfileBlock["sim_uri"] = aSim.Value.serverURI;
simProfileBlock["uuid"] = aSim.Value.UUID.ToString();
simProfileBlock["remoting_port"] = aSim.Value.remotingPort;
simProfileList.Add(simProfileBlock);
}
m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() +
m_log.Info("[MAP]: Fast map " + simProfileList.Count +
" regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
}
else
@ -795,16 +798,16 @@ namespace OpenSim.Grid.GridServer
// For Sugilite compatibility
simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
simProfileBlock["sim_ip"] = simProfile.serverIP;
simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
simProfileBlock["sim_uri"] = simProfile.serverURI;
simProfileBlock["uuid"] = simProfile.UUID.ToString();
simProfileList.Add(simProfileBlock);
}
}
}
m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() +
m_log.Info("[MAP]: Std map " + simProfileList.Count +
" regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
}
@ -860,12 +863,12 @@ namespace OpenSim.Grid.GridServer
respstring = "<Root>";
respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
respstring += "<sim>";
respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
respstring += "<uuid>" + TheSim.UUID + "</uuid>";
respstring += "<regionname>" + TheSim.regionName + "</regionname>";
respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "</sim_ip>";
respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP) + "</sim_ip>";
respstring += "<sim_port>" + TheSim.serverPort + "</sim_port>";
respstring += "<region_locx>" + TheSim.regionLocX + "</region_locx>";
respstring += "<region_locy>" + TheSim.regionLocY + "</region_locy>";
respstring += "<estate_id>1</estate_id>";
respstring += "</sim>";
respstring += "</Root>";
@ -946,12 +949,12 @@ namespace OpenSim.Grid.GridServer
break;
case "region_locx":
theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
theSim.regionLocX = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
break;
case "region_locy":
theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
theSim.regionLocY = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
break;
}
@ -1005,14 +1008,14 @@ namespace OpenSim.Grid.GridServer
catch (Exception e)
{
m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
e.ToString());
e);
}
}
return "OK";
}
catch (Exception e)
{
return "ERROR! Could not save to database! (" + e.ToString() + ")";
return "ERROR! Could not save to database! (" + e + ")";
}
}

View File

@ -44,6 +44,34 @@ namespace OpenSim.Grid.GridServer
protected GridManager m_gridManager;
protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
public GridServerBase()
{
m_console = new ConsoleBase("OpenGrid", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "shutdown":
foreach (IGridPlugin plugin in m_plugins) plugin.Close();
m_console.Close();
Environment.Exit(0);
break;
}
}
#endregion
public void Work()
{
m_console.Notice("Enter help for a list of commands\n");
@ -54,12 +82,6 @@ namespace OpenSim.Grid.GridServer
}
}
public GridServerBase()
{
m_console = new ConsoleBase("OpenGrid", this);
MainConsole.Instance = m_console;
}
public void managercallback(string cmd)
{
switch (cmd)
@ -90,7 +112,7 @@ namespace OpenSim.Grid.GridServer
m_console.Status("[GRID]: Starting sim status checker");
Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
simCheckTimer.Elapsed += CheckSims;
simCheckTimer.Enabled = true;
}
@ -177,23 +199,5 @@ namespace OpenSim.Grid.GridServer
}
*/
}
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "shutdown":
foreach (IGridPlugin plugin in m_plugins) plugin.Close();
m_console.Close();
Environment.Exit(0);
break;
}
}
}
}

View File

@ -136,10 +136,12 @@ namespace OpenSim.Grid.InventoryServer
return fixupFolder(inventory.root, null);
}
#region Nested type: GetInventory
public class GetInventory : BaseStreamHandler
{
private SerializableInventory _inventory;
private InventoryManager _manager;
private readonly SerializableInventory _inventory;
private readonly InventoryManager _manager;
public GetInventory(InventoryManager manager)
: base("GET", "/inventory")
@ -181,7 +183,7 @@ namespace OpenSim.Grid.InventoryServer
{
byte[] result = new byte[] {};
string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
string[] parms = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if (parms.Length > 1)
{
if (string.Compare(parms[1], "library", true) == 0)
@ -190,7 +192,7 @@ namespace OpenSim.Grid.InventoryServer
saveInventoryToStream(_inventory, ms);
result = ms.GetBuffer();
Array.Resize<byte>(ref result, (int) ms.Length);
Array.Resize(ref result, (int) ms.Length);
}
else if (string.Compare(parms[1], "user", true) == 0)
{
@ -203,5 +205,7 @@ namespace OpenSim.Grid.InventoryServer
return result;
}
}
#endregion
}
}

View File

@ -40,13 +40,38 @@ namespace OpenSim.Grid.InventoryServer
{
public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
{
public const string LogName = "INVENTORY";
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private InventoryManager m_inventoryManager;
private InventoryConfig m_config;
private InventoryManager m_inventoryManager;
private GridInventoryService m_inventoryService;
public const string LogName = "INVENTORY";
public OpenInventory_Main()
{
m_console = new ConsoleBase(LogName, this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "add-user":
m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
#endregion
[STAThread]
public static void Main(string[] args)
@ -59,12 +84,6 @@ namespace OpenSim.Grid.InventoryServer
theServer.Work();
}
public OpenInventory_Main()
{
m_console = new ConsoleBase(LogName, this);
MainConsole.Instance = m_console;
}
public void Startup()
{
m_log.Info("Initialising inventory manager...");
@ -134,21 +153,5 @@ namespace OpenSim.Grid.InventoryServer
m_console.Prompt();
}
}
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "add-user":
m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
}
}

View File

@ -44,9 +44,42 @@ namespace OpenSim.Grid.MessagingServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private MessageServerConfig Cfg;
private MessageService msgsvc;
private LLUUID m_lastCreatedUser = LLUUID.Random();
private MessageService msgsvc;
private OpenMessage_Main()
{
m_console = new ConsoleBase("OpenMessage", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
break;
case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close();
Environment.Exit(0);
break;
}
}
public override void Show(string ShowWhat)
{
base.Show(ShowWhat);
}
#endregion
[STAThread]
public static void Main(string[] args)
@ -56,19 +89,12 @@ namespace OpenSim.Grid.MessagingServer
m_log.Info("Launching MessagingServer...");
OpenMessage_Main messageserver = new OpenMessage_Main();
messageserver.Startup();
messageserver.Work();
}
private OpenMessage_Main()
{
m_console = new ConsoleBase("OpenMessage", this);
MainConsole.Instance = m_console;
}
private void Work()
{
m_console.Notice("Enter help for a list of commands\n");
@ -123,7 +149,8 @@ namespace OpenSim.Grid.MessagingServer
{
//userID =
//m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
} catch (Exception ex)
}
catch (Exception ex)
{
m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
}
@ -141,28 +168,5 @@ namespace OpenSim.Grid.MessagingServer
break;
}
}
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
break;
case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close();
Environment.Exit(0);
break;
}
}
public override void Show(string ShowWhat)
{
base.Show(ShowWhat);
}
}
}

View File

@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private MessageServerConfig m_cfg;
private readonly MessageServerConfig m_cfg;
private readonly Hashtable m_presence_BackReferences = new Hashtable();
//A hashtable of all current presences this server knows about
private Hashtable m_presences = new Hashtable();
private readonly Hashtable m_presences = new Hashtable();
//a hashtable of all current regions this server knows about
private Hashtable m_regionInfoCache = new Hashtable();
private readonly Hashtable m_regionInfoCache = new Hashtable();
//A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing
private Hashtable m_presence_BackReferences = new Hashtable();
// Hashtable containing work units that need to be processed
private Hashtable m_unProcessedWorkUnits = new Hashtable();
@ -126,7 +126,7 @@ namespace OpenSim.Grid.MessagingServer
PresenceInformer friendlistupdater = new PresenceInformer();
friendlistupdater.presence1 = friendpresence;
friendlistupdater.presence2 = userpresence;
WaitCallback cb = new WaitCallback(friendlistupdater.go);
WaitCallback cb = friendlistupdater.go;
ThreadPool.QueueUserWorkItem(cb);
//SendRegionPresenceUpdate(friendpresence, userpresence);
@ -147,7 +147,7 @@ namespace OpenSim.Grid.MessagingServer
friendlistupdater.presence1 = userpresence;
friendlistupdater.presence2 = friendpresence;
WaitCallback cb2 = new WaitCallback(friendlistupdater.go);
WaitCallback cb2 = friendlistupdater.go;
ThreadPool.QueueUserWorkItem(cb2);
//SendRegionPresenceUpdate(userpresence, friendpresence);
@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer
friendlistupdater.presence1 = AgentData;
friendlistupdater.presence2 = friendd;
WaitCallback cb3 = new WaitCallback(friendlistupdater.go);
WaitCallback cb3 = friendlistupdater.go;
ThreadPool.QueueUserWorkItem(cb3);
//SendRegionPresenceUpdate(AgentData, friendd);
@ -304,7 +304,6 @@ namespace OpenSim.Grid.MessagingServer
{
buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
}
}
catch (WebException e)
{
@ -329,10 +328,10 @@ namespace OpenSim.Grid.MessagingServer
{
FriendListItem buddylistitem = new FriendListItem();
buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]);
buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]);
buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]);
buddylistitem.Friend = new LLUUID((string) data["friendID" + i]);
buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]);
buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]);
buddylist.Add(buddylistitem);
}
@ -447,7 +446,8 @@ namespace OpenSim.Grid.MessagingServer
/// <param name="regionHandle"></param>
/// <returns></returns>
public RegionProfileData RequestRegionInfo(ulong regionHandle)
{ RegionProfileData regionProfile = null;
{
RegionProfileData regionProfile = null;
try
{
Hashtable requestData = new Hashtable();
@ -494,7 +494,7 @@ namespace OpenSim.Grid.MessagingServer
catch (WebException)
{
m_log.Error("[GRID]: " +
"Region lookup failed for: " + regionHandle.ToString() +
"Region lookup failed for: " + regionHandle +
" - Is the GridServer down?");
return null;
}
@ -530,7 +530,8 @@ namespace OpenSim.Grid.MessagingServer
{
UserReq = new XmlRpcRequest("register_messageserver", SendParams);
UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
} catch (Exception ex)
}
catch (Exception ex)
{
m_log.Error("Unable to connect to grid. Grid server not running?");
throw (ex);

View File

@ -35,21 +35,16 @@ namespace OpenSim.Grid.MessagingServer
{
public class PresenceInformer
{
public UserPresenceData presence1 = null;
public UserPresenceData presence2 = null;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public UserPresenceData presence1;
public UserPresenceData presence2;
public PresenceInformer()
{
}
public void go(object o)
{
if (presence1 != null && presence2 != null)
{
SendRegionPresenceUpdate(presence1, presence2);
}
}
/// <summary>

View File

@ -36,13 +36,9 @@ namespace OpenSim.Grid.MessagingServer
public class UserPresenceData
{
public AgentCircuitData agentData = new AgentCircuitData();
public RegionProfileData regionData = new RegionProfileData();
public string httpURI = String.Empty;
public List<FriendListItem> friendData = new List<FriendListItem>();
public string httpURI = String.Empty;
public RegionProfileData regionData = new RegionProfileData();
public List<LLUUID> subscriptionData = new List<LLUUID>();
public UserPresenceData()
{
}
}
}

View File

@ -48,7 +48,6 @@ namespace OpenSim.Grid.MessagingServer
: base("GET", "/presence")
{
m_log.Info("[REST]: In Get Request");
}
public override byte[] Handle(string path, Stream request)
@ -57,7 +56,7 @@ namespace OpenSim.Grid.MessagingServer
byte[] result = new byte[] {};
try
{
string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
if (p.Length > 0)
{
@ -69,7 +68,6 @@ namespace OpenSim.Grid.MessagingServer
"[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
return result;
}
}
}
catch (Exception e)
@ -84,6 +82,11 @@ namespace OpenSim.Grid.MessagingServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public PostXMPPStreamHandler()
: base("POST", "/presence")
{
}
public override byte[] Handle(string path, Stream request)
{
string param = GetParam(path);
@ -97,12 +100,5 @@ namespace OpenSim.Grid.MessagingServer
return new byte[] {};
}
public PostXMPPStreamHandler()
: base("POST", "/presence")
{
}
}
}

View File

@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer
XmlConfigurator.Configure();
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
CurrentDomain_UnhandledException;
// Application is starting
SE = new ScriptServerMain();
@ -50,7 +50,7 @@ namespace OpenSim.Grid.ScriptServer
Console.WriteLine(String.Empty);
Console.WriteLine("APPLICATION EXCEPTION DETECTED");
Console.WriteLine(String.Empty);
Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
Console.WriteLine("Application is terminating: " + e.IsTerminating);
//Console.WriteLine("Exception:");
//Console.WriteLine(e.ExceptionObject.ToString());
}

View File

@ -34,9 +34,13 @@ namespace OpenSim.Grid.ScriptServer
{
// This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
#region ServerRemotingObject Members
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
{
return ScriptServerMain.Engine.EventManager();
}
#endregion
}
}

View File

@ -31,9 +31,10 @@ using System.Runtime.Remoting.Channels.Tcp;
namespace OpenSim.Grid.ScriptServer
{
class RemotingServer
internal class RemotingServer
{
TcpChannel channel;
private readonly TcpChannel channel;
public RemotingServer(int port, string instanceName)
{
// Create an instance of a channel

View File

@ -32,8 +32,13 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
// These are events that the region needs to have
// TEMP: Using System.Delegate -- needs replacing with a real delegate
#region Delegates
public delegate void DefaultDelegate();
#endregion
public event DefaultDelegate onScriptRez;
public event DefaultDelegate onstate_entry;
public event DefaultDelegate onstate_exit;

View File

@ -29,8 +29,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
{
public class RegionConnectionManager : RegionBase
{
private ScriptServerMain m_ScriptServerMain;
private object m_Connection;
private ScriptServerMain m_ScriptServerMain;
public RegionConnectionManager(ScriptServerMain scm, object Connection)
{

View File

@ -34,12 +34,10 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
{
internal class RegionCommManager
{
private readonly ScriptServerMain m_ScriptServerMain;
private readonly List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private Thread listenThread;
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private ScriptServerMain m_ScriptServerMain;
public RegionCommManager(ScriptServerMain scm)
{
m_ScriptServerMain = scm;

View File

@ -51,7 +51,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
{
m_log.Error("[ScriptEngine]: " +
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
e.StackTrace.ToString());
e.StackTrace);
}
return ret;
}

View File

@ -32,8 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
{
internal class ScriptEngineManager
{
private ScriptEngineLoader ScriptEngineLoader;
private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
private readonly ScriptEngineLoader ScriptEngineLoader;
private readonly List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
private ScriptServerMain m_ScriptServerMain;
// Initialize

View File

@ -44,18 +44,18 @@ namespace OpenSim.Grid.ScriptServer
//
// Root object. Creates objects used.
//
private int listenPort = 8010;
// TEMP
public static ScriptServerInterfaces.ScriptEngine Engine;
private int listenPort = 8010;
//public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false);
// Objects we use
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
//internal RemotingServer m_RemotingServer;
internal TCPServer m_TCPServer;
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal TRPC_Remote RPC;
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
public ScriptServerMain()
{
@ -74,7 +74,7 @@ namespace OpenSim.Grid.ScriptServer
//m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
m_TCPServer = new TCPServer(listenPort);
RPC = new TRPC_Remote(m_TCPServer);
RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
RPC.ReceiveCommand += RPC_ReceiveCommand;
m_TCPServer.StartListen();
Console.ReadLine();

View File

@ -48,12 +48,61 @@ namespace OpenSim.Grid.UserServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private UserConfig Cfg;
private LLUUID m_lastCreatedUser = LLUUID.Random();
public UserManager m_userManager;
public UserLoginService m_loginService;
public MessageServersConnector m_messagesService;
public UserManager m_userManager;
private LLUUID m_lastCreatedUser = LLUUID.Random();
private OpenUser_Main()
{
m_console = new ConsoleBase("OpenUser", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("create user - create a new user");
m_console.Notice("stats - statistical information for this server");
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "create":
do_create(cmdparams[0]);
break;
case "shutdown":
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
m_console.Close();
Environment.Exit(0);
break;
case "stats":
m_console.Notice(StatsManager.UserStats.Report());
break;
case "test-inventory":
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
// requester.ReturnResponseVal = TestResponse;
// requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
m_userManager.
_config.
InventoryUrl +
"RootFolders/",
m_lastCreatedUser);
break;
}
}
#endregion
[STAThread]
public static void Main(string[] args)
@ -68,12 +117,6 @@ namespace OpenSim.Grid.UserServer
userserver.Work();
}
private OpenUser_Main()
{
m_console = new ConsoleBase("OpenUser", this);
MainConsole.Instance = m_console;
}
private void Work()
{
m_console.Notice("Enter help for a list of commands\n");
@ -193,7 +236,6 @@ namespace OpenSim.Grid.UserServer
+ " Please contact your inventory service provider for more information.",
userID));
}
}
catch (WebException e)
{
@ -211,46 +253,6 @@ namespace OpenSim.Grid.UserServer
}
}
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("create user - create a new user");
m_console.Notice("stats - statistical information for this server");
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "create":
do_create(cmdparams[0]);
break;
case "shutdown":
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
m_console.Close();
Environment.Exit(0);
break;
case "stats":
m_console.Notice(StatsManager.UserStats.Report());
break;
case "test-inventory":
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
// requester.ReturnResponseVal = TestResponse;
// requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
m_userManager.
_config.
InventoryUrl +
"RootFolders/",
m_lastCreatedUser);
break;
}
}
public void TestResponse(List<InventoryFolderBase> resp)
{
m_console.Notice("response got");
@ -265,7 +267,6 @@ namespace OpenSim.Grid.UserServer
ulong regionhandle, float positionX, float positionY,
float positionZ, string firstname, string lastname)
{
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
positionY, positionZ, firstname, lastname);
}

View File

@ -78,6 +78,7 @@ namespace OpenSim.Grid.UserServer
MessageServers["URI"] = msginfo;
}
}
public void RemoveResponsibleRegion(string URI, ulong regionhandle)
{
if (!MessageServers.ContainsKey(URI))
@ -93,8 +94,8 @@ namespace OpenSim.Grid.UserServer
MessageServers["URI"] = msginfo;
}
}
}
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
@ -116,6 +117,7 @@ namespace OpenSim.Grid.UserServer
}
return response;
}
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
@ -132,6 +134,7 @@ namespace OpenSim.Grid.UserServer
}
return response;
}
public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
@ -250,7 +253,6 @@ namespace OpenSim.Grid.UserServer
{
m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
}
}
}
}

View File

@ -47,9 +47,7 @@ namespace OpenSim.Grid.UserServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
private UserLoggedInAtLocation handlerUserLoggedInAtLocation;
public UserConfig m_config;
@ -61,6 +59,8 @@ namespace OpenSim.Grid.UserServer
m_config = config;
}
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
/// <summary>
/// Customises the login response and fills in missing values.
/// </summary>
@ -95,7 +95,8 @@ namespace OpenSim.Grid.UserServer
else
{
string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" +
startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
if (startLocationRequestParsed[0] == "last")
{
// TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
@ -119,7 +120,9 @@ namespace OpenSim.Grid.UserServer
RegionProfileData.RequestSimProfileData(
theUser.HomeRegion, m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey);
} else {
}
else
{
start_x = Convert.ToInt32(startLocationRequestParsed[1]);
start_y = Convert.ToInt32(startLocationRequestParsed[2]);
start_z = Convert.ToInt32(startLocationRequestParsed[3]);
@ -130,20 +133,20 @@ namespace OpenSim.Grid.UserServer
// Customise the response
//CFK: This is redundant and the next message should always appear.
//CFK: m_log.Info("[LOGIN]: Home Location");
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
"'position':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}";
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
(SimInfo.regionLocY * Constants.RegionSize) + "], " +
"'position':[r" + theUser.HomeLocation.X + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
"'look_at':[r" + theUser.HomeLocation.X + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
// Destination
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
//CFK: the next one for X & Y and comment this one.
//CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
//CFK: "; Region Y: " + SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString();
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY;
@ -163,7 +166,8 @@ namespace OpenSim.Grid.UserServer
theUser.CurrentAgent.Region = SimInfo.UUID;
theUser.CurrentAgent.Handle = SimInfo.regionHandle;
if (start_x >= 0 && start_y >= 0 && start_z >= 0) {
if (start_x >= 0 && start_y >= 0 && start_z >= 0)
{
LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
theUser.CurrentAgent.Position = tmp_v;
}
@ -203,7 +207,8 @@ namespace OpenSim.Grid.UserServer
{
//m_log.Info("[LOGIN]: Letting other objects know about login");
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y,
theUser.CurrentAgent.Position.Z,
theUser.FirstName, theUser.SurName);
}
}
@ -221,7 +226,7 @@ namespace OpenSim.Grid.UserServer
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong) m_config.DefaultY * Constants.RegionSize);
m_log.Warn(
"[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString());
"[LOGIN]: Home region not available: sending to default " + defaultHandle);
try
{
@ -231,19 +236,19 @@ namespace OpenSim.Grid.UserServer
// Customise the response
m_log.Info("[LOGIN]: Home Location");
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
"'position':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}";
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
(SimInfo.regionLocY * Constants.RegionSize) + "], " +
"'position':[r" + theUser.HomeLocation.X + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
"'look_at':[r" + theUser.HomeLocation.X + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
// Destination
m_log.Info("[LOGIN]: " +
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString();
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY;
@ -283,7 +288,8 @@ namespace OpenSim.Grid.UserServer
{
m_log.Info("[LOGIN]: Letting other objects know about login");
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y,
theUser.CurrentAgent.Position.Z,
theUser.FirstName, theUser.SurName);
}
}
@ -291,7 +297,7 @@ namespace OpenSim.Grid.UserServer
catch (Exception e)
{
m_log.Warn("[LOGIN]: Default region also not available");
m_log.Warn("[LOGIN]: " + e.ToString());
m_log.Warn("[LOGIN]: " + e);
}
}
}

View File

@ -44,8 +44,8 @@ namespace OpenSim.Grid.UserServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private logOffUser handlerLogOffUser;
public event logOffUser OnLogOffUser;
private logOffUser handlerLogOffUser = null;
/// <summary>
/// Deletes an active agent session
@ -81,14 +81,14 @@ namespace OpenSim.Grid.UserServer
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
// Query Result Information
responseData["queryid"] = (string) queryID.ToString();
responseData["avcount"] = (string) returnUsers.Count.ToString();
responseData["queryid"] = queryID.ToString();
responseData["avcount"] = returnUsers.Count.ToString();
for (int i = 0; i < returnUsers.Count; i++)
{
responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString();
responseData["firstname" + i.ToString()] = returnUsers[i].firstName;
responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
responseData["firstname" + i] = returnUsers[i].firstName;
responseData["lastname" + i] = returnUsers[i].lastName;
}
response.Value = responseData;
@ -101,14 +101,14 @@ namespace OpenSim.Grid.UserServer
Hashtable responseData = new Hashtable();
// Query Result Information
responseData["avcount"] = (string)returnUsers.Count.ToString();
responseData["avcount"] = returnUsers.Count.ToString();
for (int i = 0; i < returnUsers.Count; i++)
{
responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString();
responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString();
responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
}
response.Value = responseData;
@ -156,6 +156,21 @@ namespace OpenSim.Grid.UserServer
return response;
}
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(LLUUID uuid)
{
throw new Exception("The method or operation is not implemented.");
}
#region XMLRPC User Methods
public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
@ -186,7 +201,8 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
{
// UserManagerBase.AddNewuserFriend
AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
AddNewUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]),
(uint) Convert.ToInt32((string) requestData["friendPerms"]));
returnString = "TRUE";
}
responseData["returnString"] = returnString;
@ -222,7 +238,8 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
{
UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]),
(uint) Convert.ToInt32((string) requestData["friendPerms"]));
// UserManagerBase.
returnString = "TRUE";
}
@ -241,7 +258,7 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("ownerID"))
{
returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
}
return FriendListItemListtoXmlRPCResponse(returndata);
@ -382,7 +399,6 @@ namespace OpenSim.Grid.UserServer
{
m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
}
}
if (requestData.Contains("home_pos_x"))
{
@ -394,7 +410,6 @@ namespace OpenSim.Grid.UserServer
{
m_log.Error("[PROFILE]:Failed to set home postion x");
}
}
if (requestData.Contains("home_pos_y"))
{
@ -495,20 +510,5 @@ namespace OpenSim.Grid.UserServer
}
#endregion
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(LLUUID uuid)
{
throw new Exception("The method or operation is not implemented.");
}
}
}

View File

@ -52,12 +52,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class LoadBalancerPlugin : IApplicationPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly object padlock = new object();
private BaseHttpServer commandServer;
private bool[] isLocalNeighbour;
private bool isSplit = false;
private bool isSplit;
private TcpServer mTcpServer;
private object padlock = new object();
private int proxyOffset;
private string proxyURL;
@ -80,8 +80,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
if (proxyURL.Length == 0) return;
StartTcpServer();
ClientView.SynchronizeClient = new ClientView.SynchronizeClientHandler(SynchronizePackets);
AsynchronousSocketListener.PacketHandler = new AsynchronousSocketListener.PacketRecieveHandler(SynchronizePacketRecieve);
ClientView.SynchronizeClient = SynchronizePackets;
AsynchronousSocketListener.PacketHandler = SynchronizePacketRecieve;
sceneManager = openSim.SceneManager;
udpServers = openSim.UdpServers;
@ -146,7 +146,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{
ClientView client = (ClientView) pre.ControllingClient;
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
if (client.PacketProcessingEnabled == true)
if (client.PacketProcessingEnabled)
{
get_scene_presence_filter++;
}
@ -159,7 +159,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{
ClientView client = (ClientView) pre.ControllingClient;
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
if (client.PacketProcessingEnabled == true)
if (client.PacketProcessingEnabled)
{
get_avatar_filter++;
avatar_names += pre.Firstname + " " + pre.Lastname + "; ";
@ -178,7 +178,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
}
return response;
@ -199,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
}
@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
}
@ -247,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
throw e;
}
@ -264,14 +264,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
int src_port = (int) request.Params[0];
// backgroud
WaitCallback callback = new WaitCallback(TerminateRegion);
WaitCallback callback = TerminateRegion;
ThreadPool.QueueUserWorkItem(callback, src_port);
m_log.Info("[BALANCER] " + "Exiting TerminateRegion()");
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
}
@ -330,8 +330,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
dst_region = DeserializeRegion(dst_port, false, serializeDir);
// Decide who is in charge for each section
int[] port = new int[] {src_port, dst_port};
string[] url = new string[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port};
int[] port = new[] {src_port, dst_port};
string[] url = new[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port};
for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]);
// Enable the proxy
@ -424,7 +424,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// serialization of region data
SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region);
filename = export_dir + "RegionInfo_" + src_region.RegionID.ToString() + ".bin";
filename = export_dir + "RegionInfo_" + src_region.RegionID + ".bin";
Util.SerializeToFile(filename, dst_region);
// backup current scene's entities
@ -451,7 +451,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{
ClientInfo info = controller.GetClientInfo();
filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode.ToString() + ".bin";
filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode + ".bin";
Util.SerializeToFile(filename, info);
@ -469,13 +469,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir)
{
string[] files = null;
RegionInfo dst_region = null;
try
{
// deserialization of region data
files = Directory.GetFiles(import_dir, "RegionInfo_*.bin");
string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin");
foreach (string filename in files)
{
@ -503,7 +502,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
throw e;
}
@ -593,7 +592,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// change RegionInfo (memory only)
dst_region.InternalEndPoint.Port = dst_port;
dst_region.ExternalHostName = proxyURL.Split(new char[] {'/', ':'})[3];
dst_region.ExternalHostName = proxyURL.Split(new[] {'/', ':'})[3];
// Create new region
simMain.CreateRegion(dst_region, false);
@ -695,7 +694,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
for (int i = 0; i < numRegions; i++)
{
hostname = sceneURL[i].Split(new char[] {'/', ':'})[3];
hostname = sceneURL[i].Split(new[] {'/', ':'})[3];
m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname);
tcpClientList[i] = new TcpClient(hostname, 10001);
}
@ -731,12 +730,11 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
List<uint> circuits = scene.ClientManager.GetAllCircuitCodes();
circuits.Sort();
IClientAPI controller = null;
foreach (uint code in circuits)
{
m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code);
IClientAPI controller;
if (scene.ClientManager.TryGetClient(code, out controller))
{
// Divide the presences evenly over the set of subscenes
@ -756,7 +754,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
scene.splitID = myID;
scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes);
scene.SynchronizeScene = SynchronizeScenes;
isSplit = true;
}
else
@ -766,7 +764,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[SPLITSCENE] " + e.ToString());
m_log.Error("[SPLITSCENE] " + e);
m_log.Error("[SPLITSCENE] " + e.StackTrace);
}
@ -820,7 +818,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e);
m_log.Error("[BALANCER] " + e.StackTrace);
throw e;
}
@ -893,7 +891,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// Because data changes by the physics simulation when the client doesn't move,
// if MovementFlag is false, It is necessary to synchronize.
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true)
if (client.PacketProcessingEnabled == true)
if (client.PacketProcessingEnabled)
{
//m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition));
@ -1016,7 +1014,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
return;
}
if (((ClientView) pre.ControllingClient).PacketProcessingEnabled == true)
if (((ClientView) pre.ControllingClient).PacketProcessingEnabled)
{
pre.ControllingClient.OutPacket(packet, throttlePacketType);
}
@ -1060,7 +1058,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
catch (Exception e)
{
m_log.Error("[SPLITSCENE] " + e.ToString());
m_log.Error("[SPLITSCENE] " + e);
m_log.Error("[SPLITSCENE] " + e.StackTrace);
}
@ -1072,7 +1070,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
LLUUID scenePresenceID = new LLUUID(header.agent_id);
LLVector3 position = new LLVector3(buff, 0);
LLVector3 velocity = new LLVector3(buff, 12);
bool flying = ((buff[24] == (byte) 1) ? true : false);
bool flying = ((buff[24] == 1) ? true : false);
LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying);

View File

@ -34,8 +34,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{
public class AsynchronousClient
{
private static ManualResetEvent connectDone = new ManualResetEvent(false);
private static ManualResetEvent sendDone = new ManualResetEvent(false);
private static readonly ManualResetEvent connectDone = new ManualResetEvent(false);
private static readonly ManualResetEvent sendDone = new ManualResetEvent(false);
public static Socket StartClient(string hostname, int port)
{
@ -46,7 +46,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client);
client.BeginConnect(remoteEP, ConnectCallback, client);
connectDone.WaitOne();
/*
Send(client,"This is a test<EOF>");
@ -71,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{
Socket client = (Socket) ar.AsyncState;
client.EndConnect(ar);
Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString());
Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint);
connectDone.Set();
}
catch (Exception e)
@ -138,8 +138,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class InternalPacketHeader
{
private readonly byte[] buffer = new byte[32];
public Guid agent_id;
private byte[] buffer = new byte[32];
public int numbytes;
public int region_port;
public int throttlePacketType;
@ -150,16 +150,16 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
int i = 0; // offset
try
{
type = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
throttlePacketType = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
numbytes = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
type = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
throttlePacketType = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
numbytes = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
agent_id = new Guid(
bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24,
(short) (bytes[i++] | (bytes[i++] << 8)),
(short) (bytes[i++] | (bytes[i++] << 8)),
bytes[i++], bytes[i++], bytes[i++], bytes[i++],
bytes[i++], bytes[i++], bytes[i++], bytes[i++]);
region_port = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
region_port = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
}
catch (Exception)
{
@ -201,10 +201,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class TcpClient
{
public static int internalPacketHeaderSize = 4 * 4 + 16 * 1;
private Socket mConnection;
private string mHostname;
private int mPort;
private readonly string mHostname;
private readonly int mPort;
private Socket mConnection;
public TcpClient(string hostname, int port)
{

View File

@ -37,15 +37,15 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{
public const int BufferSize = 2048;
public byte[] buffer = new byte[BufferSize];
public InternalPacketHeader header = null;
public InternalPacketHeader header;
public MemoryStream ms_ptr = new MemoryStream();
public Socket workSocket = null;
public Socket workSocket;
}
public class AsynchronousSocketListener
{
public static ManualResetEvent allDone = new ManualResetEvent(false);
public static string data = null;
public static string data;
#region KIRYU
@ -55,14 +55,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
#endregion
public static PacketRecieveHandler PacketHandler = null;
public static PacketRecieveHandler PacketHandler;
#endregion
public AsynchronousSocketListener()
{
}
public static void StartListening(int port)
{
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
@ -199,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class TcpServer
{
private int mPort = 11000;
private readonly int mPort = 11000;
public TcpServer()
{

View File

@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", "");
if (proxyURL.Length == 0) return;
uint port = (uint) Int32.Parse(proxyURL.Split(new char[] {':'})[2]);
uint port = (uint) Int32.Parse(proxyURL.Split(new[] {':'})[2]);
command_server = new BaseHttpServer(port);
command_server.Start();
command_server.AddXmlRPCHandler("AddPort", AddPort);
@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
{
m_log = log;
running = false;
receivedData = new AsyncCallback(OnReceivedData);
receivedData = OnReceivedData;
}
public void BlockClientMessages(string regionUrl, int regionPort)
@ -452,7 +452,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
protected class ProxyMap
{
private Dictionary<EndPoint, RegionData> map;
private readonly Dictionary<EndPoint, RegionData> map;
public ProxyMap()
{
@ -494,7 +494,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
public class RegionData
{
public bool isBlocked = false;
public bool isBlocked;
public List<EndPoint> regions = new List<EndPoint>();
public Queue storedMessages = new Queue();
}