Merge branch 'master' of ssh://opensimulator.org/var/git/opensim into htb-throttle

prioritization
John Hurliman 2009-10-05 17:38:27 -07:00
commit 7ddb6fbced
34 changed files with 2142 additions and 1652 deletions

View File

@ -148,8 +148,8 @@ namespace OpenSim.Client.Linden
protected void AddHttpHandlers() protected void AddHttpHandlers()
{ {
//we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change? //we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change?
MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser); MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser, false);
MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser); MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser, false);
} }
protected void AddScene(Scene scene) protected void AddScene(Scene scene)

View File

@ -43,6 +43,7 @@ namespace OpenSim.Data.MSSQL
private List<string> m_ColumnNames = null; private List<string> m_ColumnNames = null;
private int m_LastExpire = 0; private int m_LastExpire = 0;
private string m_ConnectionString; private string m_ConnectionString;
private MSSQLManager m_database;
public MSSQLAuthenticationData(string connectionString, string realm) public MSSQLAuthenticationData(string connectionString, string realm)
{ {
@ -61,12 +62,12 @@ namespace OpenSim.Data.MSSQL
AuthenticationData ret = new AuthenticationData(); AuthenticationData ret = new AuthenticationData();
ret.Data = new Dictionary<string, object>(); ret.Data = new Dictionary<string, object>();
string sql = string.Format("select * from '{0}' where UUID = @principalID", m_Realm); string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm);
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.AddWithValue("@principalID", principalID.ToString()); cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
conn.Open(); conn.Open();
using (SqlDataReader result = cmd.ExecuteReader()) using (SqlDataReader result = cmd.ExecuteReader())
{ {
@ -108,34 +109,33 @@ namespace OpenSim.Data.MSSQL
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand()) using (SqlCommand cmd = new SqlCommand())
{ {
updateBuilder.AppendFormat("update '{0}' set ", m_Realm); updateBuilder.AppendFormat("update {0} set ", m_Realm);
bool first = true; bool first = true;
foreach (string field in fields) foreach (string field in fields)
{ {
if (!first) if (!first)
updateBuilder.Append(", "); updateBuilder.Append(", ");
updateBuilder.AppendFormat("'{0}' = @{0}",field); updateBuilder.AppendFormat("{0} = @{0}",field);
first = false; first = false;
cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field]));
cmd.Parameters.AddWithValue("@" + field, data.Data[field]);
} }
updateBuilder.Append(" where UUID = @principalID"); updateBuilder.Append(" where UUID = @principalID");
cmd.CommandText = updateBuilder.ToString(); cmd.CommandText = updateBuilder.ToString();
cmd.Connection = conn; cmd.Connection = conn;
cmd.Parameters.Add(m_database.CreateParameter("@principalID", data.PrincipalID));
cmd.Parameters.AddWithValue("@principalID", data.PrincipalID.ToString());
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() < 1) if (cmd.ExecuteNonQuery() < 1)
{ {
StringBuilder insertBuilder = new StringBuilder(); StringBuilder insertBuilder = new StringBuilder();
insertBuilder.AppendFormat("insert into '{0}' ('UUID', '", m_Realm); insertBuilder.AppendFormat("insert into {0} (UUID, ", m_Realm);
insertBuilder.Append(String.Join("', '", fields)); insertBuilder.Append(String.Join(", ", fields));
insertBuilder.Append("') values (@principalID, @"); insertBuilder.Append(") values ( @principalID, @");
insertBuilder.Append(String.Join(", @", fields)); insertBuilder.Append(String.Join(", @", fields));
insertBuilder.Append(")"); insertBuilder.Append(")");
@ -152,12 +152,11 @@ namespace OpenSim.Data.MSSQL
public bool SetDataItem(UUID principalID, string item, string value) public bool SetDataItem(UUID principalID, string item, string value)
{ {
string sql = string.Format("update '{0}' set '{1}' = @{1} where UUID = @UUID", m_Realm, item); string sql = string.Format("update {0} set {1} = @{1} where UUID = @UUID", m_Realm, item);
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.AddWithValue("@" + item, value); cmd.Parameters.Add(m_database.CreateParameter("@" + item, value));
cmd.Parameters.AddWithValue("@UUID", principalID.ToString());
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0)
return true; return true;
@ -173,9 +172,9 @@ namespace OpenSim.Data.MSSQL
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.AddWithValue("@principalID", principalID.ToString()); cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
cmd.Parameters.AddWithValue("@token", token); cmd.Parameters.Add(m_database.CreateParameter("@token", token));
cmd.Parameters.AddWithValue("@lifetime", lifetime.ToString()); cmd.Parameters.Add(m_database.CreateParameter("@lifetime", lifetime));
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0)
@ -194,9 +193,9 @@ namespace OpenSim.Data.MSSQL
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.AddWithValue("@principalID", principalID.ToString()); cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
cmd.Parameters.AddWithValue("@token", token); cmd.Parameters.Add(m_database.CreateParameter("@token", token));
cmd.Parameters.AddWithValue("@lifetime", lifetime.ToString()); cmd.Parameters.Add(m_database.CreateParameter("@lifetime", lifetime));
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -40,13 +40,15 @@ namespace OpenSim.Data.MSSQL
{ {
private string m_Realm; private string m_Realm;
private List<string> m_ColumnNames = null; private List<string> m_ColumnNames = null;
private int m_LastExpire = 0;
private string m_ConnectionString; private string m_ConnectionString;
private MSSQLManager m_database;
public MSSQLUserAccountData(string connectionString, string realm) public MSSQLUserAccountData(string connectionString, string realm)
{ {
m_Realm = realm; m_Realm = realm;
m_ConnectionString = connectionString; m_ConnectionString = connectionString;
m_database = new MSSQLManager(connectionString);
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
{ {
conn.Open(); conn.Open();
@ -65,16 +67,16 @@ namespace OpenSim.Data.MSSQL
UserAccountData ret = new UserAccountData(); UserAccountData ret = new UserAccountData();
ret.Data = new Dictionary<string, object>(); ret.Data = new Dictionary<string, object>();
string sql = string.Format("select * from '{0}' where UUID = @principalID", m_Realm); string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm);
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
sql += " and ScopeID = @scopeID"; sql += " and ScopeID = @scopeID";
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID));
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
cmd.Parameters.AddWithValue("@principalID", principalID);
cmd.Parameters.AddWithValue("@scopeID", scopeID);
conn.Open(); conn.Open();
using (SqlDataReader result = cmd.ExecuteReader()) using (SqlDataReader result = cmd.ExecuteReader())
{ {
@ -123,17 +125,16 @@ namespace OpenSim.Data.MSSQL
using (SqlCommand cmd = new SqlCommand()) using (SqlCommand cmd = new SqlCommand())
{ {
StringBuilder updateBuilder = new StringBuilder(); StringBuilder updateBuilder = new StringBuilder();
updateBuilder.AppendFormat("update '{0}' set ", m_Realm); updateBuilder.AppendFormat("update {0} set ", m_Realm);
bool first = true; bool first = true;
foreach (string field in fields) foreach (string field in fields)
{ {
if (!first) if (!first)
updateBuilder.Append(", "); updateBuilder.Append(", ");
updateBuilder.AppendFormat("'{0}' = @{0}", field); updateBuilder.AppendFormat("{0} = @{0}", field);
first = false; first = false;
cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field]));
cmd.Parameters.AddWithValue("@" + field, data.Data[field]);
} }
updateBuilder.Append(" where UUID = @principalID"); updateBuilder.Append(" where UUID = @principalID");
@ -143,16 +144,16 @@ namespace OpenSim.Data.MSSQL
cmd.CommandText = updateBuilder.ToString(); cmd.CommandText = updateBuilder.ToString();
cmd.Connection = conn; cmd.Connection = conn;
cmd.Parameters.AddWithValue("@principalID", data.PrincipalID); cmd.Parameters.Add(m_database.CreateParameter("@principalID", data.PrincipalID));
cmd.Parameters.AddWithValue("@scopeID", data.ScopeID); cmd.Parameters.Add(m_database.CreateParameter("@scopeID", data.ScopeID));
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() < 1) if (cmd.ExecuteNonQuery() < 1)
{ {
StringBuilder insertBuilder = new StringBuilder(); StringBuilder insertBuilder = new StringBuilder();
insertBuilder.AppendFormat("insert into '{0}' ('UUID', 'ScopeID', '", m_Realm); insertBuilder.AppendFormat("insert into {0} (UUID, ScopeID, ", m_Realm);
insertBuilder.Append(String.Join("', '", fields)); insertBuilder.Append(String.Join(", ", fields));
insertBuilder.Append("') values (@principalID, @scopeID, @"); insertBuilder.Append(") values ( @principalID, @scopeID, @");
insertBuilder.Append(String.Join(", @", fields)); insertBuilder.Append(String.Join(", @", fields));
insertBuilder.Append(")"); insertBuilder.Append(")");
@ -169,12 +170,13 @@ namespace OpenSim.Data.MSSQL
public bool SetDataItem(UUID principalID, string item, string value) public bool SetDataItem(UUID principalID, string item, string value)
{ {
string sql = string.Format("update '{0}' set '{1}' = @{1} where UUID = @UUID", m_Realm, item); string sql = string.Format("update {0} set {1} = @{1} where UUID = @UUID", m_Realm, item);
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.AddWithValue("@" + item, value); cmd.Parameters.Add(m_database.CreateParameter("@" + item, value));
cmd.Parameters.AddWithValue("@UUID", principalID); cmd.Parameters.Add(m_database.CreateParameter("@UUID", principalID));
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0)

View File

@ -0,0 +1,8 @@
BEGIN TRANSACTION
ALTER TABLE regions ADD scopeid uniqueidentifier default '00000000-0000-0000-0000-000000000000';
ALTER TABLE regions ADD DEFAULT ('00000000-0000-0000-0000-000000000000') FOR [owner_uuid];
ALTER TABLE regions ADD sizeX integer not null default 0;
ALTER TABLE regions ADD sizeY integer not null default 0;
COMMIT

View File

@ -82,12 +82,16 @@ namespace OpenSim.Data.MySQL
ret.Data[s] = result[s].ToString(); ret.Data[s] = result[s].ToString();
} }
CloseDBConnection(cmd);
return ret; return ret;
} }
else
{
CloseDBConnection(cmd);
return null;
}
} }
} }
return null;
} }
public bool Store(AuthenticationData data) public bool Store(AuthenticationData data)

View File

@ -47,7 +47,6 @@ namespace OpenSim.Data.MySQL
protected MySqlFramework(string connectionString) protected MySqlFramework(string connectionString)
{ {
m_Connection = new MySqlConnection(connectionString); m_Connection = new MySqlConnection(connectionString);
m_Connection.Open(); m_Connection.Open();
} }
@ -82,8 +81,7 @@ namespace OpenSim.Data.MySQL
errorSeen = true; errorSeen = true;
m_Connection.Close(); m_Connection.Close();
MySqlConnection newConnection = (MySqlConnection) MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
((ICloneable)m_Connection).Clone();
m_Connection.Dispose(); m_Connection.Dispose();
m_Connection = newConnection; m_Connection = newConnection;
m_Connection.Open(); m_Connection.Open();
@ -104,14 +102,16 @@ namespace OpenSim.Data.MySQL
protected IDataReader ExecuteReader(MySqlCommand cmd) protected IDataReader ExecuteReader(MySqlCommand cmd)
{ {
MySqlConnection newConnection = (MySqlConnection) MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
((ICloneable)m_Connection).Clone();
newConnection.Open(); newConnection.Open();
cmd.Connection = newConnection; cmd.Connection = newConnection;
return cmd.ExecuteReader(); return cmd.ExecuteReader();
} }
protected void CloseDBConnection(MySqlCommand cmd)
{
cmd.Connection.Dispose();
}
} }
} }

