Miscellaneous small tweaks and more logging messages to move towards resolving inventory problems

afrisby
Justin Clarke Casey 2007-12-23 02:14:29 +00:00
parent 1a679c8cd9
commit c545cc8cd9
4 changed files with 39 additions and 12 deletions

View File

@ -27,6 +27,7 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -61,12 +62,14 @@ namespace OpenSim.Framework.Communications.Cache
if (userInfo.UserProfile != null) if (userInfo.UserProfile != null)
{ {
RequestInventoryForUser(userID, userInfo); // The request itself will occur when the agent finishes logging on to the region
// so there's no need to do it here.
//RequestInventoryForUser(userID, userInfo);
m_userProfiles.Add(userID, userInfo); m_userProfiles.Add(userID, userInfo);
} }
else else
{ {
System.Console.WriteLine("CACHE", "User profile for user not found"); MainLog.Instance.Error("USERCACHE", "User profile for user {0} not found", userID);
} }
} }
} }

View File

@ -286,7 +286,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// </summary> /// </summary>
/// <param name="reader">The SQL Result</param> /// <param name="reader">The SQL Result</param>
/// <returns>the item read</returns> /// <returns>the item read</returns>
public InventoryItemBase readInventoryItem(IDataReader reader) private InventoryItemBase readInventoryItem(IDataReader reader)
{ {
try try
{ {

View File

@ -302,7 +302,7 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary> /// </summary>
/// <param name="reader">The SQL Result</param> /// <param name="reader">The SQL Result</param>
/// <returns>the item read</returns> /// <returns>the item read</returns>
public InventoryItemBase readInventoryItem(MySqlDataReader reader) private InventoryItemBase readInventoryItem(MySqlDataReader reader)
{ {
try try
{ {

View File

@ -32,6 +32,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
@ -47,10 +48,10 @@ namespace OpenSim.Region.Communications.OGS1
#region IInventoryServices Members #region IInventoryServices Members
// See IInventoryServices
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
InventoryItemInfo itemCallBack) InventoryItemInfo itemCallBack)
{ {
if (!m_RequestingInventory.ContainsKey(userID)) if (!m_RequestingInventory.ContainsKey(userID))
{ {
InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack);
@ -59,30 +60,46 @@ namespace OpenSim.Region.Communications.OGS1
} }
} }
/// <summary>
/// Request the entire user's inventory (folders and items) from the inventory server.
///
/// XXX May want to change this so that we don't end up shuffling over data which might prove
/// entirely unnecessary.
/// </summary>
/// <param name="userID"></param>
private void RequestInventory(LLUUID userID) private void RequestInventory(LLUUID userID)
{ {
try try
{ {
Console.WriteLine("Requesting Inventory from Inventory server ( " + _inventoryServerUrl + "/GetInventory/" +" ) for " + userID.ToString()); MainLog.Instance.Verbose(
RestObjectPosterResponse<InventoryCollection> requester = new RestObjectPosterResponse<InventoryCollection>(); "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}",
_inventoryServerUrl, userID);
RestObjectPosterResponse<InventoryCollection> requester
= new RestObjectPosterResponse<InventoryCollection>();
requester.ResponseCallback = InventoryResponse; requester.ResponseCallback = InventoryResponse;
requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID); requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
Console.WriteLine("Request for Inventory sent");
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e.Message); MainLog.Instance.Error("INVENTORY", e.ToString());
Console.WriteLine(e.StackTrace);
} }
} }
/// <summary>
/// Callback used by the inventory server GetInventory request
/// </summary>
/// <param name="userID"></param>
private void InventoryResponse(InventoryCollection response) private void InventoryResponse(InventoryCollection response)
{ {
LLUUID userID = response.UserID; LLUUID userID = response.UserID;
if (m_RequestingInventory.ContainsKey(userID)) if (m_RequestingInventory.ContainsKey(userID))
{ {
MainLog.Instance.Verbose("INVENTORY",
"Received inventory response for user {0} containing {1} folders and {2} items",
userID, response.Folders.Count, response.AllItems.Count);
InventoryFolderImpl rootFolder = null; InventoryFolderImpl rootFolder = null;
InventoryRequest request = m_RequestingInventory[userID]; InventoryRequest request = m_RequestingInventory[userID];
foreach (InventoryFolderBase folder in response.Folders) foreach (InventoryFolderBase folder in response.Folders)
@ -113,6 +130,13 @@ namespace OpenSim.Region.Communications.OGS1
} }
m_RequestingInventory.Remove(userID); m_RequestingInventory.Remove(userID);
} }
else
{
MainLog.Instance.Warn(
"INVENTORY",
"Received inventory response for {0} for which we do not have a record of requesting!",
userID);
}
} }
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)