aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-03-18 19:52:07 +0000
committerJustin Clarke Casey2008-03-18 19:52:07 +0000
commit78e24380c8147e897072023f1dd76c895a42335d (patch)
treeb8582a939da17fff5296b2522599adc568f61bd5
parent* Just inserting some exploratory comments into inventory code (diff)
downloadopensim-SC-78e24380c8147e897072023f1dd76c895a42335d.zip
opensim-SC-78e24380c8147e897072023f1dd76c895a42335d.tar.gz
opensim-SC-78e24380c8147e897072023f1dd76c895a42335d.tar.bz2
opensim-SC-78e24380c8147e897072023f1dd76c895a42335d.tar.xz
* Stop grid inventory network failures crashing the client session
* Now the operation will just fail and post a message to the log instead, which may be mysterious to the client but isn't so brutal
-rw-r--r--OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs10
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs59
2 files changed, 56 insertions, 13 deletions
diff --git a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
index bf51d50..1b8e4ea 100644
--- a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
+++ b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
@@ -36,6 +36,16 @@ namespace OpenSim.Framework.Servers
36{ 36{
37 public class SynchronousRestObjectPoster 37 public class SynchronousRestObjectPoster
38 { 38 {
39 /// <summary>
40 /// Perform a synchronous REST request.
41 /// </summary>
42 /// <param name="verb"></param>
43 /// <param name="requestUrl"></param>
44 /// <param name="obj"> </param>
45 /// <returns></returns>
46 ///
47 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
48 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
39 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 49 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
40 { 50 {
41 Type type = typeof (TRequest); 51 Type type = typeof (TRequest);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 19ed940..3551172 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Communications.OGS1
74 try 74 try
75 { 75 {
76 m_log.InfoFormat( 76 m_log.InfoFormat(
77 "[INVENTORY]: Requesting inventory from {0}/GetInventory/ for user {1}", 77 "[OGS1 INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1}",
78 _inventoryServerUrl, userID); 78 _inventoryServerUrl, userID);
79 79
80 RestObjectPosterResponse<InventoryCollection> requester 80 RestObjectPosterResponse<InventoryCollection> requester
@@ -83,9 +83,10 @@ namespace OpenSim.Region.Communications.OGS1
83 83
84 requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID); 84 requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
85 } 85 }
86 catch (Exception e) 86 catch (System.Net.WebException e)
87 { 87 {
88 m_log.Error("[INVENTORY]: " + e.ToString()); 88 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Request inventory operation failed, {0} {1}",
89 e.Source, e.Message);
89 } 90 }
90 } 91 }
91 92
@@ -98,7 +99,7 @@ namespace OpenSim.Region.Communications.OGS1
98 LLUUID userID = response.UserID; 99 LLUUID userID = response.UserID;
99 if (m_RequestingInventory.ContainsKey(userID)) 100 if (m_RequestingInventory.ContainsKey(userID))
100 { 101 {
101 m_log.InfoFormat("[INVENTORY]: " + 102 m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " +
102 "Received inventory response for user {0} containing {1} folders and {2} items", 103 "Received inventory response for user {0} containing {1} folders and {2} items",
103 userID, response.Folders.Count, response.AllItems.Count); 104 userID, response.Folders.Count, response.AllItems.Count);
104 105
@@ -135,7 +136,7 @@ namespace OpenSim.Region.Communications.OGS1
135 else 136 else
136 { 137 {
137 m_log.WarnFormat( 138 m_log.WarnFormat(
138 "[INVENTORY]: " + 139 "[OGS1 INVENTORY SERVICE]: " +
139 "Received inventory response for {0} for which we do not have a record of requesting!", 140 "Received inventory response for {0} for which we do not have a record of requesting!",
140 userID); 141 userID);
141 } 142 }
@@ -143,26 +144,58 @@ namespace OpenSim.Region.Communications.OGS1
143 144
144 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) 145 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
145 { 146 {
146 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( 147 try
147 "POST", _inventoryServerUrl + "/NewFolder/", folder); 148 {
149 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
150 "POST", _inventoryServerUrl + "/NewFolder/", folder);
151 }
152 catch (System.Net.WebException e)
153 {
154 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
155 e.Source, e.Message);
156 }
148 } 157 }
149 158
150 public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) 159 public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
151 { 160 {
152 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( 161 try
153 "POST", _inventoryServerUrl + "/MoveFolder/", folder); 162 {
163 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
164 "POST", _inventoryServerUrl + "/MoveFolder/", folder);
165 }
166 catch (System.Net.WebException e)
167 {
168 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
169 e.Source, e.Message);
170 }
154 } 171 }
155 172
156 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 173 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
157 { 174 {
158 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( 175 try
159 "POST", _inventoryServerUrl + "/NewItem/", item); 176 {
177 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
178 "POST", _inventoryServerUrl + "/NewItem/", item);
179 }
180 catch (System.Net.WebException e)
181 {
182 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
183 e.Source, e.Message);
184 }
160 } 185 }
161 186
162 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 187 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
163 { 188 {
164 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( 189 try
165 "POST", _inventoryServerUrl + "/DeleteItem/", item); 190 {
191 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
192 "POST", _inventoryServerUrl + "/DeleteItem/", item);
193 }
194 catch (System.Net.WebException e)
195 {
196 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
197 e.Source, e.Message);
198 }
166 } 199 }
167 200
168 public bool HasInventoryForUser(LLUUID userID) 201 public bool HasInventoryForUser(LLUUID userID)