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

prioritization
John Hurliman 2009-10-06 12:15:24 -07:00
commit fa6027aa09
13 changed files with 101 additions and 91 deletions

View File

@ -55,42 +55,40 @@ namespace OpenSim.Data.MySQL
AuthenticationData ret = new AuthenticationData(); AuthenticationData ret = new AuthenticationData();
ret.Data = new Dictionary<string, object>(); ret.Data = new Dictionary<string, object>();
using (MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID")) MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID");
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
IDataReader result = ExecuteReader(cmd);
if (result.Read())
{ {
cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); ret.PrincipalID = principalID;
using (IDataReader result = ExecuteReader(cmd)) if (m_ColumnNames == null)
{ {
if (result.Read()) m_ColumnNames = new List<string>();
{
ret.PrincipalID = principalID;
if (m_ColumnNames == null) DataTable schemaTable = result.GetSchemaTable();
{ foreach (DataRow row in schemaTable.Rows)
m_ColumnNames = new List<string>(); m_ColumnNames.Add(row["ColumnName"].ToString());
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["ColumnName"].ToString());
}
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
CloseDBConnection(cmd);
return ret;
}
else
{
CloseDBConnection(cmd);
return null;
}
} }
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
CloseDBConnection(result, cmd);
return ret;
}
else
{
CloseDBConnection(result, cmd);
return null;
} }
} }

View File

@ -40,7 +40,9 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
public class MySqlFramework public class MySqlFramework
{ {
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log =
log4net.LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected MySqlConnection m_Connection; protected MySqlConnection m_Connection;
@ -81,7 +83,8 @@ namespace OpenSim.Data.MySQL
errorSeen = true; errorSeen = true;
m_Connection.Close(); m_Connection.Close();
MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone(); MySqlConnection newConnection =
(MySqlConnection)((ICloneable)m_Connection).Clone();
m_Connection.Dispose(); m_Connection.Dispose();
m_Connection = newConnection; m_Connection = newConnection;
m_Connection.Open(); m_Connection.Open();
@ -102,15 +105,18 @@ namespace OpenSim.Data.MySQL
protected IDataReader ExecuteReader(MySqlCommand cmd) protected IDataReader ExecuteReader(MySqlCommand cmd)
{ {
MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone(); MySqlConnection newConnection =
(MySqlConnection)((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) protected void CloseDBConnection(IDataReader reader, MySqlCommand cmd)
{ {
reader.Close();
cmd.Connection.Close();
cmd.Connection.Dispose(); cmd.Connection.Dispose();
} }
} }

View File

@ -173,7 +173,7 @@ namespace OpenSim.Data.MySQL
retList.Add(ret); retList.Add(ret);
} }
CloseDBConnection(cmd); CloseDBConnection(result, cmd);
} }
return retList; return retList;

View File

@ -64,48 +64,46 @@ namespace OpenSim.Data.MySQL
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID"; command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command)) MySqlCommand cmd = new MySqlCommand(command);
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
IDataReader result = ExecuteReader(cmd);
if (result.Read())
{ {
cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); ret.PrincipalID = principalID;
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); UUID scope;
UUID.TryParse(result["ScopeID"].ToString(), out scope);
ret.ScopeID = scope;
using (IDataReader result = ExecuteReader(cmd)) if (m_ColumnNames == null)
{ {
if (result.Read()) m_ColumnNames = new List<string>();
{
ret.PrincipalID = principalID;
UUID scope;
UUID.TryParse(result["ScopeID"].ToString(), out scope);
ret.ScopeID = scope;
if (m_ColumnNames == null) DataTable schemaTable = result.GetSchemaTable();
{ foreach (DataRow row in schemaTable.Rows)
m_ColumnNames = new List<string>(); m_ColumnNames.Add(row["ColumnName"].ToString());
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["ColumnName"].ToString());
}
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
if (s == "ScopeID")
continue;
ret.Data[s] = result[s].ToString();
}
CloseDBConnection(cmd);
return ret;
}
else
{
CloseDBConnection(cmd);
return null;
}
} }
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
if (s == "ScopeID")
continue;
ret.Data[s] = result[s].ToString();
}
CloseDBConnection(result, cmd);
return ret;
}
else
{
CloseDBConnection(result, cmd);
return null;
} }
} }

View File

