Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ControlClient: Retry the request in case of timeout

The Helper.GetResponse method will retry once if we get a "Gateway
Timeout" HTTP response code.

Also add some additional log output for some error cases.
  • Loading branch information...
commit 27beaafdb282c0721a8350825b1164b8d45119cb 1 parent 9988b56
Bertrand Lorentz bl8 authored
7 src/Mono.Upnp/Mono.Upnp/Mono.Upnp.Internal/ControlClient.cs
@@ -75,12 +75,13 @@ public ControlClient (string serviceType, Uri url, XmlDeserializer deserializer)
75 75 HttpWebResponse response;
76 76 WebException exception;
77 77 try {
78   - response = (HttpWebResponse)request.GetResponse ();
  78 + response = Helper.GetResponse (request);
79 79 exception = null;
80 80 } catch (WebException e) {
81 81 response = e.Response as HttpWebResponse;
82 82 if (response == null) {
83   - // TODO check for timeout
  83 + Log.Error (string.Format (
  84 + "The request for the {0} action request on {1} failed.", actionName, url));
84 85 throw new UpnpControlException (UpnpError.Unknown(), "The invokation failed.", e);
85 86 }
86 87 exception = e;
@@ -137,6 +138,8 @@ public ControlClient (string serviceType, Uri url, XmlDeserializer deserializer)
137 138 "The invokation failed but the service did not provide valid fault information " +
138 139 "(unable to deserialize a UPnPError from the SOAP envelope).", exception);
139 140 }
  141 + Log.Error (string.Format (
  142 + "The invokation for the {0} action request on {1} failed: {2}", actionName, url, envelope.Body.Value.Detail.Value));
140 143 throw new UpnpControlException (envelope.Body.Value.Detail.Value,
141 144 "The invokation failed.", exception);
142 145 }

0 comments on commit 27beaaf

Please sign in to comment.
Something went wrong with that request. Please try again.