From 78e24380c8147e897072023f1dd76c895a42335d Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Tue, 18 Mar 2008 19:52:07 +0000
Subject: * 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
---
.../Servers/SynchronousRestObjectPoster.cs | 10 ++++
.../Communications/OGS1/OGS1InventoryService.cs | 59 +++++++++++++++++-----
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
{
public class SynchronousRestObjectPoster
{
+ ///
+ /// Perform a synchronous REST request.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown if we encounter a network issue while posting
+ /// the request. You'll want to make sure you deal with this as they're not uncommon
public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj)
{
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
try
{
m_log.InfoFormat(
- "[INVENTORY]: Requesting inventory from {0}/GetInventory/ for user {1}",
+ "[OGS1 INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1}",
_inventoryServerUrl, userID);
RestObjectPosterResponse requester
@@ -83,9 +83,10 @@ namespace OpenSim.Region.Communications.OGS1
requester.BeginPostObject(_inventoryServerUrl + "/GetInventory/", userID.UUID);
}
- catch (Exception e)
+ catch (System.Net.WebException e)
{
- m_log.Error("[INVENTORY]: " + e.ToString());
+ m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Request inventory operation failed, {0} {1}",
+ e.Source, e.Message);
}
}
@@ -98,7 +99,7 @@ namespace OpenSim.Region.Communications.OGS1
LLUUID userID = response.UserID;
if (m_RequestingInventory.ContainsKey(userID))
{
- m_log.InfoFormat("[INVENTORY]: " +
+ m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " +
"Received inventory response for user {0} containing {1} folders and {2} items",
userID, response.Folders.Count, response.AllItems.Count);
@@ -135,7 +136,7 @@ namespace OpenSim.Region.Communications.OGS1
else
{
m_log.WarnFormat(
- "[INVENTORY]: " +
+ "[OGS1 INVENTORY SERVICE]: " +
"Received inventory response for {0} for which we do not have a record of requesting!",
userID);
}
@@ -143,26 +144,58 @@ namespace OpenSim.Region.Communications.OGS1
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
- SynchronousRestObjectPoster.BeginPostObject(
- "POST", _inventoryServerUrl + "/NewFolder/", folder);
+ try
+ {
+ SynchronousRestObjectPoster.BeginPostObject(
+ "POST", _inventoryServerUrl + "/NewFolder/", folder);
+ }
+ catch (System.Net.WebException e)
+ {
+ m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
+ e.Source, e.Message);
+ }
}
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
- SynchronousRestObjectPoster.BeginPostObject(
- "POST", _inventoryServerUrl + "/MoveFolder/", folder);
+ try
+ {
+ SynchronousRestObjectPoster.BeginPostObject(
+ "POST", _inventoryServerUrl + "/MoveFolder/", folder);
+ }
+ catch (System.Net.WebException e)
+ {
+ m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
+ e.Source, e.Message);
+ }
}
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
- SynchronousRestObjectPoster.BeginPostObject(
- "POST", _inventoryServerUrl + "/NewItem/", item);
+ try
+ {
+ SynchronousRestObjectPoster.BeginPostObject(
+ "POST", _inventoryServerUrl + "/NewItem/", item);
+ }
+ catch (System.Net.WebException e)
+ {
+ m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
+ e.Source, e.Message);
+ }
}
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
- SynchronousRestObjectPoster.BeginPostObject(
- "POST", _inventoryServerUrl + "/DeleteItem/", item);
+ try
+ {
+ SynchronousRestObjectPoster.BeginPostObject(
+ "POST", _inventoryServerUrl + "/DeleteItem/", item);
+ }
+ catch (System.Net.WebException e)
+ {
+ m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
+ e.Source, e.Message);
+ }
}
public bool HasInventoryForUser(LLUUID userID)
--
cgit v1.1