@ -318,11 +318,11 @@ namespace OpenSim.Framework.Communications
HttpWebResponse errorResponse = e.Response as HttpWebResponse; HttpWebResponse errorResponse = e.Response as HttpWebResponse;
if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode) if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode)
{ {
m_log.Warn("[ASSET] Asset not found (404)"); m_log.Warn("[REST CLIENT] Resource not found (404)");
} }
else else
{ {
m_log.Error("[ASSET] Error fetching asset from asset server"); m_log.Error("[REST CLIENT] Error fetching resource from server " + _request.Address.ToString());
m_log.Debug(e.ToString()); m_log.Debug(e.ToString());
} }

View File

@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
m_log.Info("[RegionAssetService]: Starting..."); m_log.Info("[RegionAssetService]: Starting...");
Object[] args = new Object[] { m_Config, MainServer.Instance }; Object[] args = new Object[] { m_Config, MainServer.Instance, string.Empty };
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args); ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args);
} }

View File

@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
m_log.Info("[RegionInventoryService]: Starting..."); m_log.Info("[RegionInventoryService]: Starting...");
Object[] args = new Object[] { m_Config, MainServer.Instance }; Object[] args = new Object[] { m_Config, MainServer.Instance, String.Empty };
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args); ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args);
} }

View File

@ -61,6 +61,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
private void OnRegionUp(GridRegion otherRegion) private void OnRegionUp(GridRegion otherRegion)
{ {
// This shouldn't happen
if (otherRegion == null)
return;
m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}", m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}",
m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY);

View File

@ -137,6 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
protected IAssetService m_AssetService = null; protected IAssetService m_AssetService = null;
protected IAuthorizationService m_AuthorizationService = null; protected IAuthorizationService m_AuthorizationService = null;
private Object m_heartbeatLock = new Object();
public IAssetService AssetService public IAssetService AssetService
{ {
get get
@ -940,6 +942,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="e"></param> /// <param name="e"></param>
private void Heartbeat(object sender) private void Heartbeat(object sender)
{ {
if (!Monitor.TryEnter(m_heartbeatLock))
return;
try try
{ {
Update(); Update();
@ -950,6 +955,11 @@ namespace OpenSim.Region.Framework.Scenes
catch (ThreadAbortException) catch (ThreadAbortException)
{ {
} }
finally
{
Monitor.Pulse(m_heartbeatLock);
Monitor.Exit(m_heartbeatLock);
}
} }
/// <summary> /// <summary>
@ -960,6 +970,12 @@ namespace OpenSim.Region.Framework.Scenes
int maintc = 0; int maintc = 0;
while (!shuttingdown) while (!shuttingdown)
{ {
//#if DEBUG
// int w = 0, io = 0;
// ThreadPool.GetAvailableThreads(out w, out io);
// if ((w < 10) || (io < 10))
// m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io);
//#endif
maintc = Environment.TickCount; maintc = Environment.TickCount;
TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate; TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;

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

@ -77,6 +77,7 @@ namespace OpenSim.Server.Handlers.Inventory
m_doLookup = serverConfig.GetBoolean("SessionAuthentication", false); m_doLookup = serverConfig.GetBoolean("SessionAuthentication", false);
AddHttpHandlers(server); AddHttpHandlers(server);
m_log.Debug("[INVENTORY HANDLER]: handlers initialized");
} }
protected virtual void AddHttpHandlers(IHttpServer m_httpServer) protected virtual void AddHttpHandlers(IHttpServer m_httpServer)

View File

@ -416,13 +416,6 @@ namespace OpenSim.Services.Connectors
e.Source, e.Message); e.Source, e.Message);
} }
foreach (InventoryItemBase item in items)
{
InventoryItemBase itm = this.QueryItem(userID, item, sessionID);
itm.Name = item.Name;
itm.Folder = item.Folder;
this.UpdateItem(userID, itm, sessionID);
}
} }
private void MoveItemsCompleted(IAsyncResult iar) private void MoveItemsCompleted(IAsyncResult iar)

View File

@ -725,7 +725,6 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.StructuredData.dll"/> <Reference name="OpenMetaverse.StructuredData.dll"/>
@ -806,7 +805,6 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data" /> <Reference name="OpenSim.Data" />
<Reference name="OpenSim.Framework.Communications" /> <Reference name="OpenSim.Framework.Communications" />
@ -1540,7 +1538,6 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.StructuredData.dll"/> <Reference name="OpenMetaverse.StructuredData.dll"/>
@ -1625,7 +1622,6 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.StructuredData.dll"/> <Reference name="OpenMetaverse.StructuredData.dll"/>
@ -1683,7 +1679,6 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
@ -3592,7 +3587,6 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/> <Reference name="OpenMetaverse.dll"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>