* Cleaning code still.
parent
c803e0cca1
commit
fc6c4dc399
|
@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
|
|
||||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
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);
|
openSim.CreateRegion(regionsToLoad[i], true);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
if (regionhandle == regionsToLoad[i].RegionHandle)
|
if (regionhandle == regionsToLoad[i].RegionHandle)
|
||||||
{
|
{
|
||||||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||||
Thread.CurrentThread.ManagedThreadId.ToString() + ")");
|
Thread.CurrentThread.ManagedThreadId + ")");
|
||||||
openSim.CreateRegion(regionsToLoad[i], true);
|
openSim.CreateRegion(regionsToLoad[i], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
private BaseHttpServer m_httpd;
|
private BaseHttpServer m_httpd;
|
||||||
private string requiredPassword = String.Empty;
|
private string requiredPassword = String.Empty;
|
||||||
|
|
||||||
|
#region IApplicationPlugin Members
|
||||||
|
|
||||||
public void Initialise(OpenSimMain openSim)
|
public void Initialise(OpenSimMain openSim)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (openSim.ConfigSource.Configs["RemoteAdmin"] != null &&
|
if (openSim.ConfigSource.Configs["RemoteAdmin"] != null &&
|
||||||
openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
|
openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
|
||||||
{
|
{
|
||||||
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
|
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
|
||||||
|
@ -82,6 +84,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
@ -90,13 +98,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Request to restart Region.");
|
m_log.Info("[RADMIN]: Request to restart Region.");
|
||||||
try {
|
try
|
||||||
checkStringParameters(request, new string[] { "password", "regionID" });
|
{
|
||||||
|
checkStringParameters(request, new[] {"password", "regionID"});
|
||||||
|
|
||||||
if (requiredPassword != String.Empty &&
|
if (requiredPassword != String.Empty &&
|
||||||
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
||||||
throw new Exception("wrong password");
|
throw new Exception("wrong password");
|
||||||
|
|
||||||
LLUUID regionID = new LLUUID((string) requestData["regionID"]);
|
LLUUID regionID = new LLUUID((string) requestData["regionID"]);
|
||||||
|
|
||||||
responseData["accepted"] = "true";
|
responseData["accepted"] = "true";
|
||||||
|
@ -106,11 +115,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
|
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
|
||||||
throw new Exception("region not found");
|
throw new Exception("region not found");
|
||||||
|
|
||||||
responseData["rebooting"] = "true";
|
responseData["rebooting"] = "true";
|
||||||
rebootedScene.Restart(30);
|
rebootedScene.Restart(30);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
|
||||||
|
@ -130,13 +139,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
try {
|
try
|
||||||
checkStringParameters(request, new string[] { "password", "message" });
|
{
|
||||||
|
checkStringParameters(request, new[] {"password", "message"});
|
||||||
|
|
||||||
if (requiredPassword != String.Empty &&
|
if (requiredPassword != String.Empty &&
|
||||||
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
||||||
throw new Exception("wrong password");
|
throw new Exception("wrong password");
|
||||||
|
|
||||||
string message = (string) requestData["message"];
|
string message = (string) requestData["message"];
|
||||||
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
|
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
|
||||||
|
|
||||||
|
@ -145,7 +155,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
m_app.SceneManager.SendGeneralMessage(message);
|
m_app.SceneManager.SendGeneralMessage(message);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
||||||
|
@ -162,24 +172,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
|
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
|
||||||
foreach (string k in requestData.Keys)
|
foreach (string k in requestData.Keys)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
|
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();
|
Hashtable responseData = new Hashtable();
|
||||||
try {
|
try
|
||||||
checkStringParameters(request, new string[] { "password", "filename", "regionid"});
|
{
|
||||||
|
checkStringParameters(request, new[] {"password", "filename", "regionid"});
|
||||||
|
|
||||||
if (requiredPassword != String.Empty &&
|
if (requiredPassword != String.Empty &&
|
||||||
(!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
|
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
||||||
throw new Exception("wrong password");
|
throw new Exception("wrong password");
|
||||||
|
|
||||||
string file = (string)requestData["filename"];
|
string file = (string) requestData["filename"];
|
||||||
LLUUID regionID = (string) requestData["regionid"];
|
LLUUID regionID = (string) requestData["regionid"];
|
||||||
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
|
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
|
||||||
|
|
||||||
|
@ -198,7 +209,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString());
|
||||||
|
@ -217,7 +228,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
if (requiredPassword != String.Empty &&
|
if (requiredPassword != String.Empty &&
|
||||||
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
||||||
throw new Exception("wrong password");
|
throw new Exception("wrong password");
|
||||||
|
@ -227,14 +239,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
int timeout = 2000;
|
int timeout = 2000;
|
||||||
|
|
||||||
if (requestData.ContainsKey("shutdown") &&
|
if (requestData.ContainsKey("shutdown") &&
|
||||||
((string) requestData["shutdown"] == "delayed") &&
|
((string) requestData["shutdown"] == "delayed") &&
|
||||||
requestData.ContainsKey("milliseconds"))
|
requestData.ContainsKey("milliseconds"))
|
||||||
{
|
{
|
||||||
timeout = (Int32) requestData["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.");
|
" second(s). Please save what you are doing and log out.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_app.SceneManager.SendGeneralMessage("Region is going down now.");
|
m_app.SceneManager.SendGeneralMessage("Region is going down now.");
|
||||||
|
@ -243,12 +255,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
// Perform shutdown
|
// Perform shutdown
|
||||||
Timer shutdownTimer = new Timer(timeout); // Wait before firing
|
Timer shutdownTimer = new Timer(timeout); // Wait before firing
|
||||||
shutdownTimer.AutoReset = false;
|
shutdownTimer.AutoReset = false;
|
||||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
shutdownTimer.Elapsed += shutdownTimer_Elapsed;
|
||||||
shutdownTimer.Start();
|
shutdownTimer.Start();
|
||||||
|
|
||||||
responseData["success"] = "true";
|
responseData["success"] = "true";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
|
||||||
|
@ -272,9 +284,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
foreach (string p in param)
|
foreach (string p in param)
|
||||||
{
|
{
|
||||||
if (!requestData.Contains(p))
|
if (!requestData.Contains(p))
|
||||||
throw new Exception(String.Format("missing string parameter {0}", p));
|
throw new Exception(String.Format("missing string parameter {0}", p));
|
||||||
if (String.IsNullOrEmpty((string)requestData[p]))
|
if (String.IsNullOrEmpty((string) requestData[p]))
|
||||||
throw new Exception(String.Format("parameter {0} is empty", p));
|
throw new Exception(String.Format("parameter {0} is empty", p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,7 +296,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
foreach (string p in param)
|
foreach (string p in param)
|
||||||
{
|
{
|
||||||
if (!requestData.Contains(p))
|
if (!requestData.Contains(p))
|
||||||
throw new Exception(String.Format("missing integer parameter {0}", p));
|
throw new Exception(String.Format("missing integer parameter {0}", p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,31 +357,35 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
try {
|
try
|
||||||
checkStringParameters(request, new string[] { "password",
|
{
|
||||||
"region_name",
|
checkStringParameters(request, new[]
|
||||||
"region_master_first", "region_master_last",
|
{
|
||||||
"region_master_password",
|
"password",
|
||||||
"listen_ip", "external_address"});
|
"region_name",
|
||||||
checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"});
|
"region_master_first", "region_master_last",
|
||||||
|
"region_master_password",
|
||||||
|
"listen_ip", "external_address"
|
||||||
|
});
|
||||||
|
checkIntegerParams(request, new[] {"region_x", "region_y", "listen_port"});
|
||||||
|
|
||||||
// check password
|
// check password
|
||||||
if (!String.IsNullOrEmpty(requiredPassword) &&
|
if (!String.IsNullOrEmpty(requiredPassword) &&
|
||||||
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
||||||
|
|
||||||
// extract or generate region ID now
|
// extract or generate region ID now
|
||||||
Scene scene = null;
|
Scene scene = null;
|
||||||
LLUUID regionID = LLUUID.Zero;
|
LLUUID regionID = LLUUID.Zero;
|
||||||
if (requestData.ContainsKey("region_id") &&
|
if (requestData.ContainsKey("region_id") &&
|
||||||
!String.IsNullOrEmpty((string)requestData["region_id"]))
|
!String.IsNullOrEmpty((string) requestData["region_id"]))
|
||||||
{
|
{
|
||||||
regionID = (string) requestData["region_id"];
|
regionID = (string) requestData["region_id"];
|
||||||
if (m_app.SceneManager.TryGetScene(regionID, out scene))
|
if (m_app.SceneManager.TryGetScene(regionID, out scene))
|
||||||
throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
|
throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
|
||||||
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
||||||
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
regionID = LLUUID.Random();
|
regionID = LLUUID.Random();
|
||||||
m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID);
|
m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID);
|
||||||
|
@ -385,7 +401,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
// check for collisions: region name, region UUID,
|
// check for collisions: region name, region UUID,
|
||||||
// region location
|
// region location
|
||||||
if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
|
if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
|
||||||
throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
|
throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
|
||||||
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
||||||
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
||||||
|
@ -395,46 +411,46 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
region.RegionLocX, region.RegionLocY,
|
region.RegionLocX, region.RegionLocY,
|
||||||
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
||||||
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
||||||
|
|
||||||
// Security risk [and apparently not used]
|
// Security risk [and apparently not used]
|
||||||
// if (requestData.ContainsKey("datastore"))
|
// if (requestData.ContainsKey("datastore"))
|
||||||
// region.DataStore = (string) requestData["datastore"];
|
// region.DataStore = (string) requestData["datastore"];
|
||||||
|
|
||||||
region.InternalEndPoint =
|
region.InternalEndPoint =
|
||||||
new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0);
|
new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0);
|
||||||
|
|
||||||
region.InternalEndPoint.Port = (Int32) requestData["listen_port"];
|
region.InternalEndPoint.Port = (Int32) requestData["listen_port"];
|
||||||
if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
|
if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
|
||||||
if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
|
if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
|
||||||
throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
|
throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
|
||||||
region.InternalEndPoint.Address,
|
region.InternalEndPoint.Address,
|
||||||
region.InternalEndPoint.Port,
|
region.InternalEndPoint.Port,
|
||||||
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
||||||
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
||||||
|
|
||||||
|
|
||||||
region.ExternalHostName = (string) requestData["external_address"];
|
region.ExternalHostName = (string) requestData["external_address"];
|
||||||
|
|
||||||
region.MasterAvatarFirstName = (string) requestData["region_master_first"];
|
region.MasterAvatarFirstName = (string) requestData["region_master_first"];
|
||||||
region.MasterAvatarLastName = (string) requestData["region_master_last"];
|
region.MasterAvatarLastName = (string) requestData["region_master_last"];
|
||||||
region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"];
|
region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"];
|
||||||
|
|
||||||
bool persist = Convert.ToBoolean((string)requestData["persist"]);
|
bool persist = Convert.ToBoolean((string) requestData["persist"]);
|
||||||
if (persist)
|
if (persist)
|
||||||
{
|
{
|
||||||
string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
|
string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
|
||||||
String.Format("{0}x{1}-{2}.xml",
|
String.Format("{0}x{1}-{2}.xml",
|
||||||
region.RegionLocX.ToString(),
|
region.RegionLocX,
|
||||||
region.RegionLocY.ToString(),
|
region.RegionLocY,
|
||||||
regionID.ToString()));
|
regionID));
|
||||||
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
|
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
|
||||||
region.RegionID, regionConfigPath);
|
region.RegionID, regionConfigPath);
|
||||||
region.SaveRegionToFile("dynamic region", regionConfigPath);
|
region.SaveRegionToFile("dynamic region", regionConfigPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_app.CreateRegion(region);
|
m_app.CreateRegion(region);
|
||||||
|
|
||||||
responseData["success"] = "true";
|
responseData["success"] = "true";
|
||||||
responseData["region_name"] = region.RegionName;
|
responseData["region_name"] = region.RegionName;
|
||||||
responseData["region_uuid"] = region.RegionID.ToString();
|
responseData["region_uuid"] = region.RegionID.ToString();
|
||||||
|
|
||||||
|
@ -497,48 +513,52 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// check completeness
|
// check completeness
|
||||||
checkStringParameters(request, new string[] { "password", "user_firstname",
|
checkStringParameters(request, new[]
|
||||||
"user_lastname", "user_password" });
|
{
|
||||||
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
|
"password", "user_firstname",
|
||||||
|
"user_lastname", "user_password"
|
||||||
|
});
|
||||||
|
checkIntegerParams(request, new[] {"start_region_x", "start_region_y"});
|
||||||
|
|
||||||
// check password
|
// check password
|
||||||
if (!String.IsNullOrEmpty(requiredPassword) &&
|
if (!String.IsNullOrEmpty(requiredPassword) &&
|
||||||
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
||||||
|
|
||||||
// do the job
|
// do the job
|
||||||
string firstname = (string) requestData["user_firstname"];
|
string firstname = (string) requestData["user_firstname"];
|
||||||
string lastname = (string) requestData["user_lastname"];
|
string lastname = (string) requestData["user_lastname"];
|
||||||
string passwd = (string) requestData["user_password"];
|
string passwd = (string) requestData["user_password"];
|
||||||
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
|
uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
|
||||||
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
|
uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
|
||||||
|
|
||||||
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
||||||
if (null != userProfile)
|
if (null != userProfile)
|
||||||
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
|
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
|
||||||
|
|
||||||
LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY);
|
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)
|
||||||
firstname, lastname));
|
throw new Exception(String.Format("failed to create new user {0} {1}",
|
||||||
|
firstname, lastname));
|
||||||
responseData["success"] = "true";
|
|
||||||
|
responseData["success"] = "true";
|
||||||
responseData["avatar_uuid"] = userID.ToString();
|
responseData["avatar_uuid"] = userID.ToString();
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
|
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
|
||||||
|
|
||||||
responseData["success"] = "false";
|
responseData["success"] = "false";
|
||||||
responseData["avatar_uuid"] = LLUUID.Zero.ToString();
|
responseData["avatar_uuid"] = LLUUID.Zero.ToString();
|
||||||
responseData["error"] = e.Message;
|
responseData["error"] = e.Message;
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
|
@ -553,33 +573,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// check completeness
|
// check completeness
|
||||||
foreach (string p in new string[] { "password", "filename" })
|
foreach (string p in new[] {"password", "filename"})
|
||||||
{
|
{
|
||||||
if (!requestData.Contains(p))
|
if (!requestData.Contains(p))
|
||||||
throw new Exception(String.Format("missing parameter {0}", p));
|
throw new Exception(String.Format("missing parameter {0}", p));
|
||||||
if (String.IsNullOrEmpty((string)requestData[p]))
|
if (String.IsNullOrEmpty((string) requestData[p]))
|
||||||
throw new Exception(String.Format("parameter {0} is empty"));
|
throw new Exception(String.Format("parameter {0} is empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// check password
|
// check password
|
||||||
if (!String.IsNullOrEmpty(requiredPassword) &&
|
if (!String.IsNullOrEmpty(requiredPassword) &&
|
||||||
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
||||||
|
|
||||||
string filename = (string)requestData["filename"];
|
string filename = (string) requestData["filename"];
|
||||||
if (requestData.Contains("region_uuid"))
|
if (requestData.Contains("region_uuid"))
|
||||||
{
|
{
|
||||||
LLUUID region_uuid = (string)requestData["region_uuid"];
|
LLUUID region_uuid = (string) requestData["region_uuid"];
|
||||||
if (!m_app.SceneManager.TrySetCurrentScene(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());
|
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||||
}
|
}
|
||||||
else if (requestData.Contains("region_name"))
|
else if (requestData.Contains("region_name"))
|
||||||
{
|
{
|
||||||
string region_name = (string)requestData["region_name"];
|
string region_name = (string) requestData["region_name"];
|
||||||
if (!m_app.SceneManager.TrySetCurrentScene(region_name))
|
if (!m_app.SceneManager.TrySetCurrentScene(region_name))
|
||||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||||
}
|
}
|
||||||
|
@ -588,27 +608,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
responseData["switched"] = "true";
|
responseData["switched"] = "true";
|
||||||
|
|
||||||
m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0));
|
m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0));
|
||||||
responseData["loaded"] = "true";
|
responseData["loaded"] = "true";
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message);
|
m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
|
||||||
|
|
||||||
responseData["loaded"] = "false";
|
responseData["loaded"] = "false";
|
||||||
responseData["switched"] = "false";
|
responseData["switched"] = "false";
|
||||||
responseData["error"] = e.Message;
|
responseData["error"] = e.Message;
|
||||||
|
|
||||||
response.Value = responseData;
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
response.Value = responseData;
|
||||||
{
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -70,7 +70,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
|
|
||||||
override public AssetBase FetchAsset(LLUUID assetID)
|
override public AssetBase FetchAsset(LLUUID assetID)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
AssetBase asset;
|
||||||
|
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
param["id"] = assetID.ToString();
|
param["id"] = assetID.ToString();
|
||||||
|
|
|
@ -46,14 +46,48 @@ namespace OpenSim.Grid.AssetServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
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 AssetConfig m_config;
|
||||||
|
|
||||||
public static OpenAsset_Main assetserver;
|
public OpenAsset_Main()
|
||||||
|
{
|
||||||
// Temporarily hardcoded - should be a plugin
|
m_console = new ConsoleBase("OpenAsset", this);
|
||||||
protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
|
|
||||||
|
MainConsole.Instance = m_console;
|
||||||
private IAssetProvider m_assetProvider;
|
}
|
||||||
|
|
||||||
|
#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]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
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()
|
public void Startup()
|
||||||
{
|
{
|
||||||
m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
|
m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
|
||||||
|
@ -160,42 +187,18 @@ namespace OpenSim.Grid.AssetServer
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[ASSET]: setupDB() - Exception occured");
|
m_log.Warn("[ASSET]: setupDB() - Exception occured");
|
||||||
m_log.Warn("[ASSET]: " + e.ToString());
|
m_log.Warn("[ASSET]: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadDefaultAssets()
|
public void LoadDefaultAssets()
|
||||||
{
|
{
|
||||||
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void StoreAsset(AssetBase asset)
|
protected void StoreAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
m_assetProvider.CreateAsset(asset);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
|
||||||
//
|
//
|
||||||
|
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
|
@ -43,8 +43,8 @@ namespace OpenSim.Grid.AssetServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private readonly IAssetProvider m_assetProvider;
|
||||||
private OpenAsset_Main m_assetManager;
|
private OpenAsset_Main m_assetManager;
|
||||||
private IAssetProvider m_assetProvider;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
|
@ -58,28 +58,28 @@ namespace OpenSim.Grid.AssetServer
|
||||||
m_assetManager = assetManager;
|
m_assetManager = assetManager;
|
||||||
m_assetProvider = assetProvider;
|
m_assetProvider = assetProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte[] Handle(string path, Stream request)
|
public override byte[] Handle(string path, Stream request)
|
||||||
{
|
{
|
||||||
string param = GetParam(path);
|
string param = GetParam(path);
|
||||||
byte[] result = new byte[] {};
|
byte[] result = new byte[] {};
|
||||||
|
|
||||||
string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
|
string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
if (p.Length > 0)
|
if (p.Length > 0)
|
||||||
{
|
{
|
||||||
LLUUID assetID = null;
|
LLUUID assetID = null;
|
||||||
|
|
||||||
if (!LLUUID.TryParse(p[0], out assetID))
|
if (!LLUUID.TryParse(p[0], out assetID))
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
|
"[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StatsManager.AssetStats != null)
|
if (StatsManager.AssetStats != null)
|
||||||
StatsManager.AssetStats.AddRequest();
|
StatsManager.AssetStats.AddRequest();
|
||||||
|
|
||||||
AssetBase asset = m_assetProvider.FetchAsset(assetID);
|
AssetBase asset = m_assetProvider.FetchAsset(assetID);
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
|
@ -94,32 +94,39 @@ namespace OpenSim.Grid.AssetServer
|
||||||
//StreamReader sr = new StreamReader(ms);
|
//StreamReader sr = new StreamReader(ms);
|
||||||
|
|
||||||
result = ms.GetBuffer();
|
result = ms.GetBuffer();
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[REST]: GET:/asset found {0} with name {1}, size {2} bytes",
|
"[REST]: GET:/asset found {0} with name {1}, size {2} bytes",
|
||||||
assetID, asset.Name, result.Length);
|
assetID, asset.Name, result.Length);
|
||||||
|
|
||||||
Array.Resize<byte>(ref result, (int) ms.Length);
|
Array.Resize(ref result, (int) ms.Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (StatsManager.AssetStats != null)
|
if (StatsManager.AssetStats != null)
|
||||||
StatsManager.AssetStats.AddNotFoundRequest();
|
StatsManager.AssetStats.AddNotFoundRequest();
|
||||||
|
|
||||||
m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID);
|
m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PostAssetStreamHandler : BaseStreamHandler
|
public class PostAssetStreamHandler : BaseStreamHandler
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private readonly IAssetProvider m_assetProvider;
|
||||||
private OpenAsset_Main m_assetManager;
|
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)
|
public override byte[] Handle(string path, Stream request)
|
||||||
{
|
{
|
||||||
|
@ -139,12 +146,5 @@ namespace OpenSim.Grid.AssetServer
|
||||||
|
|
||||||
return new byte[] {};
|
return new byte[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
|
|
||||||
: base("POST", "/assets")
|
|
||||||
{
|
|
||||||
m_assetManager = assetManager;
|
|
||||||
m_assetProvider = assetProvider;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,11 +44,11 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
|
private readonly Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
|
||||||
private 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
|
// 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;
|
public GridConfig Config;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
if (typeInterface != null)
|
if (typeInterface != null)
|
||||||
{
|
{
|
||||||
IGridData plug =
|
IGridData plug =
|
||||||
(IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Initialise();
|
plug.Initialise();
|
||||||
_plugins.Add(plug.getName(), plug);
|
_plugins.Add(plug.getName(), plug);
|
||||||
m_log.Info("[DATA]: Added IGridData Interface");
|
m_log.Info("[DATA]: Added IGridData Interface");
|
||||||
|
@ -84,7 +84,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
if (typeInterface != null)
|
if (typeInterface != null)
|
||||||
{
|
{
|
||||||
ILogData plug =
|
ILogData plug =
|
||||||
(ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Initialise();
|
plug.Initialise();
|
||||||
_logplugins.Add(plug.getName(), plug);
|
_logplugins.Add(plug.getName(), plug);
|
||||||
m_log.Info("[DATA]: Added ILogData Interface");
|
m_log.Info("[DATA]: Added ILogData Interface");
|
||||||
|
@ -152,7 +152,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
catch
|
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;
|
return null;
|
||||||
|
@ -218,20 +218,20 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
GetRegion(
|
GetRegion(
|
||||||
Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
|
Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize),
|
||||||
(uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null)
|
(uint) (central_region.regionLocY + y) * Constants.RegionSize)) != null)
|
||||||
{
|
{
|
||||||
neighbour =
|
neighbour =
|
||||||
GetRegion(
|
GetRegion(
|
||||||
Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
|
Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize),
|
||||||
(uint)(central_region.regionLocY + y) * Constants.RegionSize));
|
(uint) (central_region.regionLocY + y) * Constants.RegionSize));
|
||||||
|
|
||||||
response += "<neighbour>";
|
response += "<neighbour>";
|
||||||
response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
|
response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
|
||||||
response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
|
response += "<sim_port>" + neighbour.serverPort + "</sim_port>";
|
||||||
response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
|
response += "<locx>" + neighbour.regionLocX + "</locx>";
|
||||||
response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
|
response += "<locy>" + neighbour.regionLocY + "</locy>";
|
||||||
response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
|
response += "<regionhandle>" + neighbour.regionHandle + "</regionhandle>";
|
||||||
response += "</neighbour>";
|
response += "</neighbour>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,10 +287,10 @@ namespace OpenSim.Grid.GridServer
|
||||||
RegionProfileData sim;
|
RegionProfileData sim;
|
||||||
RegionProfileData existingSim;
|
RegionProfileData existingSim;
|
||||||
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
LLUUID uuid;
|
LLUUID uuid;
|
||||||
|
|
||||||
if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string)requestData["UUID"], out uuid))
|
if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string) requestData["UUID"], out uuid))
|
||||||
{
|
{
|
||||||
m_log.Info("[GRID]: Region connected without a UUID, ignoring.");
|
m_log.Info("[GRID]: Region connected without a UUID, ignoring.");
|
||||||
return ErrorResponse("No UUID passed to grid server - unable to connect you");
|
return ErrorResponse("No UUID passed to grid server - unable to connect you");
|
||||||
|
@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
catch (FormatException e)
|
catch (FormatException e)
|
||||||
{
|
{
|
||||||
m_log.Info("[GRID]: Invalid login parameters, ignoring.");
|
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);
|
existingSim = GetRegion(sim.regionHandle);
|
||||||
|
@ -329,7 +329,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
DataResponse insertResponse;
|
DataResponse insertResponse;
|
||||||
|
|
||||||
if( existingSim == null )
|
if (existingSim == null)
|
||||||
{
|
{
|
||||||
insertResponse = kvp.Value.AddProfile(sim);
|
insertResponse = kvp.Value.AddProfile(sim);
|
||||||
}
|
}
|
||||||
|
@ -348,20 +348,20 @@ namespace OpenSim.Grid.GridServer
|
||||||
break;
|
break;
|
||||||
case DataResponse.RESPONSE_INVALIDCREDENTIALS:
|
case DataResponse.RESPONSE_INVALIDCREDENTIALS:
|
||||||
m_log.Warn("[storage]: " +
|
m_log.Warn("[storage]: " +
|
||||||
"New sim creation failed (Invalid Credentials): " + sim.regionName);
|
"New sim creation failed (Invalid Credentials): " + sim.regionName);
|
||||||
break;
|
break;
|
||||||
case DataResponse.RESPONSE_AUTHREQUIRED:
|
case DataResponse.RESPONSE_AUTHREQUIRED:
|
||||||
m_log.Warn("[storage]: " +
|
m_log.Warn("[storage]: " +
|
||||||
"New sim creation failed (Authentication Required): " +
|
"New sim creation failed (Authentication Required): " +
|
||||||
sim.regionName);
|
sim.regionName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[storage]: " +
|
m_log.Warn("[storage]: " +
|
||||||
"Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key);
|
"Unable to add region " + sim.UUID + " via " + kvp.Key);
|
||||||
m_log.Warn("[storage]: " + e.ToString());
|
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 +
|
m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName +
|
||||||
" at location " + sim.regionLocX +
|
" 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -389,7 +390,8 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
else
|
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");
|
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)
|
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
|
||||||
{
|
{
|
||||||
NeighbourBlock = new Hashtable();
|
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["sim_port"] = aSim.Value.serverPort.ToString();
|
||||||
NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
|
NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
|
||||||
NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
|
NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
|
||||||
|
@ -485,13 +487,13 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
GetRegion(
|
GetRegion(
|
||||||
Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
|
Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize),
|
||||||
(uint)(sim.regionLocY + y) * Constants.RegionSize)) != null)
|
(uint) (sim.regionLocY + y) * Constants.RegionSize)) != null)
|
||||||
{
|
{
|
||||||
neighbour =
|
neighbour =
|
||||||
GetRegion(
|
GetRegion(
|
||||||
Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
|
Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize),
|
||||||
(uint)(sim.regionLocY + y) * Constants.RegionSize));
|
(uint) (sim.regionLocY + y) * Constants.RegionSize));
|
||||||
|
|
||||||
NeighbourBlock = new Hashtable();
|
NeighbourBlock = new Hashtable();
|
||||||
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
||||||
|
@ -519,27 +521,26 @@ namespace OpenSim.Grid.GridServer
|
||||||
RegionProfileData sim;
|
RegionProfileData sim;
|
||||||
sim = new RegionProfileData();
|
sim = new RegionProfileData();
|
||||||
|
|
||||||
sim.UUID = new LLUUID((string)requestData["UUID"]);
|
sim.UUID = new LLUUID((string) requestData["UUID"]);
|
||||||
sim.originUUID = new LLUUID((string)requestData["originUUID"]);
|
sim.originUUID = new LLUUID((string) requestData["originUUID"]);
|
||||||
|
|
||||||
sim.regionRecvKey = String.Empty;
|
sim.regionRecvKey = String.Empty;
|
||||||
sim.regionSendKey = String.Empty;
|
sim.regionSendKey = String.Empty;
|
||||||
|
|
||||||
if (requestData.ContainsKey("region_secret"))
|
if (requestData.ContainsKey("region_secret"))
|
||||||
{
|
{
|
||||||
string regionsecret = (string)requestData["region_secret"];
|
string regionsecret = (string) requestData["region_secret"];
|
||||||
if (regionsecret.Length > 0)
|
if (regionsecret.Length > 0)
|
||||||
sim.regionSecret = regionsecret;
|
sim.regionSecret = regionsecret;
|
||||||
else
|
else
|
||||||
sim.regionSecret = Config.SimRecvKey;
|
sim.regionSecret = Config.SimRecvKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sim.regionSecret = Config.SimRecvKey;
|
sim.regionSecret = Config.SimRecvKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sim.regionDataURI = String.Empty;
|
sim.regionDataURI = String.Empty;
|
||||||
sim.regionAssetURI = Config.DefaultAssetServer;
|
sim.regionAssetURI = Config.DefaultAssetServer;
|
||||||
sim.regionAssetRecvKey = Config.AssetRecvKey;
|
sim.regionAssetRecvKey = Config.AssetRecvKey;
|
||||||
|
@ -548,16 +549,16 @@ namespace OpenSim.Grid.GridServer
|
||||||
sim.regionUserSendKey = Config.UserSendKey;
|
sim.regionUserSendKey = Config.UserSendKey;
|
||||||
sim.regionUserRecvKey = Config.UserRecvKey;
|
sim.regionUserRecvKey = Config.UserRecvKey;
|
||||||
|
|
||||||
sim.serverIP = (string)requestData["sim_ip"];
|
sim.serverIP = (string) requestData["sim_ip"];
|
||||||
sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
|
sim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]);
|
||||||
sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
|
sim.httpPort = Convert.ToUInt32((string) requestData["http_port"]);
|
||||||
sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
|
sim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]);
|
||||||
sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
|
sim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]);
|
||||||
sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
|
sim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]);
|
||||||
sim.regionLocZ = 0;
|
sim.regionLocZ = 0;
|
||||||
|
|
||||||
LLUUID textureID;
|
LLUUID textureID;
|
||||||
if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID))
|
if (LLUUID.TryParse((string) requestData["map-image-id"], out textureID))
|
||||||
{
|
{
|
||||||
sim.regionMapTextureID = textureID;
|
sim.regionMapTextureID = textureID;
|
||||||
}
|
}
|
||||||
|
@ -570,21 +571,23 @@ namespace OpenSim.Grid.GridServer
|
||||||
//
|
//
|
||||||
// this particular section of the mod attempts to receive a value from the region's xml file by way of
|
// this particular section of the mod attempts to receive a value from the region's xml file by way of
|
||||||
// OSG1GridServices for the region's owner
|
// OSG1GridServices for the region's owner
|
||||||
sim.owner_uuid = (string)requestData["master_avatar_uuid"];
|
sim.owner_uuid = (string) requestData["master_avatar_uuid"];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sim.regionRecvKey = (string)requestData["recvkey"];
|
sim.regionRecvKey = (string) requestData["recvkey"];
|
||||||
sim.regionSendKey = (string)requestData["authkey"];
|
sim.regionSendKey = (string) requestData["authkey"];
|
||||||
|
}
|
||||||
|
catch (KeyNotFoundException)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
catch (KeyNotFoundException) { }
|
|
||||||
|
|
||||||
sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
|
sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
|
||||||
sim.serverURI = (string)requestData["server_uri"];
|
sim.serverURI = (string) requestData["server_uri"];
|
||||||
|
|
||||||
sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
|
sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
|
||||||
|
|
||||||
sim.regionName = (string)requestData["sim_name"];
|
sim.regionName = (string) requestData["sim_name"];
|
||||||
return sim;
|
return sim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +607,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
//RegionProfileData TheSim = null;
|
//RegionProfileData TheSim = null;
|
||||||
string uuid;
|
string uuid;
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
if (requestData.ContainsKey("UUID"))
|
if (requestData.ContainsKey("UUID"))
|
||||||
{
|
{
|
||||||
|
@ -624,7 +627,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
//OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
|
//OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MySQLGridData mysqldata = (MySQLGridData)(kvp.Value);
|
MySQLGridData mysqldata = (MySQLGridData) (kvp.Value);
|
||||||
//DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
|
//DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
|
||||||
DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
|
DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
|
||||||
switch (insertResponse)
|
switch (insertResponse)
|
||||||
|
@ -664,22 +667,22 @@ namespace OpenSim.Grid.GridServer
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
RegionProfileData simData = null;
|
RegionProfileData simData = null;
|
||||||
if (requestData.ContainsKey("region_UUID"))
|
if (requestData.ContainsKey("region_UUID"))
|
||||||
{
|
{
|
||||||
simData = GetRegion(new LLUUID((string)requestData["region_UUID"]));
|
simData = GetRegion(new LLUUID((string) requestData["region_UUID"]));
|
||||||
}
|
}
|
||||||
else if (requestData.ContainsKey("region_handle"))
|
else if (requestData.ContainsKey("region_handle"))
|
||||||
{
|
{
|
||||||
//CFK: The if/else below this makes this message redundant.
|
//CFK: The if/else below this makes this message redundant.
|
||||||
//CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
|
//CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
|
||||||
simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"]));
|
simData = GetRegion(Convert.ToUInt64((string) requestData["region_handle"]));
|
||||||
}
|
}
|
||||||
else if (requestData.ContainsKey("region_name_search"))
|
else if (requestData.ContainsKey("region_name_search"))
|
||||||
{
|
{
|
||||||
simData = GetRegion((string)requestData["region_name_search"]);
|
simData = GetRegion((string) requestData["region_name_search"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simData == null)
|
if (simData == null)
|
||||||
|
@ -690,8 +693,8 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " +
|
m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " +
|
||||||
(string)requestData["region_handle"]);
|
(string) requestData["region_handle"]);
|
||||||
responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
|
responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
|
||||||
responseData["sim_port"] = simData.serverPort.ToString();
|
responseData["sim_port"] = simData.serverPort.ToString();
|
||||||
responseData["server_uri"] = simData.serverURI;
|
responseData["server_uri"] = simData.serverURI;
|
||||||
|
@ -713,22 +716,22 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
|
int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
|
||||||
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
if (requestData.ContainsKey("xmin"))
|
if (requestData.ContainsKey("xmin"))
|
||||||
{
|
{
|
||||||
xmin = (Int32)requestData["xmin"];
|
xmin = (Int32) requestData["xmin"];
|
||||||
}
|
}
|
||||||
if (requestData.ContainsKey("ymin"))
|
if (requestData.ContainsKey("ymin"))
|
||||||
{
|
{
|
||||||
ymin = (Int32)requestData["ymin"];
|
ymin = (Int32) requestData["ymin"];
|
||||||
}
|
}
|
||||||
if (requestData.ContainsKey("xmax"))
|
if (requestData.ContainsKey("xmax"))
|
||||||
{
|
{
|
||||||
xmax = (Int32)requestData["xmax"];
|
xmax = (Int32) requestData["xmax"];
|
||||||
}
|
}
|
||||||
if (requestData.ContainsKey("ymax"))
|
if (requestData.ContainsKey("ymax"))
|
||||||
{
|
{
|
||||||
ymax = (Int32)requestData["ymax"];
|
ymax = (Int32) requestData["ymax"];
|
||||||
}
|
}
|
||||||
//CFK: The second log is more meaningful and either standard or fast generally occurs.
|
//CFK: The second log is more meaningful and either standard or fast generally occurs.
|
||||||
//CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
|
//CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
|
||||||
|
@ -743,15 +746,15 @@ namespace OpenSim.Grid.GridServer
|
||||||
if (fastMode)
|
if (fastMode)
|
||||||
{
|
{
|
||||||
Dictionary<ulong, RegionProfileData> neighbours =
|
Dictionary<ulong, RegionProfileData> neighbours =
|
||||||
GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
|
GetRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax);
|
||||||
|
|
||||||
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
|
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
|
||||||
{
|
{
|
||||||
Hashtable simProfileBlock = new Hashtable();
|
Hashtable simProfileBlock = new Hashtable();
|
||||||
simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
|
simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
|
||||||
simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
|
simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
|
||||||
Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " +
|
Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " +
|
||||||
aSim.Value.regionLocY.ToString());
|
aSim.Value.regionLocY);
|
||||||
simProfileBlock["name"] = aSim.Value.regionName;
|
simProfileBlock["name"] = aSim.Value.regionName;
|
||||||
simProfileBlock["access"] = 21;
|
simProfileBlock["access"] = 21;
|
||||||
simProfileBlock["region-flags"] = 512;
|
simProfileBlock["region-flags"] = 512;
|
||||||
|
@ -761,15 +764,15 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
// For Sugilite compatibility
|
// For Sugilite compatibility
|
||||||
simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
|
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_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["uuid"] = aSim.Value.UUID.ToString();
|
||||||
simProfileBlock["remoting_port"] = aSim.Value.remotingPort;
|
simProfileBlock["remoting_port"] = aSim.Value.remotingPort;
|
||||||
|
|
||||||
simProfileList.Add(simProfileBlock);
|
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 + ")");
|
" regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -779,7 +782,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
for (int y = ymin; y < ymax + 1; y++)
|
for (int y = ymin; y < ymax + 1; y++)
|
||||||
{
|
{
|
||||||
ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
|
ulong regHandle = Helpers.UIntsToLong((uint) (x * Constants.RegionSize), (uint) (y * Constants.RegionSize));
|
||||||
simProfile = GetRegion(regHandle);
|
simProfile = GetRegion(regHandle);
|
||||||
if (simProfile != null)
|
if (simProfile != null)
|
||||||
{
|
{
|
||||||
|
@ -795,16 +798,16 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
// For Sugilite compatibility
|
// For Sugilite compatibility
|
||||||
simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
|
simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
|
||||||
simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
|
simProfileBlock["sim_ip"] = simProfile.serverIP;
|
||||||
simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
|
simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
|
||||||
simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
|
simProfileBlock["sim_uri"] = simProfile.serverURI;
|
||||||
simProfileBlock["uuid"] = simProfile.UUID.ToString();
|
simProfileBlock["uuid"] = simProfile.UUID.ToString();
|
||||||
|
|
||||||
simProfileList.Add(simProfileBlock);
|
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 + ")");
|
" regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,12 +863,12 @@ namespace OpenSim.Grid.GridServer
|
||||||
respstring = "<Root>";
|
respstring = "<Root>";
|
||||||
respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
|
respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
|
||||||
respstring += "<sim>";
|
respstring += "<sim>";
|
||||||
respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
|
respstring += "<uuid>" + TheSim.UUID + "</uuid>";
|
||||||
respstring += "<regionname>" + TheSim.regionName + "</regionname>";
|
respstring += "<regionname>" + TheSim.regionName + "</regionname>";
|
||||||
respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "</sim_ip>";
|
respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP) + "</sim_ip>";
|
||||||
respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
|
respstring += "<sim_port>" + TheSim.serverPort + "</sim_port>";
|
||||||
respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
|
respstring += "<region_locx>" + TheSim.regionLocX + "</region_locx>";
|
||||||
respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
|
respstring += "<region_locy>" + TheSim.regionLocY + "</region_locy>";
|
||||||
respstring += "<estate_id>1</estate_id>";
|
respstring += "<estate_id>1</estate_id>";
|
||||||
respstring += "</sim>";
|
respstring += "</sim>";
|
||||||
respstring += "</Root>";
|
respstring += "</Root>";
|
||||||
|
@ -946,12 +949,12 @@ namespace OpenSim.Grid.GridServer
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "region_locx":
|
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));
|
theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "region_locy":
|
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));
|
theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1005,28 +1008,28 @@ namespace OpenSim.Grid.GridServer
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
|
m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
|
||||||
e.ToString());
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return "ERROR! Could not save to database! (" + e.ToString() + ")";
|
return "ERROR! Could not save to database! (" + e + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
if (requestData.Contains("uri"))
|
if (requestData.Contains("uri"))
|
||||||
{
|
{
|
||||||
string URI = (string)requestData["URI"];
|
string URI = (string) requestData["URI"];
|
||||||
string sendkey = (string)requestData["sendkey"];
|
string sendkey = (string) requestData["sendkey"];
|
||||||
string recvkey = (string)requestData["recvkey"];
|
string recvkey = (string) requestData["recvkey"];
|
||||||
MessageServerInfo m = new MessageServerInfo();
|
MessageServerInfo m = new MessageServerInfo();
|
||||||
m.URI = URI;
|
m.URI = URI;
|
||||||
m.sendkey = sendkey;
|
m.sendkey = sendkey;
|
||||||
|
@ -1042,14 +1045,14 @@ namespace OpenSim.Grid.GridServer
|
||||||
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
if (requestData.Contains("uri"))
|
if (requestData.Contains("uri"))
|
||||||
{
|
{
|
||||||
string URI = (string)requestData["uri"];
|
string URI = (string) requestData["uri"];
|
||||||
string sendkey = (string)requestData["sendkey"];
|
string sendkey = (string) requestData["sendkey"];
|
||||||
string recvkey = (string)requestData["recvkey"];
|
string recvkey = (string) requestData["recvkey"];
|
||||||
MessageServerInfo m = new MessageServerInfo();
|
MessageServerInfo m = new MessageServerInfo();
|
||||||
m.URI = URI;
|
m.URI = URI;
|
||||||
m.sendkey = sendkey;
|
m.sendkey = sendkey;
|
||||||
|
@ -1062,4 +1065,4 @@ namespace OpenSim.Grid.GridServer
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,6 +44,34 @@ namespace OpenSim.Grid.GridServer
|
||||||
protected GridManager m_gridManager;
|
protected GridManager m_gridManager;
|
||||||
protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
|
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()
|
public void Work()
|
||||||
{
|
{
|
||||||
m_console.Notice("Enter help for a list of commands\n");
|
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)
|
public void managercallback(string cmd)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
|
@ -83,14 +105,14 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
AddHttpHandlers();
|
AddHttpHandlers();
|
||||||
|
|
||||||
LoadGridPlugins( );
|
LoadGridPlugins();
|
||||||
|
|
||||||
m_httpServer.Start();
|
m_httpServer.Start();
|
||||||
|
|
||||||
m_console.Status("[GRID]: Starting sim status checker");
|
m_console.Status("[GRID]: Starting sim status checker");
|
||||||
|
|
||||||
Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
|
Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
|
||||||
simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
|
simCheckTimer.Elapsed += CheckSims;
|
||||||
simCheckTimer.Enabled = true;
|
simCheckTimer.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +144,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
foreach (TypeExtensionNode node in nodes)
|
foreach (TypeExtensionNode node in nodes)
|
||||||
{
|
{
|
||||||
m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path);
|
m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path);
|
||||||
IGridPlugin plugin = (IGridPlugin)node.CreateInstance();
|
IGridPlugin plugin = (IGridPlugin) node.CreateInstance();
|
||||||
plugin.Initialise(this);
|
plugin.Initialise(this);
|
||||||
m_plugins.Add(plugin);
|
m_plugins.Add(plugin);
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -38,4 +38,4 @@ namespace OpenSim.Grid.GridServer
|
||||||
void Initialise(GridServerBase gridServer);
|
void Initialise(GridServerBase gridServer);
|
||||||
void Close();
|
void Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -50,4 +50,4 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
|
||||||
//
|
//
|
||||||
|
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
|
@ -40,7 +40,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GridInventoryService : InventoryServiceBase
|
public class GridInventoryService : InventoryServiceBase
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log
|
private static readonly ILog m_log
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
|
public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
|
||||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
/// <param name="itemsList"></param>
|
/// <param name="itemsList"></param>
|
||||||
/// <returns>true if the inventory was retrieved, false otherwise</returns>
|
/// <returns>true if the inventory was retrieved, false otherwise</returns>
|
||||||
private bool GetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList,
|
private bool GetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList,
|
||||||
out List<InventoryItemBase> itemsList)
|
out List<InventoryItemBase> itemsList)
|
||||||
{
|
{
|
||||||
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
||||||
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
||||||
|
@ -109,28 +109,28 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
// uncomment me to simulate an overloaded inventory server
|
// uncomment me to simulate an overloaded inventory server
|
||||||
//Thread.Sleep(20000);
|
//Thread.Sleep(20000);
|
||||||
|
|
||||||
LLUUID userID = new LLUUID(rawUserID);
|
LLUUID userID = new LLUUID(rawUserID);
|
||||||
|
|
||||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
|
m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
|
||||||
|
|
||||||
InventoryCollection invCollection = new InventoryCollection();
|
InventoryCollection invCollection = new InventoryCollection();
|
||||||
|
|
||||||
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
||||||
|
|
||||||
if (null == allFolders)
|
if (null == allFolders)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID);
|
m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID);
|
||||||
|
|
||||||
return invCollection;
|
return invCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
||||||
|
|
||||||
foreach (InventoryFolderBase folder in allFolders)
|
foreach (InventoryFolderBase folder in allFolders)
|
||||||
{
|
{
|
||||||
List<InventoryItemBase> items = RequestFolderItems(folder.ID);
|
List<InventoryItemBase> items = RequestFolderItems(folder.ID);
|
||||||
|
|
||||||
if (items != null)
|
if (items != null)
|
||||||
{
|
{
|
||||||
allItems.InsertRange(0, items);
|
allItems.InsertRange(0, items);
|
||||||
|
@ -138,9 +138,9 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
}
|
}
|
||||||
|
|
||||||
invCollection.UserID = userID;
|
invCollection.UserID = userID;
|
||||||
invCollection.Folders = allFolders;
|
invCollection.Folders = allFolders;
|
||||||
invCollection.Items = allItems;
|
invCollection.Items = allItems;
|
||||||
|
|
||||||
// foreach (InventoryFolderBase folder in invCollection.Folders)
|
// foreach (InventoryFolderBase folder in invCollection.Folders)
|
||||||
// {
|
// {
|
||||||
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
|
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
|
||||||
|
@ -150,14 +150,14 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
// {
|
// {
|
||||||
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
|
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items",
|
"[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items",
|
||||||
invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
|
invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
|
||||||
|
|
||||||
return invCollection;
|
return invCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Guid to UUID wrapper for same name IInventoryServices method
|
/// Guid to UUID wrapper for same name IInventoryServices method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -166,10 +166,10 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID)
|
public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID)
|
||||||
{
|
{
|
||||||
//Thread.Sleep(10000);
|
//Thread.Sleep(10000);
|
||||||
|
|
||||||
LLUUID userID = new LLUUID(rawUserID);
|
LLUUID userID = new LLUUID(rawUserID);
|
||||||
return GetInventorySkeleton(userID);
|
return GetInventorySkeleton(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an inventory for the given user.
|
/// Create an inventory for the given user.
|
||||||
|
@ -196,11 +196,11 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
MoveFolder(folder);
|
MoveFolder(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
PurgeFolder(folder);
|
PurgeFolder(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
@ -230,15 +230,15 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
MoveExistingInventoryFolder(folder);
|
MoveExistingInventoryFolder(folder);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PurgeInventoryFolder(InventoryFolderBase folder)
|
public bool PurgeInventoryFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
|
"[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
|
||||||
|
|
||||||
PurgeInventoryFolder(folder.Owner, folder);
|
PurgeInventoryFolder(folder.Owner, folder);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddInventoryItem(InventoryItemBase item)
|
public bool AddInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
@ -267,4 +267,4 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
|
|
||||||
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
|
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
|
||||||
"Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
"Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
if (!pluginType.IsAbstract)
|
if (!pluginType.IsAbstract)
|
||||||
|
@ -68,7 +68,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
plug.Initialise(dbconnect);
|
plug.Initialise(dbconnect);
|
||||||
_databasePlugin = plug;
|
_databasePlugin = plug;
|
||||||
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
|
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
|
||||||
"Invenstorage: Added IInventoryData Interface");
|
"Invenstorage: Added IInventoryData Interface");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,10 +136,12 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
return fixupFolder(inventory.root, null);
|
return fixupFolder(inventory.root, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Nested type: GetInventory
|
||||||
|
|
||||||
public class GetInventory : BaseStreamHandler
|
public class GetInventory : BaseStreamHandler
|
||||||
{
|
{
|
||||||
private SerializableInventory _inventory;
|
private readonly SerializableInventory _inventory;
|
||||||
private InventoryManager _manager;
|
private readonly InventoryManager _manager;
|
||||||
|
|
||||||
public GetInventory(InventoryManager manager)
|
public GetInventory(InventoryManager manager)
|
||||||
: base("GET", "/inventory")
|
: base("GET", "/inventory")
|
||||||
|
@ -181,7 +183,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
byte[] result = new byte[] {};
|
byte[] result = new byte[] {};
|
||||||
|
|
||||||
string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
string[] parms = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (parms.Length > 1)
|
if (parms.Length > 1)
|
||||||
{
|
{
|
||||||
if (string.Compare(parms[1], "library", true) == 0)
|
if (string.Compare(parms[1], "library", true) == 0)
|
||||||
|
@ -190,7 +192,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
saveInventoryToStream(_inventory, ms);
|
saveInventoryToStream(_inventory, ms);
|
||||||
|
|
||||||
result = ms.GetBuffer();
|
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)
|
else if (string.Compare(parms[1], "user", true) == 0)
|
||||||
{
|
{
|
||||||
|
@ -203,5 +205,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,13 +40,38 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
|
public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
|
||||||
{
|
{
|
||||||
|
public const string LogName = "INVENTORY";
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private InventoryManager m_inventoryManager;
|
|
||||||
private InventoryConfig m_config;
|
private InventoryConfig m_config;
|
||||||
|
private InventoryManager m_inventoryManager;
|
||||||
private GridInventoryService m_inventoryService;
|
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]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
|
@ -59,12 +84,6 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
theServer.Work();
|
theServer.Work();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenInventory_Main()
|
|
||||||
{
|
|
||||||
m_console = new ConsoleBase(LogName, this);
|
|
||||||
MainConsole.Instance = m_console;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Startup()
|
public void Startup()
|
||||||
{
|
{
|
||||||
m_log.Info("Initialising inventory manager...");
|
m_log.Info("Initialising inventory manager...");
|
||||||
|
@ -75,7 +94,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
|
m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
|
||||||
|
|
||||||
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
|
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
|
||||||
|
|
||||||
m_httpServer = new BaseHttpServer(m_config.HttpPort);
|
m_httpServer = new BaseHttpServer(m_config.HttpPort);
|
||||||
AddHttpHandlers();
|
AddHttpHandlers();
|
||||||
m_httpServer.Start();
|
m_httpServer.Start();
|
||||||
|
@ -88,11 +107,11 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<Guid, InventoryCollection>(
|
new RestDeserialisehandler<Guid, InventoryCollection>(
|
||||||
"POST", "/GetInventory/", m_inventoryService.GetUserInventory));
|
"POST", "/GetInventory/", m_inventoryService.GetUserInventory));
|
||||||
|
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<Guid, bool>(
|
new RestDeserialisehandler<Guid, bool>(
|
||||||
"POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory));
|
"POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory));
|
||||||
|
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<InventoryFolderBase, bool>(
|
new RestDeserialisehandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/NewFolder/", m_inventoryService.AddInventoryFolder));
|
"POST", "/NewFolder/", m_inventoryService.AddInventoryFolder));
|
||||||
|
@ -100,15 +119,15 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<InventoryFolderBase, bool>(
|
new RestDeserialisehandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder));
|
"POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder));
|
||||||
|
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<InventoryFolderBase, bool>(
|
new RestDeserialisehandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder));
|
"POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder));
|
||||||
|
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<InventoryItemBase, bool>(
|
new RestDeserialisehandler<InventoryItemBase, bool>(
|
||||||
"POST", "/NewItem/", m_inventoryService.AddInventoryItem));
|
"POST", "/NewItem/", m_inventoryService.AddInventoryItem));
|
||||||
|
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialisehandler<InventoryItemBase, bool>(
|
new RestDeserialisehandler<InventoryItemBase, bool>(
|
||||||
"POST", "/DeleteItem/", m_inventoryService.DeleteInvItem));
|
"POST", "/DeleteItem/", m_inventoryService.DeleteInvItem));
|
||||||
|
@ -134,21 +153,5 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_console.Prompt();
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,9 +44,42 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private MessageServerConfig Cfg;
|
private MessageServerConfig Cfg;
|
||||||
private MessageService msgsvc;
|
|
||||||
|
|
||||||
private LLUUID m_lastCreatedUser = LLUUID.Random();
|
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]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
|
@ -55,7 +88,6 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
|
|
||||||
m_log.Info("Launching MessagingServer...");
|
m_log.Info("Launching MessagingServer...");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OpenMessage_Main messageserver = new OpenMessage_Main();
|
OpenMessage_Main messageserver = new OpenMessage_Main();
|
||||||
|
|
||||||
|
@ -63,12 +95,6 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
messageserver.Work();
|
messageserver.Work();
|
||||||
}
|
}
|
||||||
|
|
||||||
private OpenMessage_Main()
|
|
||||||
{
|
|
||||||
m_console = new ConsoleBase("OpenMessage", this);
|
|
||||||
MainConsole.Instance = m_console;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Work()
|
private void Work()
|
||||||
{
|
{
|
||||||
m_console.Notice("Enter help for a list of commands\n");
|
m_console.Notice("Enter help for a list of commands\n");
|
||||||
|
@ -118,12 +144,13 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
case "user":
|
case "user":
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//userID =
|
//userID =
|
||||||
//m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
//m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
|
m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
|
||||||
}
|
}
|
||||||
|
@ -131,7 +158,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
|
//RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
|
||||||
//userID.UUID);
|
//userID.UUID);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -141,28 +168,5 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
break;
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
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
|
//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
|
//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
|
//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
|
// Hashtable containing work units that need to be processed
|
||||||
private Hashtable m_unProcessedWorkUnits = new Hashtable();
|
private Hashtable m_unProcessedWorkUnits = new Hashtable();
|
||||||
|
@ -63,13 +63,13 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
m_cfg = cfg;
|
m_cfg = cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region RegionComms Methods
|
#region RegionComms Methods
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region FriendList Methods
|
#region FriendList Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process Friendlist subscriptions for a user
|
/// Process Friendlist subscriptions for a user
|
||||||
/// The login method calls this for a User
|
/// The login method calls this for a User
|
||||||
|
@ -87,14 +87,14 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
for (int i = 0; i < uFriendList.Count; i++)
|
for (int i = 0; i < uFriendList.Count; i++)
|
||||||
{
|
{
|
||||||
//m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
|
//m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
|
||||||
// m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
|
// m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
|
||||||
|
|
||||||
if (m_presences.Contains(uFriendList[i].Friend))
|
if (m_presences.Contains(uFriendList[i].Friend))
|
||||||
{
|
{
|
||||||
UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend];
|
UserPresenceData friendup = (UserPresenceData) m_presences[uFriendList[i].Friend];
|
||||||
// Add backreference
|
// Add backreference
|
||||||
|
|
||||||
SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i);
|
SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,10 +108,10 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
/// <param name="friendpresence">P2</param>
|
/// <param name="friendpresence">P2</param>
|
||||||
/// <param name="uFriendListItem"></param>
|
/// <param name="uFriendListItem"></param>
|
||||||
/// <param name="uFriendListIndex"></param>
|
/// <param name="uFriendListIndex"></param>
|
||||||
public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence,
|
public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence,
|
||||||
FriendListItem uFriendListItem, int uFriendListIndex)
|
FriendListItem uFriendListItem, int uFriendListIndex)
|
||||||
{
|
{
|
||||||
if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
|
if ((uFriendListItem.FriendListOwnerPerms & (uint) FriendRights.CanSeeOnline) != 0)
|
||||||
{
|
{
|
||||||
// Subscribe and Send Out updates
|
// Subscribe and Send Out updates
|
||||||
if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
|
if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
|
||||||
|
@ -126,13 +126,13 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
PresenceInformer friendlistupdater = new PresenceInformer();
|
PresenceInformer friendlistupdater = new PresenceInformer();
|
||||||
friendlistupdater.presence1 = friendpresence;
|
friendlistupdater.presence1 = friendpresence;
|
||||||
friendlistupdater.presence2 = userpresence;
|
friendlistupdater.presence2 = userpresence;
|
||||||
WaitCallback cb = new WaitCallback(friendlistupdater.go);
|
WaitCallback cb = friendlistupdater.go;
|
||||||
ThreadPool.QueueUserWorkItem(cb);
|
ThreadPool.QueueUserWorkItem(cb);
|
||||||
|
|
||||||
//SendRegionPresenceUpdate(friendpresence, userpresence);
|
//SendRegionPresenceUpdate(friendpresence, userpresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
|
if ((uFriendListItem.FriendPerms & (uint) FriendRights.CanSeeOnline) != 0)
|
||||||
{
|
{
|
||||||
if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
|
if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
|
||||||
{
|
{
|
||||||
|
@ -147,9 +147,9 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
friendlistupdater.presence1 = userpresence;
|
friendlistupdater.presence1 = userpresence;
|
||||||
friendlistupdater.presence2 = friendpresence;
|
friendlistupdater.presence2 = friendpresence;
|
||||||
|
|
||||||
WaitCallback cb2 = new WaitCallback(friendlistupdater.go);
|
WaitCallback cb2 = friendlistupdater.go;
|
||||||
ThreadPool.QueueUserWorkItem(cb2);
|
ThreadPool.QueueUserWorkItem(cb2);
|
||||||
|
|
||||||
//SendRegionPresenceUpdate(userpresence, friendpresence);
|
//SendRegionPresenceUpdate(userpresence, friendpresence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
if (m_presence_BackReferences.Contains(friendID))
|
if (m_presence_BackReferences.Contains(friendID))
|
||||||
{
|
{
|
||||||
List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID];
|
List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID];
|
||||||
if (!presenseBackReferences.Contains(agentID))
|
if (!presenseBackReferences.Contains(agentID))
|
||||||
{
|
{
|
||||||
presenseBackReferences.Add(agentID);
|
presenseBackReferences.Add(agentID);
|
||||||
|
@ -188,7 +188,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
if (m_presence_BackReferences.Contains(friendID))
|
if (m_presence_BackReferences.Contains(friendID))
|
||||||
{
|
{
|
||||||
List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID];
|
List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID];
|
||||||
if (presenseBackReferences.Contains(agentID))
|
if (presenseBackReferences.Contains(agentID))
|
||||||
{
|
{
|
||||||
presenseBackReferences.Remove(agentID);
|
presenseBackReferences.Remove(agentID);
|
||||||
|
@ -216,29 +216,29 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
if (m_presences.Contains(AgentID))
|
if (m_presences.Contains(AgentID))
|
||||||
{
|
{
|
||||||
AgentData = (UserPresenceData)m_presences[AgentID];
|
AgentData = (UserPresenceData) m_presences[AgentID];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AgentData != null)
|
if (AgentData != null)
|
||||||
{
|
{
|
||||||
AgentsNeedingNotification = AgentData.subscriptionData;
|
AgentsNeedingNotification = AgentData.subscriptionData;
|
||||||
//lock (m_presence_BackReferences)
|
//lock (m_presence_BackReferences)
|
||||||
//{
|
//{
|
||||||
//if (m_presence_BackReferences.Contains(AgentID))
|
//if (m_presence_BackReferences.Contains(AgentID))
|
||||||
//{
|
//{
|
||||||
//AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID];
|
//AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID];
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
for (int i = 0; i < AgentsNeedingNotification.Count; i++)
|
for (int i = 0; i < AgentsNeedingNotification.Count; i++)
|
||||||
{
|
{
|
||||||
// TODO: Do Region Notifications
|
// TODO: Do Region Notifications
|
||||||
lock(m_presences)
|
lock (m_presences)
|
||||||
{
|
{
|
||||||
if (m_presences.Contains(AgentsNeedingNotification[i]))
|
if (m_presences.Contains(AgentsNeedingNotification[i]))
|
||||||
{
|
{
|
||||||
friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]];
|
friendd = (UserPresenceData) m_presences[AgentsNeedingNotification[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
friendlistupdater.presence1 = AgentData;
|
friendlistupdater.presence1 = AgentData;
|
||||||
friendlistupdater.presence2 = friendd;
|
friendlistupdater.presence2 = friendd;
|
||||||
|
|
||||||
WaitCallback cb3 = new WaitCallback(friendlistupdater.go);
|
WaitCallback cb3 = friendlistupdater.go;
|
||||||
ThreadPool.QueueUserWorkItem(cb3);
|
ThreadPool.QueueUserWorkItem(cb3);
|
||||||
|
|
||||||
//SendRegionPresenceUpdate(AgentData, friendd);
|
//SendRegionPresenceUpdate(AgentData, friendd);
|
||||||
|
@ -276,7 +276,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UserServer Comms
|
#region UserServer Comms
|
||||||
|
@ -298,18 +298,17 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
|
XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
|
||||||
XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
|
XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
|
||||||
Hashtable respData = (Hashtable)resp.Value;
|
Hashtable respData = (Hashtable) resp.Value;
|
||||||
|
|
||||||
if (respData.Contains("avcount"))
|
if (respData.Contains("avcount"))
|
||||||
{
|
{
|
||||||
buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
|
buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
m_log.Warn("Error when trying to fetch Avatar's friends list: " +
|
m_log.Warn("Error when trying to fetch Avatar's friends list: " +
|
||||||
e.Message);
|
e.Message);
|
||||||
// Return Empty list (no friends)
|
// Return Empty list (no friends)
|
||||||
}
|
}
|
||||||
return buddylist;
|
return buddylist;
|
||||||
|
@ -323,16 +322,16 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
|
public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
|
||||||
{
|
{
|
||||||
List<FriendListItem> buddylist = new List<FriendListItem>();
|
List<FriendListItem> buddylist = new List<FriendListItem>();
|
||||||
int buddycount = Convert.ToInt32((string)data["avcount"]);
|
int buddycount = Convert.ToInt32((string) data["avcount"]);
|
||||||
|
|
||||||
for (int i = 0; i < buddycount; i++)
|
for (int i = 0; i < buddycount; i++)
|
||||||
{
|
{
|
||||||
FriendListItem buddylistitem = new FriendListItem();
|
FriendListItem buddylistitem = new FriendListItem();
|
||||||
|
|
||||||
buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]);
|
buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]);
|
||||||
buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]);
|
buddylistitem.Friend = new LLUUID((string) data["friendID" + i]);
|
||||||
buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
|
buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]);
|
||||||
buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
|
buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]);
|
||||||
|
|
||||||
buddylist.Add(buddylistitem);
|
buddylist.Add(buddylistitem);
|
||||||
}
|
}
|
||||||
|
@ -350,7 +349,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
|
public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
m_log.Info("[LOGON]: User logged on, building indexes for user");
|
m_log.Info("[LOGON]: User logged on, building indexes for user");
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
//requestData["sendkey"] = serv.sendkey;
|
//requestData["sendkey"] = serv.sendkey;
|
||||||
//requestData["agentid"] = agentID.ToString();
|
//requestData["agentid"] = agentID.ToString();
|
||||||
|
@ -364,13 +363,13 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
//requestData["lastname"] = lastname;
|
//requestData["lastname"] = lastname;
|
||||||
|
|
||||||
AgentCircuitData agentData = new AgentCircuitData();
|
AgentCircuitData agentData = new AgentCircuitData();
|
||||||
agentData.SessionID = new LLUUID((string)requestData["sessionid"]);
|
agentData.SessionID = new LLUUID((string) requestData["sessionid"]);
|
||||||
agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
|
agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]);
|
||||||
agentData.firstname = (string)requestData["firstname"];
|
agentData.firstname = (string) requestData["firstname"];
|
||||||
agentData.lastname = (string)requestData["lastname"];
|
agentData.lastname = (string) requestData["lastname"];
|
||||||
agentData.AgentID = new LLUUID((string)requestData["agentid"]);
|
agentData.AgentID = new LLUUID((string) requestData["agentid"]);
|
||||||
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||||
agentData.CapsPath = (string)requestData["caps_path"];
|
agentData.CapsPath = (string) requestData["caps_path"];
|
||||||
|
|
||||||
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
|
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
|
||||||
{
|
{
|
||||||
|
@ -379,13 +378,13 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
agentData.startpos =
|
agentData.startpos =
|
||||||
new LLVector3(Convert.ToUInt32(requestData["positionx"]),
|
new LLVector3(Convert.ToUInt32(requestData["positionx"]),
|
||||||
Convert.ToUInt32(requestData["positiony"]),
|
Convert.ToUInt32(requestData["positiony"]),
|
||||||
Convert.ToUInt32(requestData["positionz"]));
|
Convert.ToUInt32(requestData["positionz"]));
|
||||||
agentData.child = false;
|
agentData.child = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
|
ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
|
||||||
|
|
||||||
UserPresenceData up = new UserPresenceData();
|
UserPresenceData up = new UserPresenceData();
|
||||||
up.agentData = agentData;
|
up.agentData = agentData;
|
||||||
|
@ -398,7 +397,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
|
|
||||||
return new XmlRpcResponse();
|
return new XmlRpcResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UserServer got a Logoff message
|
/// The UserServer got a Logoff message
|
||||||
/// Cleanup time for that user. Send out presence notifications
|
/// Cleanup time for that user. Send out presence notifications
|
||||||
|
@ -407,9 +406,9 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
|
public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
LLUUID AgentID = new LLUUID((string)requestData["agentid"]);
|
LLUUID AgentID = new LLUUID((string) requestData["agentid"]);
|
||||||
|
|
||||||
ProcessLogOff(AgentID);
|
ProcessLogOff(AgentID);
|
||||||
|
|
||||||
|
@ -431,9 +430,9 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
RegionProfileData regionInfo = null;
|
RegionProfileData regionInfo = null;
|
||||||
if (m_regionInfoCache.Contains(regionhandle))
|
if (m_regionInfoCache.Contains(regionhandle))
|
||||||
{
|
{
|
||||||
regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle];
|
regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
regionInfo = RequestRegionInfo(regionhandle);
|
regionInfo = RequestRegionInfo(regionhandle);
|
||||||
}
|
}
|
||||||
|
@ -447,7 +446,8 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
/// <param name="regionHandle"></param>
|
/// <param name="regionHandle"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public RegionProfileData RequestRegionInfo(ulong regionHandle)
|
public RegionProfileData RequestRegionInfo(ulong regionHandle)
|
||||||
{ RegionProfileData regionProfile = null;
|
{
|
||||||
|
RegionProfileData regionProfile = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Hashtable requestData = new Hashtable();
|
Hashtable requestData = new Hashtable();
|
||||||
|
@ -457,8 +457,8 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
SendParams.Add(requestData);
|
SendParams.Add(requestData);
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||||
XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000);
|
XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000);
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)GridResp.Value;
|
Hashtable responseData = (Hashtable) GridResp.Value;
|
||||||
|
|
||||||
if (responseData.ContainsKey("error"))
|
if (responseData.ContainsKey("error"))
|
||||||
{
|
{
|
||||||
|
@ -466,23 +466,23 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
|
uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
|
||||||
uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
|
uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
|
||||||
string internalIpStr = (string)responseData["sim_ip"];
|
string internalIpStr = (string) responseData["sim_ip"];
|
||||||
uint port = Convert.ToUInt32(responseData["sim_port"]);
|
uint port = Convert.ToUInt32(responseData["sim_port"]);
|
||||||
string externalUri = (string)responseData["sim_uri"];
|
string externalUri = (string) responseData["sim_uri"];
|
||||||
string neighbourExternalUri = externalUri;
|
string neighbourExternalUri = externalUri;
|
||||||
|
|
||||||
regionProfile = new RegionProfileData();
|
regionProfile = new RegionProfileData();
|
||||||
regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
|
regionProfile.httpPort = (uint) Convert.ToInt32((string) responseData["http_port"]);
|
||||||
regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
|
regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
|
||||||
regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
|
regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
|
||||||
regionProfile.regionLocX = regX;
|
regionProfile.regionLocX = regX;
|
||||||
regionProfile.regionLocY = regY;
|
regionProfile.regionLocY = regY;
|
||||||
|
|
||||||
regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
|
regionProfile.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
||||||
regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]);
|
regionProfile.UUID = new LLUUID((string) responseData["region_UUID"]);
|
||||||
regionProfile.regionName = (string)responseData["region_name"];
|
regionProfile.regionName = (string) responseData["region_name"];
|
||||||
lock (m_regionInfoCache)
|
lock (m_regionInfoCache)
|
||||||
{
|
{
|
||||||
if (!m_regionInfoCache.Contains(regionHandle))
|
if (!m_regionInfoCache.Contains(regionHandle))
|
||||||
|
@ -494,31 +494,31 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
catch (WebException)
|
catch (WebException)
|
||||||
{
|
{
|
||||||
m_log.Error("[GRID]: " +
|
m_log.Error("[GRID]: " +
|
||||||
"Region lookup failed for: " + regionHandle.ToString() +
|
"Region lookup failed for: " + regionHandle +
|
||||||
" - Is the GridServer down?");
|
" - Is the GridServer down?");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return regionProfile;
|
return regionProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool registerWithUserServer ()
|
public bool registerWithUserServer()
|
||||||
{
|
{
|
||||||
Hashtable UserParams = new Hashtable();
|
Hashtable UserParams = new Hashtable();
|
||||||
// Login / Authentication
|
// Login / Authentication
|
||||||
|
|
||||||
if (m_cfg.HttpSSL)
|
if (m_cfg.HttpSSL)
|
||||||
{
|
{
|
||||||
UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
|
UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
|
UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserParams["recvkey"] = m_cfg.UserRecvKey;
|
UserParams["recvkey"] = m_cfg.UserRecvKey;
|
||||||
UserParams["sendkey"] = m_cfg.UserRecvKey;
|
UserParams["sendkey"] = m_cfg.UserRecvKey;
|
||||||
|
|
||||||
// Package into an XMLRPC Request
|
// Package into an XMLRPC Request
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(UserParams);
|
SendParams.Add(UserParams);
|
||||||
|
@ -530,12 +530,13 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
UserReq = new XmlRpcRequest("register_messageserver", SendParams);
|
UserReq = new XmlRpcRequest("register_messageserver", SendParams);
|
||||||
UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
|
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?");
|
m_log.Error("Unable to connect to grid. Grid server not running?");
|
||||||
throw(ex);
|
throw (ex);
|
||||||
}
|
}
|
||||||
Hashtable GridRespData = (Hashtable)UserResp.Value;
|
Hashtable GridRespData = (Hashtable) UserResp.Value;
|
||||||
Hashtable griddatahash = GridRespData;
|
Hashtable griddatahash = GridRespData;
|
||||||
|
|
||||||
// Process Response
|
// Process Response
|
||||||
|
@ -583,7 +584,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
m_log.Error("Unable to connect to grid. Grid server not running?");
|
m_log.Error("Unable to connect to grid. Grid server not running?");
|
||||||
throw (ex);
|
throw (ex);
|
||||||
}
|
}
|
||||||
Hashtable UserRespData = (Hashtable)UserResp.Value;
|
Hashtable UserRespData = (Hashtable) UserResp.Value;
|
||||||
Hashtable userdatahash = UserRespData;
|
Hashtable userdatahash = UserRespData;
|
||||||
|
|
||||||
// Process Response
|
// Process Response
|
||||||
|
@ -599,4 +600,4 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,21 +35,16 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
public class PresenceInformer
|
public class PresenceInformer
|
||||||
{
|
{
|
||||||
public UserPresenceData presence1 = null;
|
|
||||||
public UserPresenceData presence2 = null;
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
public UserPresenceData presence1;
|
||||||
|
public UserPresenceData presence2;
|
||||||
|
|
||||||
public PresenceInformer()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public void go(object o)
|
public void go(object o)
|
||||||
{
|
{
|
||||||
if (presence1 != null && presence2 != null)
|
if (presence1 != null && presence2 != null)
|
||||||
{
|
{
|
||||||
SendRegionPresenceUpdate(presence1, presence2);
|
SendRegionPresenceUpdate(presence1, presence2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -74,4 +69,4 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
|
XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -36,13 +36,9 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
public class UserPresenceData
|
public class UserPresenceData
|
||||||
{
|
{
|
||||||
public AgentCircuitData agentData = new AgentCircuitData();
|
public AgentCircuitData agentData = new AgentCircuitData();
|
||||||
public RegionProfileData regionData = new RegionProfileData();
|
public List<FriendListItem> friendData = new List<FriendListItem>();
|
||||||
public string httpURI = String.Empty;
|
public string httpURI = String.Empty;
|
||||||
public List<FriendListItem> friendData = new List<FriendListItem> ();
|
public RegionProfileData regionData = new RegionProfileData();
|
||||||
public List<LLUUID> subscriptionData = new List<LLUUID>();
|
public List<LLUUID> subscriptionData = new List<LLUUID>();
|
||||||
|
|
||||||
public UserPresenceData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
public class WorkUnitBase
|
public class WorkUnitBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
public class WorkUnitPresenceUpdate : WorkUnitBase
|
public class WorkUnitPresenceUpdate : WorkUnitBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -48,28 +48,26 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
: base("GET", "/presence")
|
: base("GET", "/presence")
|
||||||
{
|
{
|
||||||
m_log.Info("[REST]: In Get Request");
|
m_log.Info("[REST]: In Get Request");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte[] Handle(string path, Stream request)
|
public override byte[] Handle(string path, Stream request)
|
||||||
{
|
{
|
||||||
string param = GetParam(path);
|
string param = GetParam(path);
|
||||||
byte[] result = new byte[] {};
|
byte[] result = new byte[] {};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
|
string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
if (p.Length > 0)
|
if (p.Length > 0)
|
||||||
{
|
{
|
||||||
LLUUID assetID = null;
|
LLUUID assetID = null;
|
||||||
|
|
||||||
if (!LLUUID.TryParse(p[0], out assetID))
|
if (!LLUUID.TryParse(p[0], out assetID))
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
|
"[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -84,6 +82,11 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public PostXMPPStreamHandler()
|
||||||
|
: base("POST", "/presence")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override byte[] Handle(string path, Stream request)
|
public override byte[] Handle(string path, Stream request)
|
||||||
{
|
{
|
||||||
string param = GetParam(path);
|
string param = GetParam(path);
|
||||||
|
@ -97,12 +100,5 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
|
|
||||||
return new byte[] {};
|
return new byte[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public PostXMPPStreamHandler()
|
|
||||||
: base("POST", "/presence")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
XmlConfigurator.Configure();
|
XmlConfigurator.Configure();
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException +=
|
AppDomain.CurrentDomain.UnhandledException +=
|
||||||
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
// Application is starting
|
// Application is starting
|
||||||
SE = new ScriptServerMain();
|
SE = new ScriptServerMain();
|
||||||
|
@ -50,9 +50,9 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
Console.WriteLine(String.Empty);
|
Console.WriteLine(String.Empty);
|
||||||
Console.WriteLine("APPLICATION EXCEPTION DETECTED");
|
Console.WriteLine("APPLICATION EXCEPTION DETECTED");
|
||||||
Console.WriteLine(String.Empty);
|
Console.WriteLine(String.Empty);
|
||||||
Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
|
Console.WriteLine("Application is terminating: " + e.IsTerminating);
|
||||||
//Console.WriteLine("Exception:");
|
//Console.WriteLine("Exception:");
|
||||||
//Console.WriteLine(e.ExceptionObject.ToString());
|
//Console.WriteLine(e.ExceptionObject.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Grid.ScriptServer
|
namespace OpenSim.Grid.ScriptServer
|
||||||
{
|
{
|
||||||
public class FakeScene: Scene
|
public class FakeScene : Scene
|
||||||
{
|
{
|
||||||
public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
|
public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
|
||||||
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
|
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
|
||||||
|
@ -48,4 +48,4 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
|
|
||||||
// What does a scene have to do? :P
|
// What does a scene have to do? :P
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
|
||||||
//
|
//
|
||||||
|
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
|
@ -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.
|
// 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()
|
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
|
||||||
{
|
{
|
||||||
return ScriptServerMain.Engine.EventManager();
|
return ScriptServerMain.Engine.EventManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,9 +31,10 @@ using System.Runtime.Remoting.Channels.Tcp;
|
||||||
|
|
||||||
namespace OpenSim.Grid.ScriptServer
|
namespace OpenSim.Grid.ScriptServer
|
||||||
{
|
{
|
||||||
class RemotingServer
|
internal class RemotingServer
|
||||||
{
|
{
|
||||||
TcpChannel channel;
|
private readonly TcpChannel channel;
|
||||||
|
|
||||||
public RemotingServer(int port, string instanceName)
|
public RemotingServer(int port, string instanceName)
|
||||||
{
|
{
|
||||||
// Create an instance of a channel
|
// Create an instance of a channel
|
||||||
|
@ -42,9 +43,9 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
|
|
||||||
// Register as an available service with the name HelloWorld
|
// Register as an available service with the name HelloWorld
|
||||||
RemotingConfiguration.RegisterWellKnownServiceType(
|
RemotingConfiguration.RegisterWellKnownServiceType(
|
||||||
typeof(RemotingObject),
|
typeof (RemotingObject),
|
||||||
instanceName,
|
instanceName,
|
||||||
WellKnownObjectMode.Singleton);
|
WellKnownObjectMode.Singleton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,8 +32,13 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
|
||||||
// These are events that the region needs to have
|
// These are events that the region needs to have
|
||||||
|
|
||||||
// TEMP: Using System.Delegate -- needs replacing with a real delegate
|
// TEMP: Using System.Delegate -- needs replacing with a real delegate
|
||||||
|
|
||||||
|
#region Delegates
|
||||||
|
|
||||||
public delegate void DefaultDelegate();
|
public delegate void DefaultDelegate();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public event DefaultDelegate onScriptRez;
|
public event DefaultDelegate onScriptRez;
|
||||||
public event DefaultDelegate onstate_entry;
|
public event DefaultDelegate onstate_entry;
|
||||||
public event DefaultDelegate onstate_exit;
|
public event DefaultDelegate onstate_exit;
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
|
||||||
{
|
{
|
||||||
public class RegionConnectionManager : RegionBase
|
public class RegionConnectionManager : RegionBase
|
||||||
{
|
{
|
||||||
private ScriptServerMain m_ScriptServerMain;
|
|
||||||
private object m_Connection;
|
private object m_Connection;
|
||||||
|
private ScriptServerMain m_ScriptServerMain;
|
||||||
|
|
||||||
public RegionConnectionManager(ScriptServerMain scm, object Connection)
|
public RegionConnectionManager(ScriptServerMain scm, object Connection)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,12 +34,10 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
{
|
{
|
||||||
internal class RegionCommManager
|
internal class RegionCommManager
|
||||||
{
|
{
|
||||||
|
private readonly ScriptServerMain m_ScriptServerMain;
|
||||||
|
private readonly List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
|
||||||
private Thread listenThread;
|
private Thread listenThread;
|
||||||
|
|
||||||
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
|
|
||||||
|
|
||||||
private ScriptServerMain m_ScriptServerMain;
|
|
||||||
|
|
||||||
public RegionCommManager(ScriptServerMain scm)
|
public RegionCommManager(ScriptServerMain scm)
|
||||||
{
|
{
|
||||||
m_ScriptServerMain = scm;
|
m_ScriptServerMain = scm;
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
{
|
{
|
||||||
m_log.Error("[ScriptEngine]: " +
|
m_log.Error("[ScriptEngine]: " +
|
||||||
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
|
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
|
||||||
e.StackTrace.ToString());
|
e.StackTrace);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
ScriptServerInterfaces.ScriptEngine ret;
|
ScriptServerInterfaces.ScriptEngine ret;
|
||||||
//try
|
//try
|
||||||
//{
|
//{
|
||||||
ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t);
|
ret = (ScriptServerInterfaces.ScriptEngine) Activator.CreateInstance(t);
|
||||||
//}
|
//}
|
||||||
//catch (Exception e)
|
//catch (Exception e)
|
||||||
//{
|
//{
|
||||||
|
@ -114,4 +114,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,8 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
{
|
{
|
||||||
internal class ScriptEngineManager
|
internal class ScriptEngineManager
|
||||||
{
|
{
|
||||||
private ScriptEngineLoader ScriptEngineLoader;
|
private readonly ScriptEngineLoader ScriptEngineLoader;
|
||||||
private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
|
private readonly List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
|
||||||
private ScriptServerMain m_ScriptServerMain;
|
private ScriptServerMain m_ScriptServerMain;
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
|
@ -58,4 +58,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
return sei;
|
return sei;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,20 +44,20 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
//
|
//
|
||||||
// Root object. Creates objects used.
|
// Root object. Creates objects used.
|
||||||
//
|
//
|
||||||
private int listenPort = 8010;
|
|
||||||
|
|
||||||
// TEMP
|
// TEMP
|
||||||
public static ScriptServerInterfaces.ScriptEngine Engine;
|
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);
|
//public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false);
|
||||||
|
|
||||||
// Objects we use
|
// Objects we use
|
||||||
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
|
|
||||||
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
|
|
||||||
//internal RemotingServer m_RemotingServer;
|
//internal RemotingServer m_RemotingServer;
|
||||||
internal TCPServer m_TCPServer;
|
internal TCPServer m_TCPServer;
|
||||||
|
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
|
||||||
internal TRPC_Remote RPC;
|
internal TRPC_Remote RPC;
|
||||||
|
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
|
||||||
|
|
||||||
public ScriptServerMain()
|
public ScriptServerMain()
|
||||||
{
|
{
|
||||||
m_console = CreateConsole();
|
m_console = CreateConsole();
|
||||||
|
|
||||||
|
@ -68,13 +68,13 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
Engine = ScriptEngines.LoadEngine("DotNetEngine");
|
Engine = ScriptEngines.LoadEngine("DotNetEngine");
|
||||||
|
|
||||||
Engine.InitializeEngine(null, null, false, Engine.GetScriptManager());
|
Engine.InitializeEngine(null, null, false, Engine.GetScriptManager());
|
||||||
|
|
||||||
|
|
||||||
// Set up server
|
// Set up server
|
||||||
//m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
|
//m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
|
||||||
m_TCPServer = new TCPServer(listenPort);
|
m_TCPServer = new TCPServer(listenPort);
|
||||||
RPC = new TRPC_Remote(m_TCPServer);
|
RPC = new TRPC_Remote(m_TCPServer);
|
||||||
RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
|
RPC.ReceiveCommand += RPC_ReceiveCommand;
|
||||||
m_TCPServer.StartListen();
|
m_TCPServer.StartListen();
|
||||||
|
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
|
@ -93,7 +93,7 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
|
|
||||||
if (Command == "OnRezScript")
|
if (Command == "OnRezScript")
|
||||||
{
|
{
|
||||||
Engine.EventManager().OnRezScript((uint)p[0], new LLUUID((string)p[1]), (string)p[2]);
|
Engine.EventManager().OnRezScript((uint) p[0], new LLUUID((string) p[1]), (string) p[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,4 +106,4 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
return new ConsoleBase("ScriptServer", this);
|
return new ConsoleBase("ScriptServer", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -48,13 +48,62 @@ namespace OpenSim.Grid.UserServer
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private UserConfig Cfg;
|
private UserConfig Cfg;
|
||||||
|
|
||||||
public UserManager m_userManager;
|
|
||||||
public UserLoginService m_loginService;
|
|
||||||
public MessageServersConnector m_messagesService;
|
|
||||||
|
|
||||||
private LLUUID m_lastCreatedUser = LLUUID.Random();
|
private LLUUID m_lastCreatedUser = LLUUID.Random();
|
||||||
|
|
||||||
|
public UserLoginService m_loginService;
|
||||||
|
public MessageServersConnector m_messagesService;
|
||||||
|
public UserManager m_userManager;
|
||||||
|
|
||||||
|
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]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -68,12 +117,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
userserver.Work();
|
userserver.Work();
|
||||||
}
|
}
|
||||||
|
|
||||||
private OpenUser_Main()
|
|
||||||
{
|
|
||||||
m_console = new ConsoleBase("OpenUser", this);
|
|
||||||
MainConsole.Instance = m_console;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Work()
|
private void Work()
|
||||||
{
|
{
|
||||||
m_console.Notice("Enter help for a list of commands\n");
|
m_console.Notice("Enter help for a list of commands\n");
|
||||||
|
@ -87,16 +130,16 @@ namespace OpenSim.Grid.UserServer
|
||||||
public void Startup()
|
public void Startup()
|
||||||
{
|
{
|
||||||
Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
||||||
|
|
||||||
StatsManager.StartCollectingUserStats();
|
StatsManager.StartCollectingUserStats();
|
||||||
|
|
||||||
m_log.Info("[REGION]: Establishing data connection");
|
m_log.Info("[REGION]: Establishing data connection");
|
||||||
m_userManager = new UserManager();
|
m_userManager = new UserManager();
|
||||||
m_userManager._config = Cfg;
|
m_userManager._config = Cfg;
|
||||||
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
||||||
|
|
||||||
m_loginService = new UserLoginService(
|
m_loginService = new UserLoginService(
|
||||||
m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
||||||
|
|
||||||
m_messagesService = new MessageServersConnector();
|
m_messagesService = new MessageServersConnector();
|
||||||
|
|
||||||
|
@ -104,7 +147,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
|
m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
|
||||||
|
|
||||||
m_log.Info("[REGION]: Starting HTTP process");
|
m_log.Info("[REGION]: Starting HTTP process");
|
||||||
|
|
||||||
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
|
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
|
||||||
AddHttpHandlers();
|
AddHttpHandlers();
|
||||||
m_httpServer.Start();
|
m_httpServer.Start();
|
||||||
|
@ -117,7 +160,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
||||||
|
|
||||||
m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
|
m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
|
||||||
|
|
||||||
m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
||||||
|
|
||||||
m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
||||||
|
@ -128,7 +171,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
|
m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
|
||||||
m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
|
m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
|
||||||
m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
|
m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
|
||||||
|
|
||||||
// Message Server ---> User Server
|
// Message Server ---> User Server
|
||||||
m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
||||||
m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
|
m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
|
||||||
|
@ -163,17 +206,17 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
|
"[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
|
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
|
||||||
|
|
||||||
LLUUID userID = new LLUUID();
|
LLUUID userID = new LLUUID();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
|
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
|
||||||
|
@ -181,76 +224,35 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool created
|
bool created
|
||||||
= SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
= SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
||||||
"POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
|
"POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
|
||||||
|
|
||||||
if (!created)
|
if (!created)
|
||||||
{
|
{
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
String.Format(
|
String.Format(
|
||||||
"The inventory creation request for user {0} did not succeed."
|
"The inventory creation request for user {0} did not succeed."
|
||||||
+ " Please contact your inventory service provider for more information.",
|
+ " Please contact your inventory service provider for more information.",
|
||||||
userID));
|
userID));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
|
"[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
|
||||||
m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
|
m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
|
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastCreatedUser = userID;
|
m_lastCreatedUser = userID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
public void TestResponse(List<InventoryFolderBase> resp)
|
||||||
{
|
{
|
||||||
m_console.Notice("response got");
|
m_console.Notice("response got");
|
||||||
|
@ -262,12 +264,11 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
||||||
ulong regionhandle, float positionX, float positionY,
|
ulong regionhandle, float positionX, float positionY,
|
||||||
float positionZ, string firstname, string lastname)
|
float positionZ, string firstname, string lastname)
|
||||||
{
|
{
|
||||||
|
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
|
||||||
m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX,
|
positionY, positionZ, firstname, lastname);
|
||||||
positionY, positionZ, firstname, lastname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,12 +41,12 @@ namespace OpenSim.Grid.UserServer
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public Dictionary<string, MessageServerInfo> MessageServers;
|
public Dictionary<string, MessageServerInfo> MessageServers;
|
||||||
|
|
||||||
public MessageServersConnector()
|
public MessageServersConnector()
|
||||||
{
|
{
|
||||||
MessageServers = new Dictionary<string, MessageServerInfo>();
|
MessageServers = new Dictionary<string, MessageServerInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterMessageServer(string URI, MessageServerInfo serverData)
|
public void RegisterMessageServer(string URI, MessageServerInfo serverData)
|
||||||
{
|
{
|
||||||
lock (MessageServers)
|
lock (MessageServers)
|
||||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
MessageServers.Add(URI, serverData);
|
MessageServers.Add(URI, serverData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeRegisterMessageServer(string URI)
|
public void DeRegisterMessageServer(string URI)
|
||||||
{
|
{
|
||||||
lock (MessageServers)
|
lock (MessageServers)
|
||||||
|
@ -64,7 +64,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
MessageServers.Remove(URI);
|
MessageServers.Remove(URI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddResponsibleRegion(string URI, ulong regionhandle)
|
public void AddResponsibleRegion(string URI, ulong regionhandle)
|
||||||
{
|
{
|
||||||
if (!MessageServers.ContainsKey(URI))
|
if (!MessageServers.ContainsKey(URI))
|
||||||
|
@ -76,8 +76,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
MessageServerInfo msginfo = MessageServers["URI"];
|
MessageServerInfo msginfo = MessageServers["URI"];
|
||||||
msginfo.responsibleForRegions.Add(regionhandle);
|
msginfo.responsibleForRegions.Add(regionhandle);
|
||||||
MessageServers["URI"] = msginfo;
|
MessageServers["URI"] = msginfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveResponsibleRegion(string URI, ulong regionhandle)
|
public void RemoveResponsibleRegion(string URI, ulong regionhandle)
|
||||||
{
|
{
|
||||||
if (!MessageServers.ContainsKey(URI))
|
if (!MessageServers.ContainsKey(URI))
|
||||||
|
@ -92,20 +93,20 @@ namespace OpenSim.Grid.UserServer
|
||||||
msginfo.responsibleForRegions.Remove(regionhandle);
|
msginfo.responsibleForRegions.Remove(regionhandle);
|
||||||
MessageServers["URI"] = msginfo;
|
MessageServers["URI"] = msginfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
if (requestData.Contains("uri"))
|
if (requestData.Contains("uri"))
|
||||||
{
|
{
|
||||||
string URI = (string)requestData["uri"];
|
string URI = (string) requestData["uri"];
|
||||||
string sendkey=(string)requestData["sendkey"];
|
string sendkey = (string) requestData["sendkey"];
|
||||||
string recvkey=(string)requestData["recvkey"];
|
string recvkey = (string) requestData["recvkey"];
|
||||||
MessageServerInfo m = new MessageServerInfo();
|
MessageServerInfo m = new MessageServerInfo();
|
||||||
m.URI = URI;
|
m.URI = URI;
|
||||||
m.sendkey = sendkey;
|
m.sendkey = sendkey;
|
||||||
|
@ -116,15 +117,16 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
if (requestData.Contains("uri"))
|
if (requestData.Contains("uri"))
|
||||||
{
|
{
|
||||||
string URI = (string)requestData["uri"];
|
string URI = (string) requestData["uri"];
|
||||||
|
|
||||||
DeRegisterMessageServer(URI);
|
DeRegisterMessageServer(URI);
|
||||||
responseData["responsestring"] = "TRUE";
|
responseData["responsestring"] = "TRUE";
|
||||||
|
@ -132,23 +134,24 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
if (requestData.Contains("fromuri"))
|
if (requestData.Contains("fromuri"))
|
||||||
{
|
{
|
||||||
string sURI = (string)requestData["fromuri"];
|
string sURI = (string) requestData["fromuri"];
|
||||||
string sagentID = (string)requestData["agentid"];
|
string sagentID = (string) requestData["agentid"];
|
||||||
string ssessionID = (string)requestData["sessionid"];
|
string ssessionID = (string) requestData["sessionid"];
|
||||||
string scurrentRegionID = (string)requestData["regionid"];
|
string scurrentRegionID = (string) requestData["regionid"];
|
||||||
string sregionhandle = (string)requestData["regionhandle"];
|
string sregionhandle = (string) requestData["regionhandle"];
|
||||||
string scurrentpos = (string)requestData["currentpos"];
|
string scurrentpos = (string) requestData["currentpos"];
|
||||||
//LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
|
//LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
|
||||||
// TODO: Okay now raise event so the user server can pass this data to the Usermanager
|
// TODO: Okay now raise event so the user server can pass this data to the Usermanager
|
||||||
|
|
||||||
responseData["responsestring"] = "TRUE";
|
responseData["responsestring"] = "TRUE";
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +159,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
||||||
ulong regionhandle, float positionX, float positionY,
|
ulong regionhandle, float positionX, float positionY,
|
||||||
float positionZ, string firstname, string lastname)
|
float positionZ, string firstname, string lastname)
|
||||||
{
|
{
|
||||||
// Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D )
|
// Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D )
|
||||||
|
@ -173,8 +176,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
foreach (MessageServerInfo serv in MessageServers.Values)
|
foreach (MessageServerInfo serv in MessageServers.Values)
|
||||||
{
|
{
|
||||||
NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
|
NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
|
||||||
regionhandle, positionX, positionY, positionZ,
|
regionhandle, positionX, positionY, positionZ,
|
||||||
firstname, lastname);
|
firstname, lastname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,10 +194,10 @@ namespace OpenSim.Grid.UserServer
|
||||||
// {
|
// {
|
||||||
// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
|
// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
|
||||||
// }
|
// }
|
||||||
foreach (MessageServerInfo serv in MessageServers.Values)
|
foreach (MessageServerInfo serv in MessageServers.Values)
|
||||||
{
|
{
|
||||||
NotifyMessageServerAboutUserLogoff(serv,agentID);
|
NotifyMessageServerAboutUserLogoff(serv, agentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,10 +221,10 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
|
m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NotifyMessageServerAboutUser(MessageServerInfo serv,
|
private void NotifyMessageServerAboutUser(MessageServerInfo serv,
|
||||||
LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
||||||
ulong regionhandle, float positionX, float positionY, float positionZ,
|
ulong regionhandle, float positionX, float positionY, float positionZ,
|
||||||
string firstname, string lastname)
|
string firstname, string lastname)
|
||||||
{
|
{
|
||||||
Hashtable reqparams = new Hashtable();
|
Hashtable reqparams = new Hashtable();
|
||||||
reqparams["sendkey"] = serv.sendkey;
|
reqparams["sendkey"] = serv.sendkey;
|
||||||
|
@ -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");
|
m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
|
||||||
//
|
//
|
||||||
|
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
|
@ -41,26 +41,26 @@ using OpenSim.Framework.Servers;
|
||||||
namespace OpenSim.Grid.UserServer
|
namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
|
||||||
ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname);
|
ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname);
|
||||||
|
|
||||||
public class UserLoginService : LoginService
|
public class UserLoginService : LoginService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
|
private UserLoggedInAtLocation handlerUserLoggedInAtLocation;
|
||||||
|
|
||||||
private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
|
|
||||||
|
|
||||||
public UserConfig m_config;
|
public UserConfig m_config;
|
||||||
|
|
||||||
public UserLoginService(
|
public UserLoginService(
|
||||||
UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
|
UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
|
||||||
UserConfig config, string welcomeMess)
|
UserConfig config, string welcomeMess)
|
||||||
: base(userManager, libraryRootFolder, welcomeMess)
|
: base(userManager, libraryRootFolder, welcomeMess)
|
||||||
{
|
{
|
||||||
m_config = config;
|
m_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Customises the login response and fills in missing values.
|
/// Customises the login response and fills in missing values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -95,7 +95,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
|
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")
|
if (startLocationRequestParsed[0] == "last")
|
||||||
{
|
{
|
||||||
// TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
|
// TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
|
||||||
|
@ -108,9 +109,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
|
m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
|
||||||
SimInfo =
|
SimInfo =
|
||||||
RegionProfileData.RequestSimProfileData(
|
RegionProfileData.RequestSimProfileData(
|
||||||
startLocationRequestParsed[0], m_config.GridServerURL,
|
startLocationRequestParsed[0], m_config.GridServerURL,
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
|
|
||||||
if (SimInfo == null)
|
if (SimInfo == null)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +120,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
RegionProfileData.RequestSimProfileData(
|
RegionProfileData.RequestSimProfileData(
|
||||||
theUser.HomeRegion, m_config.GridServerURL,
|
theUser.HomeRegion, m_config.GridServerURL,
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
start_x = Convert.ToInt32(startLocationRequestParsed[1]);
|
start_x = Convert.ToInt32(startLocationRequestParsed[1]);
|
||||||
start_y = Convert.ToInt32(startLocationRequestParsed[2]);
|
start_y = Convert.ToInt32(startLocationRequestParsed[2]);
|
||||||
start_z = Convert.ToInt32(startLocationRequestParsed[3]);
|
start_z = Convert.ToInt32(startLocationRequestParsed[3]);
|
||||||
|
@ -130,30 +133,30 @@ namespace OpenSim.Grid.UserServer
|
||||||
// Customise the response
|
// Customise the response
|
||||||
//CFK: This is redundant and the next message should always appear.
|
//CFK: This is redundant and the next message should always appear.
|
||||||
//CFK: m_log.Info("[LOGIN]: Home Location");
|
//CFK: m_log.Info("[LOGIN]: Home Location");
|
||||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
|
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
|
||||||
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
|
(SimInfo.regionLocY * Constants.RegionSize) + "], " +
|
||||||
"'position':[r" + theUser.HomeLocation.X.ToString() + ",r" +
|
"'position':[r" + theUser.HomeLocation.X + ",r" +
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " +
|
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
|
||||||
"'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" +
|
"'look_at':[r" + theUser.HomeLocation.X + ",r" +
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}";
|
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
|
||||||
|
|
||||||
// Destination
|
// Destination
|
||||||
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
|
//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: the next one for X & Y and comment this one.
|
||||||
//CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
|
//CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
|
||||||
//CFK: "; Region Y: " + SimInfo.regionLocY);
|
//CFK: "; Region Y: " + SimInfo.regionLocY);
|
||||||
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString();
|
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
|
||||||
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
|
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
|
||||||
response.RegionX = SimInfo.regionLocX;
|
response.RegionX = SimInfo.regionLocX;
|
||||||
response.RegionY = SimInfo.regionLocY;
|
response.RegionY = SimInfo.regionLocY;
|
||||||
|
|
||||||
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
|
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
string capsPath = Util.GetRandomCapsPath();
|
||||||
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
|
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[LOGIN]: Sending new CAPS seed url {0} to client {1}",
|
"[LOGIN]: Sending new CAPS seed url {0} to client {1}",
|
||||||
response.SeedCapability, response.AgentID);
|
response.SeedCapability, response.AgentID);
|
||||||
|
|
||||||
// Notify the target of an incoming user
|
// Notify the target of an incoming user
|
||||||
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
|
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
|
||||||
|
@ -163,7 +166,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
theUser.CurrentAgent.Region = SimInfo.UUID;
|
theUser.CurrentAgent.Region = SimInfo.UUID;
|
||||||
theUser.CurrentAgent.Handle = SimInfo.regionHandle;
|
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);
|
LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
|
||||||
theUser.CurrentAgent.Position = tmp_v;
|
theUser.CurrentAgent.Position = tmp_v;
|
||||||
}
|
}
|
||||||
|
@ -186,42 +190,43 @@ namespace OpenSim.Grid.UserServer
|
||||||
// Update agent with target sim
|
// Update agent with target sim
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection",
|
"[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection",
|
||||||
SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI);
|
SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI);
|
||||||
|
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||||
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
|
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
|
||||||
|
|
||||||
if (GridResp.IsFault)
|
if (GridResp.IsFault)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
|
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
|
||||||
SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
|
SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
|
||||||
}
|
}
|
||||||
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
||||||
if (handlerUserLoggedInAtLocation != null)
|
if (handlerUserLoggedInAtLocation != null)
|
||||||
{
|
{
|
||||||
//m_log.Info("[LOGIN]: Letting other objects know about login");
|
//m_log.Info("[LOGIN]: Letting other objects know about login");
|
||||||
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
|
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.FirstName,theUser.SurName);
|
theUser.CurrentAgent.Position.Z,
|
||||||
|
theUser.FirstName, theUser.SurName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
//catch (System.AccessViolationException)
|
//catch (System.AccessViolationException)
|
||||||
{
|
{
|
||||||
tryDefault = true;
|
tryDefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryDefault)
|
if (tryDefault)
|
||||||
{
|
{
|
||||||
// Send him to default region instead
|
// Send him to default region instead
|
||||||
// Load information from the gridserver
|
// Load information from the gridserver
|
||||||
|
|
||||||
ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize);
|
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong) m_config.DefaultY * Constants.RegionSize);
|
||||||
|
|
||||||
m_log.Warn(
|
m_log.Warn(
|
||||||
"[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString());
|
"[LOGIN]: Home region not available: sending to default " + defaultHandle);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -231,19 +236,19 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
// Customise the response
|
// Customise the response
|
||||||
m_log.Info("[LOGIN]: Home Location");
|
m_log.Info("[LOGIN]: Home Location");
|
||||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
|
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
|
||||||
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
|
(SimInfo.regionLocY * Constants.RegionSize) + "], " +
|
||||||
"'position':[r" + theUser.HomeLocation.X.ToString() + ",r" +
|
"'position':[r" + theUser.HomeLocation.X + ",r" +
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " +
|
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
|
||||||
"'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" +
|
"'look_at':[r" + theUser.HomeLocation.X + ",r" +
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}";
|
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
|
||||||
|
|
||||||
// Destination
|
// Destination
|
||||||
m_log.Info("[LOGIN]: " +
|
m_log.Info("[LOGIN]: " +
|
||||||
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
|
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
|
||||||
SimInfo.regionLocY);
|
SimInfo.regionLocY);
|
||||||
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString();
|
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
|
||||||
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
|
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
|
||||||
response.RegionX = SimInfo.regionLocX;
|
response.RegionX = SimInfo.regionLocX;
|
||||||
response.RegionY = SimInfo.regionLocY;
|
response.RegionY = SimInfo.regionLocY;
|
||||||
|
|
||||||
|
@ -283,15 +288,16 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
m_log.Info("[LOGIN]: Letting other objects know about login");
|
m_log.Info("[LOGIN]: Letting other objects know about login");
|
||||||
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
|
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.FirstName, theUser.SurName);
|
theUser.CurrentAgent.Position.Z,
|
||||||
|
theUser.FirstName, theUser.SurName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[LOGIN]: Default region also not available");
|
m_log.Warn("[LOGIN]: Default region also not available");
|
||||||
m_log.Warn("[LOGIN]: " + e.ToString());
|
m_log.Warn("[LOGIN]: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,8 +306,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
protected override InventoryData GetInventorySkeleton(LLUUID userID)
|
protected override InventoryData GetInventorySkeleton(LLUUID userID)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
|
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
|
||||||
m_config.InventoryUrl, userID);
|
m_config.InventoryUrl, userID);
|
||||||
|
|
||||||
List<InventoryFolderBase> folders
|
List<InventoryFolderBase> folders
|
||||||
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
||||||
|
@ -316,23 +322,23 @@ namespace OpenSim.Grid.UserServer
|
||||||
// tools are creating the user profile directly in the database without creating the inventory. At
|
// tools are creating the user profile directly in the database without creating the inventory. At
|
||||||
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
|
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
|
||||||
// exist.
|
// exist.
|
||||||
bool created =
|
bool created =
|
||||||
SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
||||||
"POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
|
"POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
|
||||||
|
|
||||||
if (!created)
|
if (!created)
|
||||||
{
|
{
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
String.Format(
|
String.Format(
|
||||||
"The inventory creation request for user {0} did not succeed."
|
"The inventory creation request for user {0} did not succeed."
|
||||||
+ " Please contact your inventory service provider for more information.",
|
+ " Please contact your inventory service provider for more information.",
|
||||||
userID));
|
userID));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
|
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
||||||
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
|
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
|
||||||
}
|
}
|
||||||
|
@ -342,11 +348,11 @@ namespace OpenSim.Grid.UserServer
|
||||||
LLUUID rootID = LLUUID.Zero;
|
LLUUID rootID = LLUUID.Zero;
|
||||||
ArrayList AgentInventoryArray = new ArrayList();
|
ArrayList AgentInventoryArray = new ArrayList();
|
||||||
Hashtable TempHash;
|
Hashtable TempHash;
|
||||||
|
|
||||||
foreach (InventoryFolderBase InvFolder in folders)
|
foreach (InventoryFolderBase InvFolder in folders)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
|
// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
|
||||||
|
|
||||||
if (InvFolder.ParentID == LLUUID.Zero)
|
if (InvFolder.ParentID == LLUUID.Zero)
|
||||||
{
|
{
|
||||||
rootID = InvFolder.ID;
|
rootID = InvFolder.ID;
|
||||||
|
@ -359,16 +365,16 @@ namespace OpenSim.Grid.UserServer
|
||||||
TempHash["folder_id"] = InvFolder.ID.ToString();
|
TempHash["folder_id"] = InvFolder.ID.ToString();
|
||||||
AgentInventoryArray.Add(TempHash);
|
AgentInventoryArray.Add(TempHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new InventoryData(AgentInventoryArray, rootID);
|
return new InventoryData(AgentInventoryArray, rootID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
String.Format(
|
String.Format(
|
||||||
"A root inventory folder for user {0} could not be retrieved from the inventory service",
|
"A root inventory folder for user {0} could not be retrieved from the inventory service",
|
||||||
userID));
|
userID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,11 +41,11 @@ namespace OpenSim.Grid.UserServer
|
||||||
public delegate void logOffUser(LLUUID AgentID);
|
public delegate void logOffUser(LLUUID AgentID);
|
||||||
|
|
||||||
public class UserManager : UserManagerBase
|
public class UserManager : UserManagerBase
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private logOffUser handlerLogOffUser;
|
||||||
public event logOffUser OnLogOffUser;
|
public event logOffUser OnLogOffUser;
|
||||||
private logOffUser handlerLogOffUser = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes an active agent session
|
/// Deletes an active agent session
|
||||||
|
@ -81,17 +81,17 @@ namespace OpenSim.Grid.UserServer
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
// Query Result Information
|
// Query Result Information
|
||||||
responseData["queryid"] = (string) queryID.ToString();
|
responseData["queryid"] = queryID.ToString();
|
||||||
responseData["avcount"] = (string) returnUsers.Count.ToString();
|
responseData["avcount"] = returnUsers.Count.ToString();
|
||||||
|
|
||||||
for (int i = 0; i < returnUsers.Count; i++)
|
for (int i = 0; i < returnUsers.Count; i++)
|
||||||
{
|
{
|
||||||
responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString();
|
responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
|
||||||
responseData["firstname" + i.ToString()] = returnUsers[i].firstName;
|
responseData["firstname" + i] = returnUsers[i].firstName;
|
||||||
responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
|
responseData["lastname" + i] = returnUsers[i].lastName;
|
||||||
}
|
}
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,14 +101,14 @@ namespace OpenSim.Grid.UserServer
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
// Query Result Information
|
// Query Result Information
|
||||||
|
|
||||||
responseData["avcount"] = (string)returnUsers.Count.ToString();
|
responseData["avcount"] = returnUsers.Count.ToString();
|
||||||
|
|
||||||
for (int i = 0; i < returnUsers.Count; i++)
|
for (int i = 0; i < returnUsers.Count; i++)
|
||||||
{
|
{
|
||||||
responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
|
responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString();
|
||||||
responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
|
responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString();
|
||||||
responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
|
responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
|
||||||
responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
|
responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
|
||||||
}
|
}
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
|
@ -156,6 +156,21 @@ namespace OpenSim.Grid.UserServer
|
||||||
return response;
|
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
|
#region XMLRPC User Methods
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
|
||||||
|
@ -178,15 +193,16 @@ namespace OpenSim.Grid.UserServer
|
||||||
public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
string returnString = "FALSE";
|
string returnString = "FALSE";
|
||||||
// Query Result Information
|
// Query Result Information
|
||||||
|
|
||||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
|
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
|
||||||
{
|
{
|
||||||
// UserManagerBase.AddNewuserFriend
|
// 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";
|
returnString = "TRUE";
|
||||||
}
|
}
|
||||||
responseData["returnString"] = returnString;
|
responseData["returnString"] = returnString;
|
||||||
|
@ -197,15 +213,15 @@ namespace OpenSim.Grid.UserServer
|
||||||
public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
string returnString = "FALSE";
|
string returnString = "FALSE";
|
||||||
// Query Result Information
|
// Query Result Information
|
||||||
|
|
||||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
|
if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
|
||||||
{
|
{
|
||||||
// UserManagerBase.AddNewuserFriend
|
// UserManagerBase.AddNewuserFriend
|
||||||
RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]));
|
RemoveUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]));
|
||||||
returnString = "TRUE";
|
returnString = "TRUE";
|
||||||
}
|
}
|
||||||
responseData["returnString"] = returnString;
|
responseData["returnString"] = returnString;
|
||||||
|
@ -216,13 +232,14 @@ namespace OpenSim.Grid.UserServer
|
||||||
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
string returnString = "FALSE";
|
string returnString = "FALSE";
|
||||||
|
|
||||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
|
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.
|
// UserManagerBase.
|
||||||
returnString = "TRUE";
|
returnString = "TRUE";
|
||||||
}
|
}
|
||||||
|
@ -234,16 +251,16 @@ namespace OpenSim.Grid.UserServer
|
||||||
public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
List<FriendListItem> returndata = new List<FriendListItem>();
|
List<FriendListItem> returndata = new List<FriendListItem>();
|
||||||
|
|
||||||
if (requestData.Contains("ownerID"))
|
if (requestData.Contains("ownerID"))
|
||||||
{
|
{
|
||||||
returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
|
returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return FriendListItemListtoXmlRPCResponse(returndata);
|
return FriendListItemListtoXmlRPCResponse(returndata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +338,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
m_log.Debug("[UserManager]: Got request to update user profile");
|
m_log.Debug("[UserManager]: Got request to update user profile");
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
UserProfileData userProfile;
|
UserProfileData userProfile;
|
||||||
|
@ -330,7 +347,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
return CreateUnknownUserErrorResponse();
|
return CreateUnknownUserErrorResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]);
|
LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]);
|
||||||
userProfile = GetUserProfile(UserUUID);
|
userProfile = GetUserProfile(UserUUID);
|
||||||
if (null == userProfile)
|
if (null == userProfile)
|
||||||
{
|
{
|
||||||
|
@ -342,33 +359,33 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
if (requestData.Contains("FLImageID"))
|
if (requestData.Contains("FLImageID"))
|
||||||
{
|
{
|
||||||
userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]);
|
userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]);
|
||||||
}
|
}
|
||||||
if (requestData.Contains("ImageID"))
|
if (requestData.Contains("ImageID"))
|
||||||
{
|
{
|
||||||
userProfile.Image = new LLUUID((string)requestData["ImageID"]);
|
userProfile.Image = new LLUUID((string) requestData["ImageID"]);
|
||||||
}
|
}
|
||||||
// dont' know how yet
|
// dont' know how yet
|
||||||
if (requestData.Contains("MaturePublish"))
|
if (requestData.Contains("MaturePublish"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if (requestData.Contains("AboutText"))
|
if (requestData.Contains("AboutText"))
|
||||||
{
|
{
|
||||||
userProfile.AboutText = (string)requestData["AboutText"];
|
userProfile.AboutText = (string) requestData["AboutText"];
|
||||||
}
|
}
|
||||||
if (requestData.Contains("FLAboutText"))
|
if (requestData.Contains("FLAboutText"))
|
||||||
{
|
{
|
||||||
userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"];
|
userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"];
|
||||||
}
|
}
|
||||||
// not in DB yet.
|
// not in DB yet.
|
||||||
if (requestData.Contains("ProfileURL"))
|
if (requestData.Contains("ProfileURL"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if (requestData.Contains("home_region"))
|
if (requestData.Contains("home_region"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
|
userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]);
|
||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
|
@ -382,25 +399,23 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
|
m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (requestData.Contains("home_pos_x"))
|
if (requestData.Contains("home_pos_x"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
|
userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
m_log.Error("[PROFILE]:Failed to set home postion x");
|
m_log.Error("[PROFILE]:Failed to set home postion x");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (requestData.Contains("home_pos_y"))
|
if (requestData.Contains("home_pos_y"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
|
userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +426,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
|
userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
|
@ -422,7 +437,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
|
userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
|
@ -433,7 +448,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
|
userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
|
@ -442,9 +457,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
if (requestData.Contains("home_look_z"))
|
if (requestData.Contains("home_look_z"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
|
userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
|
@ -461,18 +476,18 @@ namespace OpenSim.Grid.UserServer
|
||||||
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
if (requestData.Contains("avatar_uuid"))
|
if (requestData.Contains("avatar_uuid"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]);
|
LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]);
|
||||||
LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]);
|
LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]);
|
||||||
ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
|
ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]);
|
||||||
float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
|
float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]);
|
||||||
float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
|
float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]);
|
||||||
float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
|
float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]);
|
||||||
|
|
||||||
handlerLogOffUser = OnLogOffUser;
|
handlerLogOffUser = OnLogOffUser;
|
||||||
if (handlerLogOffUser != null)
|
if (handlerLogOffUser != null)
|
||||||
|
@ -495,20 +510,5 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,12 +52,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
public class LoadBalancerPlugin : IApplicationPlugin
|
public class LoadBalancerPlugin : IApplicationPlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
private readonly object padlock = new object();
|
||||||
|
|
||||||
private BaseHttpServer commandServer;
|
private BaseHttpServer commandServer;
|
||||||
private bool[] isLocalNeighbour;
|
private bool[] isLocalNeighbour;
|
||||||
private bool isSplit = false;
|
private bool isSplit;
|
||||||
private TcpServer mTcpServer;
|
private TcpServer mTcpServer;
|
||||||
private object padlock = new object();
|
|
||||||
|
|
||||||
private int proxyOffset;
|
private int proxyOffset;
|
||||||
private string proxyURL;
|
private string proxyURL;
|
||||||
|
@ -80,8 +80,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
if (proxyURL.Length == 0) return;
|
if (proxyURL.Length == 0) return;
|
||||||
|
|
||||||
StartTcpServer();
|
StartTcpServer();
|
||||||
ClientView.SynchronizeClient = new ClientView.SynchronizeClientHandler(SynchronizePackets);
|
ClientView.SynchronizeClient = SynchronizePackets;
|
||||||
AsynchronousSocketListener.PacketHandler = new AsynchronousSocketListener.PacketRecieveHandler(SynchronizePacketRecieve);
|
AsynchronousSocketListener.PacketHandler = SynchronizePacketRecieve;
|
||||||
|
|
||||||
sceneManager = openSim.SceneManager;
|
sceneManager = openSim.SceneManager;
|
||||||
udpServers = openSim.UdpServers;
|
udpServers = openSim.UdpServers;
|
||||||
|
@ -146,7 +146,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
{
|
{
|
||||||
ClientView client = (ClientView) pre.ControllingClient;
|
ClientView client = (ClientView) pre.ControllingClient;
|
||||||
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
|
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
|
||||||
if (client.PacketProcessingEnabled == true)
|
if (client.PacketProcessingEnabled)
|
||||||
{
|
{
|
||||||
get_scene_presence_filter++;
|
get_scene_presence_filter++;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
{
|
{
|
||||||
ClientView client = (ClientView) pre.ControllingClient;
|
ClientView client = (ClientView) pre.ControllingClient;
|
||||||
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
|
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
|
||||||
if (client.PacketProcessingEnabled == true)
|
if (client.PacketProcessingEnabled)
|
||||||
{
|
{
|
||||||
get_avatar_filter++;
|
get_avatar_filter++;
|
||||||
avatar_names += pre.Firstname + " " + pre.Lastname + "; ";
|
avatar_names += pre.Firstname + " " + pre.Lastname + "; ";
|
||||||
|
@ -178,7 +178,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
@ -199,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -264,14 +264,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
int src_port = (int) request.Params[0];
|
int src_port = (int) request.Params[0];
|
||||||
|
|
||||||
// backgroud
|
// backgroud
|
||||||
WaitCallback callback = new WaitCallback(TerminateRegion);
|
WaitCallback callback = TerminateRegion;
|
||||||
ThreadPool.QueueUserWorkItem(callback, src_port);
|
ThreadPool.QueueUserWorkItem(callback, src_port);
|
||||||
|
|
||||||
m_log.Info("[BALANCER] " + "Exiting TerminateRegion()");
|
m_log.Info("[BALANCER] " + "Exiting TerminateRegion()");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,8 +330,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
dst_region = DeserializeRegion(dst_port, false, serializeDir);
|
dst_region = DeserializeRegion(dst_port, false, serializeDir);
|
||||||
|
|
||||||
// Decide who is in charge for each section
|
// Decide who is in charge for each section
|
||||||
int[] port = new int[] {src_port, dst_port};
|
int[] port = new[] {src_port, dst_port};
|
||||||
string[] url = new string[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.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]);
|
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
|
// Enable the proxy
|
||||||
|
@ -424,7 +424,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
// serialization of region data
|
// serialization of region data
|
||||||
SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region);
|
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);
|
Util.SerializeToFile(filename, dst_region);
|
||||||
|
|
||||||
// backup current scene's entities
|
// backup current scene's entities
|
||||||
|
@ -451,7 +451,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
{
|
{
|
||||||
ClientInfo info = controller.GetClientInfo();
|
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);
|
Util.SerializeToFile(filename, info);
|
||||||
|
|
||||||
|
@ -469,13 +469,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
|
|
||||||
private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir)
|
private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir)
|
||||||
{
|
{
|
||||||
string[] files = null;
|
|
||||||
RegionInfo dst_region = null;
|
RegionInfo dst_region = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// deserialization of region data
|
// deserialization of region data
|
||||||
files = Directory.GetFiles(import_dir, "RegionInfo_*.bin");
|
string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin");
|
||||||
|
|
||||||
foreach (string filename in files)
|
foreach (string filename in files)
|
||||||
{
|
{
|
||||||
|
@ -503,7 +502,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -593,7 +592,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
|
|
||||||
// change RegionInfo (memory only)
|
// change RegionInfo (memory only)
|
||||||
dst_region.InternalEndPoint.Port = dst_port;
|
dst_region.InternalEndPoint.Port = dst_port;
|
||||||
dst_region.ExternalHostName = proxyURL.Split(new char[] {'/', ':'})[3];
|
dst_region.ExternalHostName = proxyURL.Split(new[] {'/', ':'})[3];
|
||||||
|
|
||||||
// Create new region
|
// Create new region
|
||||||
simMain.CreateRegion(dst_region, false);
|
simMain.CreateRegion(dst_region, false);
|
||||||
|
@ -695,7 +694,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
|
|
||||||
for (int i = 0; i < numRegions; i++)
|
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);
|
m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname);
|
||||||
tcpClientList[i] = new TcpClient(hostname, 10001);
|
tcpClientList[i] = new TcpClient(hostname, 10001);
|
||||||
}
|
}
|
||||||
|
@ -731,12 +730,11 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
List<uint> circuits = scene.ClientManager.GetAllCircuitCodes();
|
List<uint> circuits = scene.ClientManager.GetAllCircuitCodes();
|
||||||
circuits.Sort();
|
circuits.Sort();
|
||||||
|
|
||||||
IClientAPI controller = null;
|
|
||||||
|
|
||||||
foreach (uint code in circuits)
|
foreach (uint code in circuits)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code);
|
m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code);
|
||||||
|
|
||||||
|
IClientAPI controller;
|
||||||
if (scene.ClientManager.TryGetClient(code, out controller))
|
if (scene.ClientManager.TryGetClient(code, out controller))
|
||||||
{
|
{
|
||||||
// Divide the presences evenly over the set of subscenes
|
// Divide the presences evenly over the set of subscenes
|
||||||
|
@ -756,7 +754,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.splitID = myID;
|
scene.splitID = myID;
|
||||||
scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes);
|
scene.SynchronizeScene = SynchronizeScenes;
|
||||||
isSplit = true;
|
isSplit = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -766,7 +764,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[SPLITSCENE] " + e.ToString());
|
m_log.Error("[SPLITSCENE] " + e);
|
||||||
m_log.Error("[SPLITSCENE] " + e.StackTrace);
|
m_log.Error("[SPLITSCENE] " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +818,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[BALANCER] " + e.ToString());
|
m_log.Error("[BALANCER] " + e);
|
||||||
m_log.Error("[BALANCER] " + e.StackTrace);
|
m_log.Error("[BALANCER] " + e.StackTrace);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -893,7 +891,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
// Because data changes by the physics simulation when the client doesn't move,
|
// Because data changes by the physics simulation when the client doesn't move,
|
||||||
// if MovementFlag is false, It is necessary to synchronize.
|
// if MovementFlag is false, It is necessary to synchronize.
|
||||||
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true)
|
//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));
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((ClientView) pre.ControllingClient).PacketProcessingEnabled == true)
|
if (((ClientView) pre.ControllingClient).PacketProcessingEnabled)
|
||||||
{
|
{
|
||||||
pre.ControllingClient.OutPacket(packet, throttlePacketType);
|
pre.ControllingClient.OutPacket(packet, throttlePacketType);
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1058,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[SPLITSCENE] " + e.ToString());
|
m_log.Error("[SPLITSCENE] " + e);
|
||||||
m_log.Error("[SPLITSCENE] " + e.StackTrace);
|
m_log.Error("[SPLITSCENE] " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,7 +1070,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
LLUUID scenePresenceID = new LLUUID(header.agent_id);
|
LLUUID scenePresenceID = new LLUUID(header.agent_id);
|
||||||
LLVector3 position = new LLVector3(buff, 0);
|
LLVector3 position = new LLVector3(buff, 0);
|
||||||
LLVector3 velocity = new LLVector3(buff, 12);
|
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);
|
LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying);
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
{
|
{
|
||||||
public class AsynchronousClient
|
public class AsynchronousClient
|
||||||
{
|
{
|
||||||
private static ManualResetEvent connectDone = new ManualResetEvent(false);
|
private static readonly ManualResetEvent connectDone = new ManualResetEvent(false);
|
||||||
private static ManualResetEvent sendDone = new ManualResetEvent(false);
|
private static readonly ManualResetEvent sendDone = new ManualResetEvent(false);
|
||||||
|
|
||||||
public static Socket StartClient(string hostname, int port)
|
public static Socket StartClient(string hostname, int port)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
|
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
|
||||||
|
|
||||||
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client);
|
client.BeginConnect(remoteEP, ConnectCallback, client);
|
||||||
connectDone.WaitOne();
|
connectDone.WaitOne();
|
||||||
/*
|
/*
|
||||||
Send(client,"This is a test<EOF>");
|
Send(client,"This is a test<EOF>");
|
||||||
|
@ -71,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
{
|
{
|
||||||
Socket client = (Socket) ar.AsyncState;
|
Socket client = (Socket) ar.AsyncState;
|
||||||
client.EndConnect(ar);
|
client.EndConnect(ar);
|
||||||
Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString());
|
Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint);
|
||||||
connectDone.Set();
|
connectDone.Set();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -138,8 +138,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
|
|
||||||
public class InternalPacketHeader
|
public class InternalPacketHeader
|
||||||
{
|
{
|
||||||
|
private readonly byte[] buffer = new byte[32];
|
||||||
public Guid agent_id;
|
public Guid agent_id;
|
||||||
private byte[] buffer = new byte[32];
|
|
||||||
public int numbytes;
|
public int numbytes;
|
||||||
public int region_port;
|
public int region_port;
|
||||||
public int throttlePacketType;
|
public int throttlePacketType;
|
||||||
|
@ -150,16 +150,16 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
int i = 0; // offset
|
int i = 0; // offset
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
type = (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 = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
throttlePacketType = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
||||||
numbytes = (int) (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(
|
agent_id = new Guid(
|
||||||
bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24,
|
bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24,
|
||||||
(short) (bytes[i++] | (bytes[i++] << 8)),
|
(short) (bytes[i++] | (bytes[i++] << 8)),
|
||||||
(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++],
|
||||||
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)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -201,10 +201,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
public class TcpClient
|
public class TcpClient
|
||||||
{
|
{
|
||||||
public static int internalPacketHeaderSize = 4 * 4 + 16 * 1;
|
public static int internalPacketHeaderSize = 4 * 4 + 16 * 1;
|
||||||
private Socket mConnection;
|
|
||||||
|
|
||||||
private string mHostname;
|
private readonly string mHostname;
|
||||||
private int mPort;
|
private readonly int mPort;
|
||||||
|
private Socket mConnection;
|
||||||
|
|
||||||
public TcpClient(string hostname, int port)
|
public TcpClient(string hostname, int port)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,15 +37,15 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
{
|
{
|
||||||
public const int BufferSize = 2048;
|
public const int BufferSize = 2048;
|
||||||
public byte[] buffer = new byte[BufferSize];
|
public byte[] buffer = new byte[BufferSize];
|
||||||
public InternalPacketHeader header = null;
|
public InternalPacketHeader header;
|
||||||
public MemoryStream ms_ptr = new MemoryStream();
|
public MemoryStream ms_ptr = new MemoryStream();
|
||||||
public Socket workSocket = null;
|
public Socket workSocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AsynchronousSocketListener
|
public class AsynchronousSocketListener
|
||||||
{
|
{
|
||||||
public static ManualResetEvent allDone = new ManualResetEvent(false);
|
public static ManualResetEvent allDone = new ManualResetEvent(false);
|
||||||
public static string data = null;
|
public static string data;
|
||||||
|
|
||||||
#region KIRYU
|
#region KIRYU
|
||||||
|
|
||||||
|
@ -55,14 +55,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static PacketRecieveHandler PacketHandler = null;
|
public static PacketRecieveHandler PacketHandler;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public AsynchronousSocketListener()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void StartListening(int port)
|
public static void StartListening(int port)
|
||||||
{
|
{
|
||||||
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
|
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
|
||||||
|
@ -199,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
|
|
||||||
public class TcpServer
|
public class TcpServer
|
||||||
{
|
{
|
||||||
private int mPort = 11000;
|
private readonly int mPort = 11000;
|
||||||
|
|
||||||
public TcpServer()
|
public TcpServer()
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
|
||||||
string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", "");
|
string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", "");
|
||||||
if (proxyURL.Length == 0) return;
|
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 = new BaseHttpServer(port);
|
||||||
command_server.Start();
|
command_server.Start();
|
||||||
command_server.AddXmlRPCHandler("AddPort", AddPort);
|
command_server.AddXmlRPCHandler("AddPort", AddPort);
|
||||||
|
@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
|
||||||
{
|
{
|
||||||
m_log = log;
|
m_log = log;
|
||||||
running = false;
|
running = false;
|
||||||
receivedData = new AsyncCallback(OnReceivedData);
|
receivedData = OnReceivedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BlockClientMessages(string regionUrl, int regionPort)
|
public void BlockClientMessages(string regionUrl, int regionPort)
|
||||||
|
@ -452,7 +452,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
|
||||||
|
|
||||||
protected class ProxyMap
|
protected class ProxyMap
|
||||||
{
|
{
|
||||||
private Dictionary<EndPoint, RegionData> map;
|
private readonly Dictionary<EndPoint, RegionData> map;
|
||||||
|
|
||||||
public ProxyMap()
|
public ProxyMap()
|
||||||
{
|
{
|
||||||
|
@ -494,7 +494,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
|
||||||
|
|
||||||
public class RegionData
|
public class RegionData
|
||||||
{
|
{
|
||||||
public bool isBlocked = false;
|
public bool isBlocked;
|
||||||
public List<EndPoint> regions = new List<EndPoint>();
|
public List<EndPoint> regions = new List<EndPoint>();
|
||||||
public Queue storedMessages = new Queue();
|
public Queue storedMessages = new Queue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue