diff options
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs index 3d3340f..451575f 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs | |||
@@ -92,6 +92,7 @@ namespace OpenSim.Capabilities.Handlers | |||
92 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | 92 | ArrayList foldersrequested = (ArrayList)hash["folders"]; |
93 | 93 | ||
94 | string response = ""; | 94 | string response = ""; |
95 | string bad_folders_response = ""; | ||
95 | 96 | ||
96 | for (int i = 0; i < foldersrequested.Count; i++) | 97 | for (int i = 0; i < foldersrequested.Count; i++) |
97 | { | 98 | { |
@@ -110,24 +111,42 @@ namespace OpenSim.Capabilities.Handlers | |||
110 | } | 111 | } |
111 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | 112 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); |
112 | 113 | ||
113 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | 114 | if (null == reply) |
114 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | 115 | { |
115 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | 116 | bad_folders_response += "<uuid>" + llsdRequest.folder_id.ToString() + "</uuid>"; |
117 | } | ||
118 | else | ||
119 | { | ||
120 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
121 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
122 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
123 | } | ||
116 | 124 | ||
117 | response += inventoryitemstr; | 125 | response += inventoryitemstr; |
118 | } | 126 | } |
119 | 127 | ||
120 | if (response.Length == 0) | 128 | if (response.Length == 0) |
121 | { | 129 | { |
122 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | 130 | /* Viewers expect a bad_folders array when not available */ |
123 | // Therefore, I'm concluding that the client only has so many threads available to do requests | 131 | if (bad_folders_response.Length != 0) |
124 | // and when a thread stalls.. is stays stalled. | 132 | { |
125 | // Therefore we need to return something valid | 133 | response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; |
126 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | 134 | } |
135 | else | ||
136 | { | ||
137 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
138 | } | ||
127 | } | 139 | } |
128 | else | 140 | else |
129 | { | 141 | { |
130 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | 142 | if (bad_folders_response.Length != 0) |
143 | { | ||
144 | response = "<llsd><map><key>folders</key><array>" + response + "</array><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
149 | } | ||
131 | } | 150 | } |
132 | 151 | ||
133 | // m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request"); | 152 | // m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request"); |