aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-13 18:04:01 +0000
committerJustin Clarke Casey2008-06-13 18:04:01 +0000
commitd6519924ba096c569294aa6653e6720629002f8e (patch)
tree1ff575b5ff68e7d418b9e1f73e272804d1cc4410
parent* minor: Remove LINK_SET debug Console Writeline (diff)
downloadopensim-SC_OLD-d6519924ba096c569294aa6653e6720629002f8e.zip
opensim-SC_OLD-d6519924ba096c569294aa6653e6720629002f8e.tar.gz
opensim-SC_OLD-d6519924ba096c569294aa6653e6720629002f8e.tar.bz2
opensim-SC_OLD-d6519924ba096c569294aa6653e6720629002f8e.tar.xz
* refactor: catch asset service request exceptions at the AssetServerBase level rather than in the GridAssetClient
* this is to enable logging of asset request exceptions soon
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs23
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs38
2 files changed, 35 insertions, 26 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index db71079..053cb0f 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -57,6 +57,10 @@ namespace OpenSim.Framework.Communications.Cache
57 /// </summary> 57 /// </summary>
58 /// <param name="req"></param> 58 /// <param name="req"></param>
59 /// <returns></returns> 59 /// <returns></returns>
60 /// <exception cref="System.Exception">
61 /// Thrown if the request failed for some other reason than that the
62 /// asset cannot be found.
63 /// </exception>
60 protected abstract AssetBase GetAsset(AssetRequest req); 64 protected abstract AssetBase GetAsset(AssetRequest req);
61 65
62 /// <summary> 66 /// <summary>
@@ -66,17 +70,30 @@ namespace OpenSim.Framework.Communications.Cache
66 /// <param name="req"></param> 70 /// <param name="req"></param>
67 protected virtual void ProcessRequest(AssetRequest req) 71 protected virtual void ProcessRequest(AssetRequest req)
68 { 72 {
69 AssetBase asset = GetAsset(req); 73 AssetBase asset;
74
75 try
76 {
77 asset = GetAsset(req);
78 }
79 catch (Exception e)
80 {
81 m_log.ErrorFormat("[ASSET]: Asset request for {0} threw exception {1}", req.AssetID, e);
82
83 m_receiver.AssetNotFound(req.AssetID, req.IsTexture);
84
85 return;
86 }
70 87
71 if (asset != null) 88 if (asset != null)
72 { 89 {
73 //m_log.InfoFormat("[ASSETSERVER]: Asset {0} received from asset server", req.AssetID); 90 m_log.DebugFormat("[ASSET]: Asset {0} received from asset server", req.AssetID);
74 91
75 m_receiver.AssetReceived(asset, req.IsTexture); 92 m_receiver.AssetReceived(asset, req.IsTexture);
76 } 93 }
77 else 94 else
78 { 95 {
79 //m_log.ErrorFormat("[ASSET SERVER]: Asset {0} not found by asset server", req.AssetID); 96 m_log.WarnFormat("[ASSET]: Asset {0} not found by asset server", req.AssetID);
80 97
81 m_receiver.AssetNotFound(req.AssetID, req.IsTexture); 98 m_receiver.AssetNotFound(req.AssetID, req.IsTexture);
82 } 99 }
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index 4b4ef17..7787805 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -49,38 +49,30 @@ namespace OpenSim.Framework.Communications.Cache
49 49
50 protected override AssetBase GetAsset(AssetRequest req) 50 protected override AssetBase GetAsset(AssetRequest req)
51 { 51 {
52 Stream s = null; 52 #if DEBUG
53 try 53 //m_log.DebugFormat("[GRID ASSET CLIENT]: Querying for {0}", req.AssetID.ToString());
54 { 54 #endif
55 #if DEBUG
56 //m_log.DebugFormat("[GRID ASSET CLIENT]: Querying for {0}", req.AssetID.ToString());
57 #endif
58 55
59 RestClient rc = new RestClient(_assetServerUrl); 56 RestClient rc = new RestClient(_assetServerUrl);
60 rc.AddResourcePath("assets"); 57 rc.AddResourcePath("assets");
61 rc.AddResourcePath(req.AssetID.ToString()); 58 rc.AddResourcePath(req.AssetID.ToString());
62 if (req.IsTexture) 59 if (req.IsTexture)
63 rc.AddQueryParameter("texture"); 60 rc.AddQueryParameter("texture");
64 61
65 rc.RequestMethod = "GET"; 62 rc.RequestMethod = "GET";
66 s = rc.Request(); 63
64 Stream s = rc.Request();
67 65
68 if (s.Length > 0) 66 if (s.Length > 0)
69 {
70 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
71
72 return (AssetBase) xs.Deserialize(s);
73 }
74 }
75 catch (Exception e)
76 { 67 {
77 m_log.ErrorFormat("[GRID ASSET CLIENT]: Failed to get asset {0}, {1}", req.AssetID, e); 68 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
69
70 return (AssetBase) xs.Deserialize(s);
78 } 71 }
79 72
80 return null; 73 return null;
81 } 74 }
82 75
83
84 public override void UpdateAsset(AssetBase asset) 76 public override void UpdateAsset(AssetBase asset)
85 { 77 {
86 throw new Exception("The method or operation is not implemented."); 78 throw new Exception("The method or operation is not implemented.");