View File

@ -172,6 +172,8 @@ namespace OpenSim.Data.MySQL
retList.Add(ret); retList.Add(ret);
} }
CloseDBConnection(cmd);
} }
return retList; return retList;

View File

@ -97,12 +97,16 @@ namespace OpenSim.Data.MySQL
ret.Data[s] = result[s].ToString(); ret.Data[s] = result[s].ToString();
} }
CloseDBConnection(cmd);
return ret; return ret;
} }
else
{
CloseDBConnection(cmd);
return null;
}
} }
} }
return null;
} }
public bool Store(UserAccountData data) public bool Store(UserAccountData data)

View File

@ -238,7 +238,7 @@ namespace OpenSim.Framework.Servers
List<Thread> threads = ThreadTracker.GetThreads(); List<Thread> threads = ThreadTracker.GetThreads();
if (threads == null) if (threads == null)
{ {
sb.Append("Thread tracking is only enabled in DEBUG mode."); sb.Append("OpenSim thread tracking is only enabled in DEBUG mode.");
} }
else else
{ {
@ -264,6 +264,12 @@ namespace OpenSim.Framework.Servers
} }
} }
} }
int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0;
ThreadPool.GetAvailableThreads(out workers, out ports);
ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);
sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine);
sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine);
return sb.ToString(); return sb.ToString();
} }

View File

@ -28,14 +28,21 @@
using System; using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using log4net;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {
public class SynchronousRestFormsRequester public class SynchronousRestFormsRequester
{ {
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// Perform a synchronous REST request. /// Perform a synchronous REST request.
/// </summary> /// </summary>
@ -72,8 +79,9 @@ namespace OpenSim.Framework.Servers.HttpServer
requestStream = request.GetRequestStream(); requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length); requestStream.Write(buffer.ToArray(), 0, length);
} }
catch catch (Exception e)
{ {
m_log.DebugFormat("[FORMS]: exception occured on sending request {0}", e.Message);
} }
finally finally
{ {
@ -102,7 +110,10 @@ namespace OpenSim.Framework.Servers.HttpServer
respstring = reader.ReadToEnd(); respstring = reader.ReadToEnd();
} }
} }
catch { } catch (Exception e)
{
m_log.DebugFormat("[FORMS]: exception occured on receiving reply {0}", e.Message);
}
finally finally
{ {
if (respStream != null) if (respStream != null)
@ -114,6 +125,7 @@ namespace OpenSim.Framework.Servers.HttpServer
catch (System.InvalidOperationException) catch (System.InvalidOperationException)
{ {
// This is what happens when there is invalid XML // This is what happens when there is invalid XML
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
} }
return respstring; return respstring;
} }

View File

@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
J2KImage imgrequest; J2KImage imgrequest;
// Do a linear search for this texture download // Do a linear search for this texture download
lock (m_priorityQueue) lock (m_syncRoot)
m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest);
if (imgrequest != null) if (imgrequest != null)
@ -99,7 +99,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
try try
{ {
lock (m_priorityQueue) lock (m_syncRoot)
m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
} }
catch (Exception) { } catch (Exception) { }
@ -167,8 +167,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
J2KImage imagereq; J2KImage imagereq;
int numCollected = 0; int numCollected = 0;
lock (m_syncRoot) //lock (m_syncRoot)
{ //{
m_lastloopprocessed = DateTime.Now.Ticks; m_lastloopprocessed = DateTime.Now.Ticks;
// This can happen during Close() // This can happen during Close()
@ -191,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (numCollected == count) if (numCollected == count)
break; break;
} }
} //}
return m_priorityQueue.Count > 0; return m_priorityQueue.Count > 0;
} }
@ -211,16 +211,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
J2KImage image = null; J2KImage image = null;
if (m_priorityQueue.Count > 0) lock (m_syncRoot)
{ {
try
{
lock (m_priorityQueue)
image = m_priorityQueue.FindMax();
}
catch (Exception) { }
}
if (m_priorityQueue.Count > 0)
{
try
{
image = m_priorityQueue.FindMax();
}
catch (Exception) { }
}
}
return image; return image;
} }
@ -228,23 +230,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
image.PriorityQueueHandle = null; image.PriorityQueueHandle = null;
lock (m_priorityQueue) lock (m_syncRoot)
m_priorityQueue.Add(ref image.PriorityQueueHandle, image); try
{
m_priorityQueue.Add(ref image.PriorityQueueHandle, image);
}
catch (Exception) { }
} }
void RemoveImageFromQueue(J2KImage image) void RemoveImageFromQueue(J2KImage image)
{ {
try lock (m_syncRoot)
{ try
lock (m_priorityQueue) {
m_priorityQueue.Delete(image.PriorityQueueHandle); m_priorityQueue.Delete(image.PriorityQueueHandle);
} }
catch (Exception) { } catch (Exception) { }
} }
void UpdateImageInQueue(J2KImage image) void UpdateImageInQueue(J2KImage image)
{ {
lock (m_priorityQueue) lock (m_syncRoot)
{ {
try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); }
catch (Exception) catch (Exception)

View File

@ -178,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Asset
{ {
if (maximalSize <= 0 || maximalCount <= 0) if (maximalSize <= 0 || maximalCount <= 0)
{ {
Log.Info("[ASSET CACHE]: Cenome asset cache is not enabled."); //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled.");
m_enabled = false; m_enabled = false;
return; return;
} }
@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Asset
CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
maximalSize, maximalCount, expirationTime)); maximalSize, maximalCount, expirationTime));
m_enabled = true; m_enabled = true;
Log.InfoFormat( Log.DebugFormat(
"[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})",
maximalSize, maximalSize,
maximalCount, maximalCount,
@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Asset
if (m_getCount == m_debugEpoch) if (m_getCount == m_debugEpoch)
{ {
Log.InfoFormat( Log.DebugFormat(
"[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes",
m_cachedCount, m_cachedCount,
m_getCount, m_getCount,
@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Asset
return; return;
string name = moduleConfig.GetString("AssetCaching"); string name = moduleConfig.GetString("AssetCaching");
Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
if (name != Name) if (name != Name)
return; return;
@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Asset
int maxCount = DefaultMaxCount; int maxCount = DefaultMaxCount;
TimeSpan expirationTime = DefaultExpirationTime; TimeSpan expirationTime = DefaultExpirationTime;
IConfig assetConfig = source.Configs[ "AssetCache" ]; IConfig assetConfig = source.Configs["AssetCache"];
if (assetConfig != null) if (assetConfig != null)
{ {
// Get optional configurations // Get optional configurations
maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize); maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize);
maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount); maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount);
expirationTime = expirationTime =
TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int) DefaultExpirationTime.TotalMinutes)); TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int)DefaultExpirationTime.TotalMinutes));
// Debugging purposes only // Debugging purposes only
m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0); m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0);

View File

@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Asset
if (moduleConfig != null) if (moduleConfig != null)
{ {
string name = moduleConfig.GetString("AssetCaching"); string name = moduleConfig.GetString("AssetCaching");
m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
if (name == Name) if (name == Name)
{ {

View File

@ -636,11 +636,8 @@ namespace Flotsam.RegionModules.AssetCache
m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk"); m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk");
} }
} }
#endregion #endregion
} }
} }

View File

@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Asset
if (moduleConfig != null) if (moduleConfig != null)
{ {
string name = moduleConfig.GetString("AssetCaching"); string name = moduleConfig.GetString("AssetCaching");
m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized); //m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized);
if (name == Name) if (name == Name)
{ {

View File

@ -206,6 +206,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{ {
GridRegion region = null;
// First see if it's a neighbour, even if it isn't on this sim.
// Neighbour data is cached in memory, so this is fast
foreach (RegionCache rcache in m_LocalCache.Values)
{
region = rcache.GetRegionByPosition(x, y);
if (region != null)
{
return region;
}
}
// Then try on this sim (may be a lookup in DB if this is using MySql).
return m_GridService.GetRegionByPosition(scopeID, x, y); return m_GridService.GetRegionByPosition(scopeID, x, y);
} }

View File

@ -29,10 +29,12 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using log4net; using log4net;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
@ -75,5 +77,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
{ {
return new List<GridRegion>(m_neighbours.Values); return new List<GridRegion>(m_neighbours.Values);
} }
public GridRegion GetRegionByPosition(int x, int y)
{
uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize;
uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize;
ulong handle = Utils.UIntsToLong(xsnap, ysnap);
if (m_neighbours.ContainsKey(handle))
return m_neighbours[handle];
return null;
}
} }
} }

View File

@ -397,10 +397,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// with the powers requested (powers = 0 for no powers check) // with the powers requested (powers = 0 for no powers check)
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
{ {
IClientAPI client = m_scene.GetScenePresence(userID).ControllingClient; ScenePresence sp = m_scene.GetScenePresence(userID);
if (sp != null)
{
IClientAPI client = sp.ControllingClient;
return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) &&
((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers)));
}
return false;
} }
/// <summary> /// <summary>

View File

@ -425,7 +425,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID)) foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID))
{ {
if (m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid))
{ {
// Don't deliver messages to people who have dropped this session // Don't deliver messages to people who have dropped this session
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);

View File

@ -148,9 +148,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count]; UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count];
foreach (UUID key in CurrentKeys) foreach (UUID key in CurrentKeys)
{ {
if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout) if (m_clientRequestIDInfo.ContainsKey(key))
{ {
m_clientRequestIDInfo.Remove(key); if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout)
{
m_clientRequestIDInfo.Remove(key);
}
} }
} }
} }
@ -476,7 +479,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
foreach (string key in binBucketOSD.Keys) foreach (string key in binBucketOSD.Keys)
{ {
m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); if (binBucketOSD.ContainsKey(key))
{
m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString());
}
} }
} }

View File

@ -47,6 +47,8 @@ namespace OpenSim.Region.Physics.Manager
int[] getIndexListAsInt(); int[] getIndexListAsInt();
int[] getIndexListAsIntLocked(); int[] getIndexListAsIntLocked();
float[] getVertexListAsFloatLocked(); float[] getVertexListAsFloatLocked();
void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount);
void getVertexListAsPtrToFloatArray( out IntPtr vertexList, out int vertexStride, out int vertexCount );
void releaseSourceMeshData(); void releaseSourceMeshData();
void releasePinned(); void releasePinned();
void Append(IMesh newMesh); void Append(IMesh newMesh);

View File

@ -36,23 +36,27 @@ namespace OpenSim.Region.Physics.Meshing
{ {
public class Mesh : IMesh public class Mesh : IMesh
{ {
private Dictionary<Vertex, int> vertices; private Dictionary<Vertex, int> m_vertices;
private List<Triangle> triangles; private List<Triangle> m_triangles;
GCHandle pinnedVirtexes; GCHandle m_pinnedVertexes;
GCHandle pinnedIndex; GCHandle m_pinnedIndex;
public float[] normals; IntPtr m_verticesPtr = IntPtr.Zero;
int m_vertexCount = 0;
IntPtr m_indicesPtr = IntPtr.Zero;
int m_indexCount = 0;
public float[] m_normals;
public Mesh() public Mesh()
{ {
vertices = new Dictionary<Vertex, int>(); m_vertices = new Dictionary<Vertex, int>();
triangles = new List<Triangle>(); m_triangles = new List<Triangle>();
} }
public Mesh Clone() public Mesh Clone()
{ {
Mesh result = new Mesh(); Mesh result = new Mesh();
foreach (Triangle t in triangles) foreach (Triangle t in m_triangles)
{ {
result.Add(new Triangle(t.v1.Clone(), t.v2.Clone(), t.v3.Clone())); result.Add(new Triangle(t.v1.Clone(), t.v2.Clone(), t.v3.Clone()));
} }
@ -62,27 +66,27 @@ namespace OpenSim.Region.Physics.Meshing
public void Add(Triangle triangle) public void Add(Triangle triangle)
{ {
if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated) if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
throw new NotSupportedException("Attempt to Add to a pinned Mesh"); throw new NotSupportedException("Attempt to Add to a pinned Mesh");
// If a vertex of the triangle is not yet in the vertices list, // If a vertex of the triangle is not yet in the vertices list,
// add it and set its index to the current index count // add it and set its index to the current index count
if (!vertices.ContainsKey(triangle.v1)) if( !m_vertices.ContainsKey(triangle.v1) )
vertices[triangle.v1] = vertices.Count; m_vertices[triangle.v1] = m_vertices.Count;
if (!vertices.ContainsKey(triangle.v2)) if (!m_vertices.ContainsKey(triangle.v2))
vertices[triangle.v2] = vertices.Count; m_vertices[triangle.v2] = m_vertices.Count;
if (!vertices.ContainsKey(triangle.v3)) if (!m_vertices.ContainsKey(triangle.v3))
vertices[triangle.v3] = vertices.Count; m_vertices[triangle.v3] = m_vertices.Count;
triangles.Add(triangle); m_triangles.Add(triangle);
} }
public void CalcNormals() public void CalcNormals()
{ {
int iTriangles = triangles.Count; int iTriangles = m_triangles.Count;
this.normals = new float[iTriangles * 3]; this.m_normals = new float[iTriangles * 3];
int i = 0; int i = 0;
foreach (Triangle t in triangles) foreach (Triangle t in m_triangles)
{ {
float ux, uy, uz; float ux, uy, uz;
float vx, vy, vz; float vx, vy, vz;
@ -129,9 +133,9 @@ namespace OpenSim.Region.Physics.Meshing
//ny /= l; //ny /= l;
//nz /= l; //nz /= l;
normals[i] = nx * lReciprocal; m_normals[i] = nx * lReciprocal;
normals[i + 1] = ny * lReciprocal; m_normals[i + 1] = ny * lReciprocal;
normals[i + 2] = nz * lReciprocal; m_normals[i + 2] = nz * lReciprocal;
i += 3; i += 3;
} }
@ -140,45 +144,70 @@ namespace OpenSim.Region.Physics.Meshing
public List<PhysicsVector> getVertexList() public List<PhysicsVector> getVertexList()
{ {
List<PhysicsVector> result = new List<PhysicsVector>(); List<PhysicsVector> result = new List<PhysicsVector>();
foreach (Vertex v in vertices.Keys) foreach (Vertex v in m_vertices.Keys)
{ {
result.Add(v); result.Add(v);
} }
return result; return result;
} }
public float[] getVertexListAsFloatLocked() private float[] getVertexListAsFloat()
{ {
if (pinnedVirtexes.IsAllocated) if(m_vertices == null)
return (float[])(pinnedVirtexes.Target); throw new NotSupportedException();
float[] result; float[] result = new float[m_vertices.Count * 3];
foreach (KeyValuePair<Vertex, int> kvp in m_vertices)
//m_log.WarnFormat("vertices.Count = {0}", vertices.Count);
result = new float[vertices.Count * 3];
foreach (KeyValuePair<Vertex, int> kvp in vertices)
{ {
Vertex v = kvp.Key; Vertex v = kvp.Key;
int i = kvp.Value; int i = kvp.Value;
//m_log.WarnFormat("kvp.Value = {0}", i);
result[3 * i + 0] = v.X; result[3 * i + 0] = v.X;
result[3 * i + 1] = v.Y; result[3 * i + 1] = v.Y;
result[3 * i + 2] = v.Z; result[3 * i + 2] = v.Z;
} }
pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
return result; return result;
} }
public float[] getVertexListAsFloatLocked()
{
if( m_pinnedVertexes.IsAllocated )
return (float[])(m_pinnedVertexes.Target);
float[] result = getVertexListAsFloat();
m_pinnedVertexes = GCHandle.Alloc(result, GCHandleType.Pinned);
return result;
}
public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount)
{
// A vertex is 3 floats
vertexStride = 3 * sizeof(float);
// If there isn't an unmanaged array allocated yet, do it now
if (m_verticesPtr == IntPtr.Zero)
{
float[] vertexList = getVertexListAsFloat();
// Each vertex is 3 elements (floats)
m_vertexCount = vertexList.Length / 3;
int byteCount = m_vertexCount * vertexStride;
m_verticesPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(byteCount);
System.Runtime.InteropServices.Marshal.Copy(vertexList, 0, m_verticesPtr, m_vertexCount * 3);
}
vertices = m_verticesPtr;
vertexCount = m_vertexCount;
}
public int[] getIndexListAsInt() public int[] getIndexListAsInt()
{ {
int[] result; if (m_triangles == null)
throw new NotSupportedException();
result = new int[triangles.Count * 3]; int[] result = new int[m_triangles.Count * 3];
for (int i = 0; i < triangles.Count; i++) for (int i = 0; i < m_triangles.Count; i++)
{ {
Triangle t = triangles[i]; Triangle t = m_triangles[i];
result[3 * i + 0] = vertices[t.v1]; result[3 * i + 0] = m_vertices[t.v1];
result[3 * i + 1] = vertices[t.v2]; result[3 * i + 1] = m_vertices[t.v2];
result[3 * i + 2] = vertices[t.v3]; result[3 * i + 2] = m_vertices[t.v3];
} }
return result; return result;
} }
@ -189,19 +218,48 @@ namespace OpenSim.Region.Physics.Meshing
/// <returns></returns> /// <returns></returns>
public int[] getIndexListAsIntLocked() public int[] getIndexListAsIntLocked()
{ {
if (pinnedIndex.IsAllocated) if (m_pinnedIndex.IsAllocated)
return (int[])(pinnedIndex.Target); return (int[])(m_pinnedIndex.Target);
int[] result = getIndexListAsInt(); int[] result = getIndexListAsInt();
pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
return result; return result;
} }
public void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount)
{
// If there isn't an unmanaged array allocated yet, do it now
if (m_indicesPtr == IntPtr.Zero)
{
int[] indexList = getIndexListAsInt();
m_indexCount = indexList.Length;
int byteCount = m_indexCount * sizeof(int);
m_indicesPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(byteCount);
System.Runtime.InteropServices.Marshal.Copy(indexList, 0, m_indicesPtr, m_indexCount);
}
// A triangle is 3 ints (indices)
triStride = 3 * sizeof(int);
indices = m_indicesPtr;
indexCount = m_indexCount;
}
public void releasePinned() public void releasePinned()
{ {
pinnedVirtexes.Free(); if (m_pinnedVertexes.IsAllocated)
pinnedIndex.Free(); m_pinnedVertexes.Free();
if (m_pinnedIndex.IsAllocated)
m_pinnedIndex.Free();
if (m_verticesPtr != IntPtr.Zero)
{
System.Runtime.InteropServices.Marshal.FreeHGlobal(m_verticesPtr);
m_verticesPtr = IntPtr.Zero;
}
if (m_indicesPtr != IntPtr.Zero)
{
System.Runtime.InteropServices.Marshal.FreeHGlobal(m_indicesPtr);
m_indicesPtr = IntPtr.Zero;
}
} }
/// <summary> /// <summary>
@ -209,29 +267,29 @@ namespace OpenSim.Region.Physics.Meshing
/// </summary> /// </summary>
public void releaseSourceMeshData() public void releaseSourceMeshData()
{ {
triangles = null; m_triangles = null;
vertices = null; m_vertices = null;
} }
public void Append(IMesh newMesh) public void Append(IMesh newMesh)
{ {
if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated) if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
throw new NotSupportedException("Attempt to Append to a pinned Mesh"); throw new NotSupportedException("Attempt to Append to a pinned Mesh");
if (!(newMesh is Mesh)) if (!(newMesh is Mesh))
return; return;
foreach (Triangle t in ((Mesh)newMesh).triangles) foreach (Triangle t in ((Mesh)newMesh).m_triangles)
Add(t); Add(t);
} }
// Do a linear transformation of mesh. // Do a linear transformation of mesh.
public void TransformLinear(float[,] matrix, float[] offset) public void TransformLinear(float[,] matrix, float[] offset)
{ {
if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated) if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
throw new NotSupportedException("Attempt to TransformLinear a pinned Mesh"); throw new NotSupportedException("Attempt to TransformLinear a pinned Mesh");
foreach (Vertex v in vertices.Keys) foreach (Vertex v in m_vertices.Keys)
{ {
if (v == null) if (v == null)
continue; continue;
@ -252,7 +310,7 @@ namespace OpenSim.Region.Physics.Meshing
String fileName = name + "_" + title + ".raw"; String fileName = name + "_" + title + ".raw";
String completePath = Path.Combine(path, fileName); String completePath = Path.Combine(path, fileName);
StreamWriter sw = new StreamWriter(completePath); StreamWriter sw = new StreamWriter(completePath);
foreach (Triangle t in triangles) foreach (Triangle t in m_triangles)
{ {
String s = t.ToStringRaw(); String s = t.ToStringRaw();
sw.WriteLine(s); sw.WriteLine(s);
@ -262,7 +320,7 @@ namespace OpenSim.Region.Physics.Meshing
public void TrimExcess() public void TrimExcess()
{ {
triangles.TrimExcess(); m_triangles.TrimExcess();
} }
} }
} }

View File

@ -498,12 +498,9 @@ namespace OpenSim.Region.Physics.Meshing
// If this mesh has been created already, return it instead of creating another copy // If this mesh has been created already, return it instead of creating another copy
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
if (! primShape.SculptEntry) key = GetMeshKey(primShape, size, lod);
{ if (m_uniqueMeshes.TryGetValue(key, out mesh))
key = GetMeshKey(primShape, size, lod); return mesh;
if (m_uniqueMeshes.TryGetValue(key, out mesh))
return mesh;
}
if (size.X < 0.01f) size.X = 0.01f; if (size.X < 0.01f) size.X = 0.01f;
if (size.Y < 0.01f) size.Y = 0.01f; if (size.Y < 0.01f) size.Y = 0.01f;
@ -525,10 +522,9 @@ namespace OpenSim.Region.Physics.Meshing
// trim the vertex and triangle lists to free up memory // trim the vertex and triangle lists to free up memory
mesh.TrimExcess(); mesh.TrimExcess();
}
if (!primShape.SculptEntry)
m_uniqueMeshes.Add(key, mesh); m_uniqueMeshes.Add(key, mesh);
}
return mesh; return mesh;
} }

View File

@ -813,18 +813,17 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory IntPtr vertices, indices;
int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage int vertexCount, indexCount;
int vertexStride, triStride;
mesh.getVertexListAsPtrToFloatArray( out vertices, out vertexStride, out vertexCount ); // Note, that vertices are fixed in unmanaged heap
mesh.getIndexListAsPtrToIntArray( out indices, out triStride, out indexCount ); // Also fixed, needs release after usage
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
int VertexCount = vertexList.GetLength(0)/3;
int IndexCount = indexList.GetLength(0);
_triMeshData = d.GeomTriMeshDataCreate(); _triMeshData = d.GeomTriMeshDataCreate();
d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3*sizeof (float), VertexCount, indexList, IndexCount, d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
3*sizeof (int));
d.GeomTriMeshDataPreprocess(_triMeshData); d.GeomTriMeshDataPreprocess(_triMeshData);
_parent_scene.waitForSpaceUnlock(m_targetSpace); _parent_scene.waitForSpaceUnlock(m_targetSpace);

