am 9a2686af
: Improve POP sync.
* commit '9a2686afa2e02c62a8e5f9c42c82bd2da70b96af': Improve POP sync.
This commit is contained in:
commit
fdb583ab6c
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user