diff options
author | Justin Clarke Casey | 2008-04-11 18:13:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-04-11 18:13:10 +0000 |
commit | a5176c2e2c4d2791ec15a22db4309bb15bc3ae98 (patch) | |
tree | bbadbbd793ebda546831e9541e312d480d5dae0c /OpenSim/Region/Communications/Local/LocalInventoryService.cs | |
parent | * fix bug 935 (diff) | |
download | opensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.zip opensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.gz opensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.bz2 opensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.xz |
* Change inventory async response deliver to deliver all items and folders at once, rather than each individual
* This is required in order to work towards eliminating some inventory race conditions and to better deal with situations where a grid inventory server is slow or not responding.
Diffstat (limited to 'OpenSim/Region/Communications/Local/LocalInventoryService.cs')
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalInventoryService.cs | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index bb3db9d..13cb6de 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -39,32 +39,38 @@ namespace OpenSim.Region.Communications.Local | |||
39 | /// </summary> | 39 | /// </summary> |
40 | public class LocalInventoryService : InventoryServiceBase | 40 | public class LocalInventoryService : InventoryServiceBase |
41 | { | 41 | { |
42 | public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, | 42 | public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) |
43 | InventoryItemInfo itemCallBack) | ||
44 | { | 43 | { |
45 | List<InventoryFolderBase> folders = GetInventorySkeleton(userID); | 44 | List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID); |
46 | |||
47 | InventoryFolderImpl rootFolder = null; | 45 | InventoryFolderImpl rootFolder = null; |
46 | |||
47 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | ||
48 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
48 | 49 | ||
49 | //need to make sure we send root folder first | 50 | // Need to retrieve the root folder on the first pass |
50 | foreach (InventoryFolderBase folder in folders) | 51 | foreach (InventoryFolderBase folder in skeletonFolders) |
51 | { | 52 | { |
52 | if (folder.ParentID == LLUUID.Zero) | 53 | if (folder.ParentID == LLUUID.Zero) |
53 | { | 54 | { |
54 | rootFolder = RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack); | 55 | //rootFolder = RequestInventoryFolder(userID, folder, callback); |
56 | rootFolder = new InventoryFolderImpl(folder); | ||
57 | folders.Add(rootFolder); | ||
55 | } | 58 | } |
56 | } | 59 | } |
57 | 60 | ||
58 | if (rootFolder != null) | 61 | if (rootFolder != null) |
59 | { | 62 | { |
60 | foreach (InventoryFolderBase folder in folders) | 63 | foreach (InventoryFolderBase folder in skeletonFolders) |
61 | { | 64 | { |
62 | if (folder.ID != rootFolder.ID) | 65 | if (folder.ID != rootFolder.ID) |
63 | { | 66 | { |
64 | RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack); | 67 | //RequestInventoryFolder(userID, folder, callback); |
68 | folders.Add(new InventoryFolderImpl(folder)); | ||
65 | } | 69 | } |
66 | } | 70 | } |
67 | } | 71 | } |
72 | |||
73 | callback(userID, folders, items); | ||
68 | } | 74 | } |
69 | 75 | ||
70 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) | 76 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) |
@@ -99,26 +105,5 @@ namespace OpenSim.Region.Communications.Local | |||
99 | return true; | 105 | return true; |
100 | } | 106 | } |
101 | } | 107 | } |
102 | |||
103 | /// <summary> | ||
104 | /// Send the given inventory folder and its item contents back to the requester. | ||
105 | /// </summary> | ||
106 | /// <param name="userID"></param> | ||
107 | /// <param name="folder"></param> | ||
108 | private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder, | ||
109 | InventoryFolderInfo folderCallBack, | ||
110 | InventoryItemInfo itemCallBack) | ||
111 | { | ||
112 | InventoryFolderImpl newFolder = new InventoryFolderImpl(folder); | ||
113 | folderCallBack(userID, newFolder); | ||
114 | |||
115 | List<InventoryItemBase> items = RequestFolderItems(newFolder.ID); | ||
116 | foreach (InventoryItemBase item in items) | ||
117 | { | ||
118 | itemCallBack(userID, item); | ||
119 | } | ||
120 | |||
121 | return newFolder; | ||
122 | } | ||
123 | } | 108 | } |
124 | } | 109 | } |