diff --git a/src/com/android/email/mail/store/ImapConnection.java b/src/com/android/email/mail/store/ImapConnection.java index 68baa4fc3..ee9acfc2a 100644 --- a/src/com/android/email/mail/store/ImapConnection.java +++ b/src/com/android/email/mail/store/ImapConnection.java @@ -106,7 +106,6 @@ class ImapConnection { } mTransport.open(); - mTransport.setSoTimeout(MailTransport.SOCKET_READ_TIMEOUT); createParser(); @@ -498,7 +497,6 @@ class ImapConnection { executeSimpleCommand(ImapConstants.STARTTLS); mTransport.reopenTls(); - mTransport.setSoTimeout(MailTransport.SOCKET_READ_TIMEOUT); createParser(); // Per RFC requirement (3501-6.2.1) gather new capabilities return(queryCapabilities()); diff --git a/src/com/android/email/mail/transport/MailTransport.java b/src/com/android/email/mail/transport/MailTransport.java index 692eef177..128596460 100644 --- a/src/com/android/email/mail/transport/MailTransport.java +++ b/src/com/android/email/mail/transport/MailTransport.java @@ -123,7 +123,7 @@ public class MailTransport { } mIn = new BufferedInputStream(mSocket.getInputStream(), 1024); mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512); - + mSocket.setSoTimeout(SOCKET_READ_TIMEOUT); } catch (SSLException e) { if (MailActivityEmail.DEBUG) { Log.d(Logging.LOG_TAG, e.toString()); diff --git a/src/com/android/email/service/Pop3Service.java b/src/com/android/email/service/Pop3Service.java index 1f2cfdedd..e16ed00bc 100644 --- a/src/com/android/email/service/Pop3Service.java +++ b/src/com/android/email/service/Pop3Service.java @@ -205,8 +205,10 @@ public class Pop3Service extends Service { // We'll load them from most recent to oldest for (int i = cnt - 1; i >= 0; i--) { Pop3Message message = unsyncedMessages.get(i); - remoteFolder.fetchBody(message, Pop3Store.FETCH_BODY_SANE_SUGGESTED_SIZE / 76, - null); + // TODO: this fetches the entire message at once. This should go back to trying + // to avoid downloading attachments initially. Specifically, the second argument + // below used to be Pop3Store.FETCH_BODY_SANE_SUGGESTED_SIZE / 76 + remoteFolder.fetchBody(message, -1, null); int flag = EmailContent.Message.FLAG_LOADED_COMPLETE; if (!message.isComplete()) { flag = EmailContent.Message.FLAG_LOADED_UNKNOWN; @@ -266,10 +268,8 @@ public class Pop3Service extends Service { localUidCursor = resolver.query( EmailContent.Message.CONTENT_URI, LocalMessageInfo.PROJECTION, - EmailContent.MessageColumns.ACCOUNT_KEY + "=?" + - " AND " + MessageColumns.MAILBOX_KEY + "=?", + MessageColumns.MAILBOX_KEY + "=?", new String[] { - String.valueOf(account.mId), String.valueOf(mailbox.mId) }, null); @@ -356,9 +356,9 @@ public class Pop3Service extends Service { remoteUidMap.put(uid, message); LocalMessageInfo localMessage = localMessageMap.get(uid); // localMessage == null -> message has never been created (not even headers) - // mFlagLoaded = UNLOADED -> message created, but none of body loaded + // mFlagLoaded != FLAG_LOADED_COMPLETE -> message failed to sync completely if (localMessage == null || - (localMessage.mFlagLoaded == EmailContent.Message.FLAG_LOADED_UNLOADED)) { + (localMessage.mFlagLoaded != EmailContent.Message.FLAG_LOADED_COMPLETE)) { unsyncedMessages.add(message); } } @@ -366,6 +366,7 @@ public class Pop3Service extends Service { if (MailActivityEmail.DEBUG) { Log.d(TAG, "*** Message count is zero??"); } + remoteFolder.close(false); return; }