[runtime] Always expire a non-resolved hostname's cache
authorAlexander Kyte <alkyte@microsoft.com>
Mon, 19 Dec 2016 20:03:21 +0000 (15:03 -0500)
committerMarek Safar <marek.safar@gmail.com>
Wed, 21 Dec 2016 10:06:03 +0000 (11:06 +0100)
This addresses a regression here:

https://bugzilla.xamarin.com/show_bug.cgi?id=45761

The commits
97e51abfcfd87bb5ed12c04df030730a8590cbed and
d35b5d218894e15cec84273d77cf4a61985edb5f

changed control flow such that if the host can't be resolved
and host is set to null, then the later check will return null
for the duration that HasTimedOut is false.

mcs/class/System/System.Net/ServicePoint.cs

index 953da503f1931c2a18e7b31d393775d8d70ffa58..9b6cc5cc5e4d39b218d617e542910fb2fdb1bab6 100644 (file)
@@ -361,7 +361,7 @@ namespace System.Net
                                                return host;
                                        }
 
-                                       if (!HasTimedOut)
+                                       if (!HasTimedOut && host != null)
                                                return host;
 
                                        lastDnsResolve = DateTime.UtcNow;