* 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 brutal0.6.0-stable
parent
18f9f1410d
commit
78e24380c8
|
@ -36,6 +36,16 @@ namespace OpenSim.Framework.Servers
|
||||||
{
|
{
|
||||||
public class SynchronousRestObjectPoster
|
public class SynchronousRestObjectPoster
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Perform a synchronous REST request.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="verb"></param>
|
||||||
|
/// <param name="requestUrl"></param>
|
||||||
|
/// <param name="obj"> </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
///
|
||||||
|
/// <exception cref="System.Net.WebException">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</exception>
|
||||||
public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||||
{
|
{
|
||||||
Type type = typeof (TRequest);
|
Type type = typeof (TRequest);
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
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);
|
_inventoryServerUrl, userID);
|
||||||
|
|
||||||
RestObjectPosterResponse<InventoryCollection> requester
|
RestObjectPosterResponse<InventoryCollection> requester
|
||||||
|
@ -83,9 +83,10 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
|
|
||||||
requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
|
requester.BeginPostObject<Guid>(_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;
|
LLUUID userID = response.UserID;
|
||||||
if (m_RequestingInventory.ContainsKey(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",
|
"Received inventory response for user {0} containing {1} folders and {2} items",
|
||||||
userID, response.Folders.Count, response.AllItems.Count);
|
userID, response.Folders.Count, response.AllItems.Count);
|
||||||
|
|
||||||
|
@ -135,35 +136,67 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[INVENTORY]: " +
|
"[OGS1 INVENTORY SERVICE]: " +
|
||||||
"Received inventory response for {0} for which we do not have a record of requesting!",
|
"Received inventory response for {0} for which we do not have a record of requesting!",
|
||||||
userID);
|
userID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
|
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
|
||||||
"POST", _inventoryServerUrl + "/NewFolder/", folder);
|
"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)
|
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
|
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
|
||||||
"POST", _inventoryServerUrl + "/MoveFolder/", folder);
|
"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)
|
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
|
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
|
||||||
"POST", _inventoryServerUrl + "/NewItem/", item);
|
"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)
|
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
|
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
|
||||||
"POST", _inventoryServerUrl + "/DeleteItem/", item);
|
"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)
|
public bool HasInventoryForUser(LLUUID userID)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue