Tweak NAT timeout behavior

* Change "broken pipe" behavior to simply run through the ping loop
  again, rather than be treated as a NAT timeout

Bug: 2615293
Change-Id: I67c3200f148a8c2beda58f812c29af8a726a4b9c
This commit is contained in:
Marc Blank 2010-04-24 10:39:06 -07:00
parent 2f1ce56fc8
commit d8d3719f34

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;
} }