am a39b643d: am e1b5e857: Merge change I2b0e3b10 into eclair

Merge commit 'a39b643d79180ab8f91aa4b1ae28d0b0b768834e' into eclair-mr2-plus-aosp

* commit 'a39b643d79180ab8f91aa4b1ae28d0b0b768834e':
  Help with another push inconsistency edge case (#2131432)
This commit is contained in:
Marc Blank 2009-10-06 23:00:28 -07:00 committed by Android Git Automerger
commit f6fda92606

View File

@ -141,6 +141,8 @@ public class EasSyncService extends AbstractSyncService {
private int mPingHighWaterMark = 0; private int mPingHighWaterMark = 0;
// Whether we've ever lowered the heartbeat // Whether we've ever lowered the heartbeat
private boolean mPingHeartbeatDropped = false; private boolean mPingHeartbeatDropped = false;
// Whether a POST was aborted due to watchdog timeout
private boolean mAborted = false;
public EasSyncService(Context _context, Mailbox _mailbox) { public EasSyncService(Context _context, Mailbox _mailbox) {
super(_context, _mailbox); super(_context, _mailbox);
@ -164,6 +166,7 @@ public class EasSyncService extends AbstractSyncService {
synchronized(getSynchronizer()) { synchronized(getSynchronizer()) {
if (mPendingPost != null) { if (mPendingPost != null) {
userLog("Aborting pending POST!"); userLog("Aborting pending POST!");
mAborted = true;
mPendingPost.abort(); mPendingPost.abort();
} }
} }
@ -769,7 +772,8 @@ public class EasSyncService extends AbstractSyncService {
// haven't yet "fixed" the timeout, back off by two minutes and "fix" it // haven't yet "fixed" the timeout, back off by two minutes and "fix" it
boolean hasMessage = message != null; boolean hasMessage = message != null;
userLog("IOException runPingLoop: " + (hasMessage ? message : "[no message]")); userLog("IOException runPingLoop: " + (hasMessage ? message : "[no message]"));
if (hasMessage && message.contains("reset by peer")) { if (mAborted || (hasMessage && message.contains("reset by peer"))) {
long pingLength = SystemClock.elapsedRealtime() - pingTime;
if ((pingHeartbeat > PING_MIN_HEARTBEAT) && if ((pingHeartbeat > PING_MIN_HEARTBEAT) &&
(pingHeartbeat > mPingHighWaterMark)) { (pingHeartbeat > mPingHighWaterMark)) {
pingHeartbeat -= PING_HEARTBEAT_INCREMENT; pingHeartbeat -= PING_HEARTBEAT_INCREMENT;
@ -778,8 +782,8 @@ public class EasSyncService extends AbstractSyncService {
pingHeartbeat = PING_MIN_HEARTBEAT; pingHeartbeat = PING_MIN_HEARTBEAT;
} }
userLog("Decreased ping heartbeat to ", pingHeartbeat, "s"); userLog("Decreased ping heartbeat to ", pingHeartbeat, "s");
} else if ((SystemClock.elapsedRealtime() - pingTime) < 2000) { } else if (mAborted || (pingLength < 2000)) {
userLog("NAT type IOException < 2 seconds; throwing IOException"); userLog("Abort or NAT type return < 2 seconds; throwing IOException");
throw e; throw e;
} else { } else {
userLog("NAT type IOException > 2 seconds?"); userLog("NAT type IOException > 2 seconds?");