summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2009-08-27 18:45:21 +0800
committerHung-ying Tyan <tyanh@google.com>2009-08-28 09:59:39 +0800
commitcef28e74afea535c038910d129a1dbe15969c49e (patch)
tree4a44caa3364639138433f6a497cba19f351e3d64 /packages
parent3cff76aaa893049d02467a231d477e86a0f80daa (diff)
downloadframeworks_base-cef28e74afea535c038910d129a1dbe15969c49e.zip
frameworks_base-cef28e74afea535c038910d129a1dbe15969c49e.tar.gz
frameworks_base-cef28e74afea535c038910d129a1dbe15969c49e.tar.bz2
Simplifies err code propagation.
* Other changes + Re-assign err codes in VpnManager. + Add new err codes: REMOTE_PPP_HUNG_UP, PPP_NEGOTIATION_FAILED. + Delete the state file only if it exists (to prevent logging an unable-to-unlink error). + Extend timeout to 40 seconds.
Diffstat (limited to 'packages')
-rw-r--r--packages/VpnServices/src/com/android/server/vpn/VpnService.java24
-rw-r--r--packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java3
2 files changed, 5 insertions, 22 deletions
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/packages/VpnServices/src/com/android/server/vpn/VpnService.java
index e3ac996..53167f6 100644
--- a/packages/VpnServices/src/com/android/server/vpn/VpnService.java
+++ b/packages/VpnServices/src/com/android/server/vpn/VpnService.java
@@ -56,10 +56,6 @@ abstract class VpnService<E extends VpnProfile> implements Serializable {
private static final String REMOTE_IP = "net.ipremote";
private static final String DNS_DOMAIN_SUFFICES = "net.dns.search";
- private static final int CHALLENGE_ERROR_CODE = 5;
- private static final int REMOTE_HUNG_UP_ERROR_CODE = 7;
- private static final int AUTH_ERROR_CODE = 51;
-
private final String TAG = VpnService.class.getSimpleName();
// FIXME: profile is only needed in connecting phase, so we can just save
@@ -202,7 +198,7 @@ abstract class VpnService<E extends VpnProfile> implements Serializable {
private void waitUntilConnectedOrTimedout() throws IOException {
sleep(2000); // 2 seconds
- for (int i = 0; i < 60; i++) {
+ for (int i = 0; i < 80; i++) {
if (mState != VpnState.CONNECTING) {
break;
} else if (VPN_IS_UP.equals(
@@ -464,22 +460,8 @@ abstract class VpnService<E extends VpnProfile> implements Serializable {
synchronized int getSocketError() {
for (DaemonProxy s : mDaemonList) {
- switch (getResultFromSocket(s)) {
- case 0:
- continue;
-
- case AUTH_ERROR_CODE:
- return VpnManager.VPN_ERROR_AUTH;
-
- case CHALLENGE_ERROR_CODE:
- return VpnManager.VPN_ERROR_CHALLENGE;
-
- case REMOTE_HUNG_UP_ERROR_CODE:
- return VpnManager.VPN_ERROR_REMOTE_HUNG_UP;
-
- default:
- return VpnManager.VPN_ERROR_CONNECTION_FAILED;
- }
+ int errCode = getResultFromSocket(s);
+ if (errCode != 0) return errCode;
}
return 0;
}
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
index 4892a7b..e5be847 100644
--- a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
+++ b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
@@ -91,7 +91,8 @@ public class VpnServiceBinder extends Service {
void removeStates() {
try {
- new File(STATES_FILE_PATH).delete();
+ File f = new File(STATES_FILE_PATH);
+ if (f.exists()) f.delete();
} catch (Throwable e) {
if (DBG) Log.d("VpnServiceBinder", " remove states: " + e);
}