am d8d3719f: Tweak NAT timeout behavior

Merge commit 'd8d3719f34fa2dde9312d3156f7eccfe0fef0584' into froyo-plus-aosp

* commit 'd8d3719f34fa2dde9312d3156f7eccfe0fef0584':
  Tweak NAT timeout behavior
This commit is contained in:
Marc Blank 2010-04-26 10:08:00 -07:00 committed by Android Git Automerger
commit aaa9c6a4d1

View File

@ -1496,14 +1496,14 @@ public class EasSyncService extends AbstractSyncService {
/** /**
* Simplistic attempt to determine a NAT timeout, based on experience with various carriers * Simplistic attempt to determine a NAT timeout, based on experience with various carriers
* and networks. The strings "reset by peer" and "broken pipe" are very common in these * and networks. The string "reset by peer" is very common in these situations, so we look for
* situations, so we look for them specifically (sans the b in broken, in case it's lowercase) * that specifically. We may add additional tests here as more is learned.
* @param message * @param message
* @return whether this message is likely associated with a NAT failure * @return whether this message is likely associated with a NAT failure
*/ */
private boolean isLikelyNatFailure(String message) { private boolean isLikelyNatFailure(String message) {
if (message == null) return false; if (message == null) return false;
if (message.contains("reset by peer") || message.contains("roken pipe")) { if (message.contains("reset by peer")) {
return true; return true;
} }
return false; return false;
@ -1685,6 +1685,10 @@ public class EasSyncService extends AbstractSyncService {
} else { } else {
userLog("NAT type IOException"); userLog("NAT type IOException");
} }
} else if (hasMessage && message.contains("roken pipe")) {
// The "broken pipe" error (uppercase or lowercase "b") seems to be an
// internal error, so let's not throw an exception (which leads to delays)
// but rather simply run through the loop again
} else { } else {
throw e; throw e;
} }