View File

@ -3476,7 +3476,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void UnCombine(PhysicsScene pScene) public override void UnCombine(PhysicsScene pScene)
{ {
IntPtr localGround = IntPtr.Zero; IntPtr localGround = IntPtr.Zero;
float[] localHeightfield; //float[] localHeightfield;
bool proceed = false; bool proceed = false;
List<IntPtr> geomDestroyList = new List<IntPtr>(); List<IntPtr> geomDestroyList = new List<IntPtr>();
@ -3771,8 +3771,6 @@ namespace OpenSim.Region.Physics.OdePlugin
sides.Z = 0.5f; sides.Z = 0.5f;
ds.DrawBox(ref pos, ref R, ref sides); ds.DrawBox(ref pos, ref R, ref sides);
} }
} }
} }
@ -3780,7 +3778,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public void start(int unused) public void start(int unused)
{ {
ds.SetViewpoint(ref xyz, ref hpr); ds.SetViewpoint(ref xyz, ref hpr);
} }
#endif #endif

View File

@ -260,7 +260,7 @@ namespace OpenSim.Server.Base
public static Dictionary<string, object> ParseXmlResponse(string data) public static Dictionary<string, object> ParseXmlResponse(string data)
{ {
//m_log.DebugFormat("[XXX]: received xml string: {0}", data); m_log.DebugFormat("[XXX]: received xml string: {0}", data);
Dictionary<string, object> ret = new Dictionary<string, object>(); Dictionary<string, object> ret = new Dictionary<string, object>();

View File

@ -67,43 +67,50 @@ namespace OpenSim.Server.Handlers.Grid
//m_log.DebugFormat("[XXX]: query String: {0}", body); //m_log.DebugFormat("[XXX]: query String: {0}", body);
Dictionary<string, string> request = try
ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
return FailureResult();
string method = request["METHOD"];
switch (method)
{ {
case "register": Dictionary<string, string> request =
return Register(request); ServerUtils.ParseQueryString(body);
case "deregister": if (!request.ContainsKey("METHOD"))
return Deregister(request); return FailureResult();
case "get_neighbours": string method = request["METHOD"];
return GetNeighbours(request);
case "get_region_by_uuid": switch (method)
return GetRegionByUUID(request); {
case "register":
return Register(request);
case "get_region_by_position": case "deregister":
return GetRegionByPosition(request); return Deregister(request);
case "get_region_by_name": case "get_neighbours":
return GetRegionByName(request); return GetNeighbours(request);
case "get_regions_by_name": case "get_region_by_uuid":
return GetRegionsByName(request); return GetRegionByUUID(request);
case "get_region_range": case "get_region_by_position":
return GetRegionRange(request); return GetRegionByPosition(request);
case "get_region_by_name":
return GetRegionByName(request);
case "get_regions_by_name":
return GetRegionsByName(request);
case "get_region_range":
return GetRegionRange(request);
}
m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID HANDLER]: Exception {0}", e);
} }
m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
return FailureResult(); return FailureResult();
} }
@ -113,7 +120,7 @@ namespace OpenSim.Server.Handlers.Grid
byte[] Register(Dictionary<string, string> request) byte[] Register(Dictionary<string, string> request)
{ {
UUID scopeID = UUID.Zero; UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null) if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"], out scopeID); UUID.TryParse(request["SCOPEID"], out scopeID);
else else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region");
@ -137,11 +144,21 @@ namespace OpenSim.Server.Handlers.Grid
} }
Dictionary<string, object> rinfoData = new Dictionary<string, object>(); Dictionary<string, object> rinfoData = new Dictionary<string, object>();
foreach (KeyValuePair<string, string> kvp in request) GridRegion rinfo = null;
rinfoData[kvp.Key] = kvp.Value; try
GridRegion rinfo = new GridRegion(rinfoData); {
foreach (KeyValuePair<string, string> kvp in request)
rinfoData[kvp.Key] = kvp.Value;
rinfo = new GridRegion(rinfoData);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e);
}
bool result = m_GridService.RegisterRegion(scopeID, rinfo); bool result = false;
if (rinfo != null)
result = m_GridService.RegisterRegion(scopeID, rinfo);
if (result) if (result)
return SuccessResult(); return SuccessResult();

