diff options
author | David Turner <digit@android.com> | 2011-08-18 14:08:14 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-08-18 14:08:14 -0700 |
commit | 14ee41d3268911e97e6fc4f417ac424336847f0a (patch) | |
tree | 828ad40f183adc761c5793d25e0d3e373d7f90b0 | |
parent | 852434e616aba0607e71143022e8b7cb2362e639 (diff) | |
parent | 9aaef409bcb7b13df98ce20284d4b12345207d01 (diff) | |
download | external_qemu-14ee41d3268911e97e6fc4f417ac424336847f0a.zip external_qemu-14ee41d3268911e97e6fc4f417ac424336847f0a.tar.gz external_qemu-14ee41d3268911e97e6fc4f417ac424336847f0a.tar.bz2 |
Merge "Fix internet connectivity of emulator over proxy" into tools_r13
-rw-r--r-- | slirp-android/tcp_subr.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/slirp-android/tcp_subr.c b/slirp-android/tcp_subr.c index cfcc3cb..a679013 100644 --- a/slirp-android/tcp_subr.c +++ b/slirp-android/tcp_subr.c @@ -413,6 +413,7 @@ int is_qemu_special_address(unsigned long dst_addr, unsigned long *redir_addr) int tcp_fconnect(struct socket *so) { int ret=0; + int try_proxy = 0; SockAddress sockaddr; unsigned long sock_ip; int sock_port; @@ -518,13 +519,7 @@ int tcp_fconnect(struct socket *so) /* A normal connection - keep the original destination addr/port */ else { - if (!proxy_manager_add(&sockaddr, SOCKET_STREAM, - (ProxyEventFunc) tcp_proxy_event, so)) { - soisfconnecting(so); - so->s = -1; - so->so_state |= SS_PROXIFIED; - return 0; - } + try_proxy = 1; sock_ip = so->so_faddr_ip; /* original dst addr */ sock_port= so->so_faddr_port; /* original dst port */ @@ -536,6 +531,16 @@ int tcp_fconnect(struct socket *so) sock_address_init_inet( &sockaddr, sock_ip, sock_port ); + if (try_proxy) { + if (!proxy_manager_add(&sockaddr, SOCKET_STREAM, + (ProxyEventFunc) tcp_proxy_event, so)) { + soisfconnecting(so); + so->s = -1; + so->so_state |= SS_PROXIFIED; + return 0; + } + } + /* We don't care what port we get */ socket_connect(s, &sockaddr); |