Skip to content

Commit

Permalink
Ensure we start the WWAN for web connections in MonoTouch
Browse files Browse the repository at this point in the history
svn path=/branches/mono-2-6/mcs/; revision=152129
  • Loading branch information
Geoff Norton committed Feb 20, 2010
1 parent 2b1392c commit 00a90d8
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions mcs/class/System/System.Net/WebConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ class WebConnection
static PropertyInfo piServer;
static PropertyInfo piTrustFailure;

#if MONOTOUCH
static MethodInfo start_wwan;

static WebConnection ()
{
Type type = Type.GetType ("MonoTouch.ObjCRuntime.Runtime, monotouch");
start_wwan = type.GetMethod ("StartWWAN");
}
#endif

public WebConnection (WebConnectionGroup group, ServicePoint sPoint)
{
this.sPoint = sPoint;
Expand Down Expand Up @@ -136,9 +146,20 @@ void Connect (HttpWebRequest request)
IPHostEntry hostEntry = sPoint.HostEntry;

if (hostEntry == null) {
status = sPoint.UsesProxy ? WebExceptionStatus.ProxyNameResolutionFailure :
WebExceptionStatus.NameResolutionFailure;
return;
#if MONOTOUCH
Console.WriteLine ("start_wwan: {0}", start_wwan);
if (start_wwan != null) {
Console.WriteLine ("Calling start_wwan: {0}", sPoint.Address.ToString ());
start_wwan.Invoke (null, new object [1] { sPoint.Address });
}
if (hostEntry == null) {
#endif
status = sPoint.UsesProxy ? WebExceptionStatus.ProxyNameResolutionFailure :
WebExceptionStatus.NameResolutionFailure;
return;
#if MONOTOUCH
}
#endif
}

WebConnectionData data = Data;
Expand Down

0 comments on commit 00a90d8

Please sign in to comment.