Chromium Code Reviews| Index: net/base/host_resolver.cc |
| diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc |
| index 873fdcd0399c242d085eacd2161c71c986625f23..23a1c00940e75c1c9a5fcf36ad386789eb48b3ad 100644 |
| --- a/net/base/host_resolver.cc |
| +++ b/net/base/host_resolver.cc |
| @@ -11,6 +11,9 @@ |
| #include <netdb.h> |
| #include <sys/socket.h> |
| #endif |
| +#if defined(OS_LINUX) |
| +#include <resolv.h> |
| +#endif |
| #include "base/message_loop.h" |
| #include "base/string_util.h" |
| @@ -72,6 +75,13 @@ static int HostResolverProc( |
| hints.ai_socktype = SOCK_STREAM; |
| int err = getaddrinfo(host.c_str(), port.c_str(), &hints, out); |
| +#if defined(OS_LINUX) |
| + // If we fail, re-initialise the resolver just in case there have been any |
| + // changes to /etc/resolv.conf and retry. See http://crbug.com/11380 for info. |
| + if (err && !res_init()) |
|
darin (slow to review)
2009/05/27 19:23:11
please use res_ninit instead, which is threadsafe.
|
| + err = getaddrinfo(host.c_str(), port.c_str(), &hints, out); |
| +#endif |
| + |
| return err ? ERR_NAME_NOT_RESOLVED : OK; |
| } |