View File

@ -171,6 +171,8 @@ namespace OpenSim.Services.Connectors
if (asset == null) if (asset == null)
{ {
bool result = false;
AsynchronousRestObjectRequester. AsynchronousRestObjectRequester.
MakeRequest<int, AssetBase>("GET", uri, 0, MakeRequest<int, AssetBase>("GET", uri, 0,
delegate(AssetBase a) delegate(AssetBase a)
@ -178,8 +180,10 @@ namespace OpenSim.Services.Connectors
if (m_Cache != null) if (m_Cache != null)
m_Cache.Cache(a); m_Cache.Cache(a);
handler(id, sender, a); handler(id, sender, a);
result = true;
}); });
return result;
} }
else else
{ {

View File

@ -109,8 +109,13 @@ namespace OpenSim.Services.Connectors
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
return true; return true;
else if (!replyData.ContainsKey("Result"))
m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
else
m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
} }
else else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply"); m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");

View File

@ -69,18 +69,40 @@ namespace OpenSim.Services.GridService
((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
{ {
// Region reregistering in other coordinates. Delete the old entry // Region reregistering in other coordinates. Delete the old entry
m_Database.Delete(regionInfos.RegionID); m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
try
{
m_Database.Delete(regionInfos.RegionID);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
}
} }
// Everything is ok, let's register // Everything is ok, let's register
RegionData rdata = RegionInfo2RegionData(regionInfos); RegionData rdata = RegionInfo2RegionData(regionInfos);
rdata.ScopeID = scopeID; rdata.ScopeID = scopeID;
m_Database.Store(rdata); try
{
m_Database.Store(rdata);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
}
m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
return true; return true;
} }
public bool DeregisterRegion(UUID regionID) public bool DeregisterRegion(UUID regionID)
{ {
m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
return m_Database.Delete(regionID); return m_Database.Delete(regionID);
} }

