Makes the inventory connectors fully compatible with the old Grid.InventoryServer.
WARNING: interacting with the old server is _much_ slower than interacting with the new one. Grids with the old server will not see any improvements on crossings and TPs, because inventory needs to be fetched from it in its entirety.arthursv
parent
d519f1885f
commit
51e487a172
|
@ -178,30 +178,36 @@ namespace OpenSim.Services.Connectors
|
|||
catch (Exception e)
|
||||
{
|
||||
// Maybe we're talking to an old inventory server. Try this other thing.
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}. Trying RootFolders.",
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.",
|
||||
e.Source, e.Message);
|
||||
|
||||
try
|
||||
{
|
||||
folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
InventoryCollection inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
folders = inventory.Folders;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.",
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.",
|
||||
e.Source, ex.Message);
|
||||
}
|
||||
|
||||
if ((folders != null) && (folders.Count > 0))
|
||||
{
|
||||
dFolders[AssetType.Folder] = folders[0]; // Root folder is the first one
|
||||
folders.RemoveAt(0);
|
||||
m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}",
|
||||
folders.Count, userID);
|
||||
foreach (InventoryFolderBase f in folders)
|
||||
{
|
||||
if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown))
|
||||
dFolders[(AssetType)f.Type] = f;
|
||||
}
|
||||
|
||||
UUID rootFolderID = dFolders[AssetType.Animation].ParentID;
|
||||
InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID));
|
||||
rootFolder = QueryFolder(userID, rootFolder, sessionID);
|
||||
dFolders[AssetType.Folder] = rootFolder;
|
||||
m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID);
|
||||
return dFolders;
|
||||
}
|
||||
}
|
||||
|
@ -226,48 +232,48 @@ namespace OpenSim.Services.Connectors
|
|||
catch (Exception e)
|
||||
{
|
||||
// Maybe we're talking to an old inventory server. Try this other thing.
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}. Trying RootFolders and GetItems.",
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?). Trying GetInventory.",
|
||||
e.Source, e.Message);
|
||||
|
||||
InventoryCollection inventory;
|
||||
List<InventoryFolderBase> folders = null;
|
||||
try
|
||||
{
|
||||
folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
if (inventory != null)
|
||||
folders = inventory.Folders;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.",
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.",
|
||||
e.Source, ex.Message);
|
||||
return new InventoryCollection();
|
||||
}
|
||||
|
||||
if ((folders != null) && (folders.Count > 0))
|
||||
{
|
||||
folders = folders.FindAll(delegate (InventoryFolderBase f) { return f.ParentID == folderID ; });
|
||||
m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}",
|
||||
folders.Count, userID);
|
||||
|
||||
try
|
||||
folders = folders.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == folderID; });
|
||||
List<InventoryItemBase> items = inventory.Items;
|
||||
if (items != null)
|
||||
{
|
||||
List<InventoryItemBase> items = SynchronousRestSessionObjectPoster<Guid, List<InventoryItemBase>>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/GetItems/", folderID.Guid, sessionID.ToString(), userID.ToString());
|
||||
items = items.FindAll(delegate(InventoryItemBase i) { return i.Folder == folderID; });
|
||||
}
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
InventoryCollection result = new InventoryCollection();
|
||||
result.Folders = folders;
|
||||
result.Items = items;
|
||||
result.UserID = new UUID(userID);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: QueryFolder and GetItems operation failed, {0} {1}. Give up.",
|
||||
e.Source, ex.Message);
|
||||
}
|
||||
inventory.Items = items;
|
||||
inventory.Folders = folders;
|
||||
return inventory;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
InventoryCollection nullCollection = new InventoryCollection();
|
||||
nullCollection.Folders = new List<InventoryFolderBase>();
|
||||
nullCollection.Items = new List<InventoryItemBase>();
|
||||
nullCollection.UserID = new UUID(userID);
|
||||
return nullCollection;
|
||||
}
|
||||
|
||||
public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID)
|
||||
|
|
Loading…
Reference in New Issue