diff options
author | David 'Digit' Turner <digit@android.com> | 2010-07-30 15:35:00 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2010-07-30 15:35:00 -0700 |
commit | 9b98dbde344781e93e2bdcfa599428cda2fda41d (patch) | |
tree | 984065a5cd8d66a99000096fb2018f3ba7988320 /android/qemu-setup.c | |
parent | 7fd67eba0b961d94a5d6baa8e3c3de37b729f738 (diff) | |
download | external_qemu-9b98dbde344781e93e2bdcfa599428cda2fda41d.zip external_qemu-9b98dbde344781e93e2bdcfa599428cda2fda41d.tar.gz external_qemu-9b98dbde344781e93e2bdcfa599428cda2fda41d.tar.bz2 |
Better detection of incorrect proxy values when starting the emulator.
Change-Id: I344f06fc16e051359669b8fe9b8dcec0ceca377d
Diffstat (limited to 'android/qemu-setup.c')
-rw-r--r-- | android/qemu-setup.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/android/qemu-setup.c b/android/qemu-setup.c index 4f05c24..9a41c4d 100644 --- a/android/qemu-setup.c +++ b/android/qemu-setup.c @@ -422,19 +422,25 @@ void android_emulation_setup( void ) proxy_name_len = p - env; proxy_port = atoi(p+1); - /* handle the rare case where the proxy name is omitted, e.g. "http://:8080" */ - if (proxy_name_len == 0) { - proxy_name = "localhost"; - proxy_name_len = strlen(proxy_name); - } - D( "setting up http proxy: server=%.*s port=%d", proxy_name_len, proxy_name, proxy_port ); + /* Check that we can connect to the proxy in the next second. + * If not, the proxy setting is probably garbage !! + */ + if ( proxy_check_connection( proxy_name, proxy_name_len, proxy_port, 1000 ) < 0) { + dprint("Could not connect to proxy at %.*s:%d: %s !", + proxy_name_len, proxy_name, proxy_port, errno_str); + dprint("Proxy will be ignored !"); + break; + } + if ( proxy_http_setup( proxy_name, proxy_name_len, proxy_port, option - option_tab, option_tab ) < 0 ) { - dprint( "http proxy setup failed, check your $http_proxy variable"); + dprint( "Http proxy setup failed for '%.*s:%d': %s", + proxy_name_len, proxy_name, proxy_port, errno_str); + dprint( "Proxy will be ignored !"); } } while (0); |