View File

@ -312,7 +312,7 @@
; Uncomment below to enable llRemoteData/remote channels ; Uncomment below to enable llRemoteData/remote channels
; remoteDataPort = 20800 ; remoteDataPort = 20800
grid_server_url = "http://127.0.0.1:8001" grid_server_url = "http://127.0.0.1:8003"
grid_send_key = "null" grid_send_key = "null"
grid_recv_key = "null" grid_recv_key = "null"
@ -322,7 +322,7 @@
asset_server_url = "http://127.0.0.1:8003" asset_server_url = "http://127.0.0.1:8003"
inventory_server_url = "http://127.0.0.1:8004" inventory_server_url = "http://127.0.0.1:8003"
; The MessagingServer is a companion of the UserServer. It uses ; The MessagingServer is a companion of the UserServer. It uses
; user_send_key and user_recv_key, too ; user_send_key and user_recv_key, too

View File

@ -13,13 +13,13 @@
; ;
; change this to your grid-wide inventory server ; change this to your grid-wide inventory server
; ;
InventoryServerURI = "http://myinventoryserver.com:8004" InventoryServerURI = "http://myinventoryserver.com:8003"
[GridService] [GridService]
; ;
; change this to your grid-wide grid server ; change this to your grid-wide grid server
; ;
GridServerURI = "http://mygridserver.com:8001" GridServerURI = "http://mygridserver.com:8003"
[Modules] [Modules]
;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.