From 1b0a398763b72a37d386c649f99a7a5596a30aa0 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Fri, 30 Jan 2009 14:45:39 +0000 Subject: reporting original request URI if HttpWebRequest failed, adding try-catch around GetRequestStream (this time for sure) --- .../Modules/Avatar/Concierge/ConciergeModule.cs | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs index 1f07355..d02f6e3 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs @@ -402,12 +402,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge updatePost.ContentLength = payload.Length; updatePost.UserAgent = "OpenSim.Concierge"; - StreamWriter payloadStream = new StreamWriter(updatePost.GetRequestStream()); - payloadStream.Write(payload); - payloadStream.Close(); + try + { + StreamWriter payloadStream = new StreamWriter(updatePost.GetRequestStream()); + payloadStream.Write(payload); + payloadStream.Close(); - updatePost.BeginGetResponse(UpdateBrokerDone, updatePost); - _log.DebugFormat("[Concierge] async broker update to {0} started", uri); + updatePost.BeginGetResponse(UpdateBrokerDone, updatePost); + _log.DebugFormat("[Concierge] async broker POST to {0} started", uri); + } + catch (WebException we) + { + _log.ErrorFormat("[Concierge] async broker POST to {0} failed: {1}", uri, we.Status); + } } private void UpdateBrokerDone(IAsyncResult result) @@ -423,20 +430,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge } catch (WebException we) { - _log.ErrorFormat("[Concierge] broker update to {0} failed with status {1}", _brokerURI, we.Status); + string uri = updatePost.RequestUri.OriginalString; + _log.ErrorFormat("[Concierge] broker update to {0} failed with status {1}", uri, we.Status); if (null != we.Response) { using(HttpWebResponse resp = we.Response as HttpWebResponse) { - _log.ErrorFormat("[Concierge] response from {0} request Uri: {1}", _brokerURI, updatePost.RequestUri); - _log.ErrorFormat("[Concierge] response from {0} status code: {1}", _brokerURI, resp.StatusCode); - _log.ErrorFormat("[Concierge] response from {0} status desc: {1}", _brokerURI, resp.StatusDescription); - _log.ErrorFormat("[Concierge] response from {0} server: {1}", _brokerURI, resp.Server); + _log.ErrorFormat("[Concierge] response from {0} status code: {1}", uri, resp.StatusCode); + _log.ErrorFormat("[Concierge] response from {0} status desc: {1}", uri, resp.StatusDescription); + _log.ErrorFormat("[Concierge] response from {0} server: {1}", uri, resp.Server); if (resp.ContentLength > 0) { StreamReader content = new StreamReader(resp.GetResponseStream()); - _log.ErrorFormat("[Concierge] response from {0} content: {1}", _brokerURI, content.ReadToEnd()); + _log.ErrorFormat("[Concierge] response from {0} content: {1}", uri, content.ReadToEnd()); content.Close(); } } -- cgit v1.1