diff options
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 50ce3ea..ae15cfb 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Services.Connectors | |||
47 | private string m_ServerURI = String.Empty; | 47 | private string m_ServerURI = String.Empty; |
48 | 48 | ||
49 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); | 49 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); |
50 | private Dictionary<UUID, DateTime> m_RequestTime = new Dictionary<UUID, DateTime>(); | ||
50 | 51 | ||
51 | public InventoryServicesConnector() | 52 | public InventoryServicesConnector() |
52 | { | 53 | { |
@@ -102,12 +103,43 @@ namespace OpenSim.Services.Connectors | |||
102 | { | 103 | { |
103 | lock (m_RequestingInventory) | 104 | lock (m_RequestingInventory) |
104 | { | 105 | { |
105 | if (!m_RequestingInventory.ContainsKey(userID)) | 106 | // *HACK ALERT* |
106 | m_RequestingInventory.Add(userID, callback); | 107 | |
107 | else | 108 | // If an inventory request times out, it blocks any further requests from the |
109 | // same user, even after a relog. This is bad, and makes me sad. | ||
110 | |||
111 | // Really, we should detect a timeout and report a failure to the callback, | ||
112 | // BUT in my testing i found that it's hard to detect a timeout.. sometimes, | ||
113 | // a partial response is recieved, and sometimes a null response. | ||
114 | |||
115 | // So, for now, add a timer of ten seconds (which is the request timeout). | ||
116 | |||
117 | // This should basically have the same effect. | ||
118 | |||
119 | lock (m_RequestTime) | ||
108 | { | 120 | { |
109 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetUserInventory - ignoring repeated request for user {0}", userID); | 121 | if (m_RequestTime.ContainsKey(userID)) |
110 | return; | 122 | { |
123 | TimeSpan interval = DateTime.Now - m_RequestTime[userID]; | ||
124 | if (interval.TotalSeconds > 10) | ||
125 | { | ||
126 | m_RequestTime.Remove(userID); | ||
127 | if (m_RequestingInventory.ContainsKey(userID)) | ||
128 | { | ||
129 | m_RequestingInventory.Remove(userID); | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | if (!m_RequestingInventory.ContainsKey(userID)) | ||
134 | { | ||
135 | m_RequestTime.Add(userID, DateTime.Now); | ||
136 | m_RequestingInventory.Add(userID, callback); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetUserInventory - ignoring repeated request for user {0}", userID); | ||
141 | return; | ||
142 | } | ||
111 | } | 143 | } |
112 | } | 144 | } |
113 | 145 | ||
@@ -283,6 +315,13 @@ namespace OpenSim.Services.Connectors | |||
283 | { | 315 | { |
284 | callback = m_RequestingInventory[userID]; | 316 | callback = m_RequestingInventory[userID]; |
285 | m_RequestingInventory.Remove(userID); | 317 | m_RequestingInventory.Remove(userID); |
318 | lock (m_RequestTime) | ||
319 | { | ||
320 | if (m_RequestTime.ContainsKey(userID)) | ||
321 | { | ||
322 | m_RequestTime.Remove(userID); | ||
323 | } | ||
324 | } | ||
286 | } | 325 | } |
287 | else | 326 | else |
288 | { | 327 | { |