Revert "add-ons/mail_daemon: IMAP: limit UIDs in UID FETCH"

This reverts commit ed08b22dec.

See discussion on the commits mailing list (and on IRC.)
This commit is contained in:
waddlesplash
2018-11-07 19:03:30 -05:00
parent 3a469b95be
commit 2cf9765df8
@@ -21,7 +21,6 @@ using IMAP::MessageUIDList;
static const uint32 kMaxFetchEntries = 500; static const uint32 kMaxFetchEntries = 500;
static const uint32 kMaxDirectDownloadSize = 4096; static const uint32 kMaxDirectDownloadSize = 4096;
static const uint32 kMaxUIDsPerFetch = 32;
class WorkerPrivate { class WorkerPrivate {
@@ -237,7 +236,7 @@ private:
class FetchHeadersCommand : public SyncCommand, public IMAP::FetchListener { class FetchHeadersCommand : public SyncCommand, public IMAP::FetchListener {
public: public:
FetchHeadersCommand(IMAPFolder& folder, IMAPMailbox& mailbox, FetchHeadersCommand(IMAPFolder& folder, IMAPMailbox& mailbox,
const MessageUIDList& uids, int32 bodyFetchLimit) MessageUIDList& uids, int32 bodyFetchLimit)
: :
fFolder(folder), fFolder(folder),
fMailbox(mailbox), fMailbox(mailbox),
@@ -403,28 +402,16 @@ public:
if (from == 1) { if (from == 1) {
fFolder->MessageEntriesFetched(); fFolder->MessageEntriesFetched();
IMAP::MessageUIDList uidsForSubFetch; if (fUIDsToFetch.size() > 0) {
// Add pending command to fetch the message headers
WorkerCommand* command = new FetchHeadersCommand(*fFolder,
*fMailbox, fUIDsToFetch,
WorkerPrivate(worker).BodyFetchLimit());
if (!fFetchCommands.AddItem(command))
delete command;
IMAP::MessageUIDList::iterator messageIterator fUIDsToFetch.clear();
= fUIDsToFetch.begin();
while (messageIterator != fUIDsToFetch.end()) {
uidsForSubFetch.push_back(*messageIterator);
messageIterator++;
size_t uidsQueued = uidsForSubFetch.size();
if (uidsQueued >= kMaxUIDsPerFetch
|| (messageIterator == fUIDsToFetch.end()
&& uidsQueued > 0)) {
status_t fetchResult = QueueFetch(worker,
uidsForSubFetch);
if (fetchResult != B_OK) {
printf("IMAP: Error occured queueing UID FETCH\n");
return fetchResult;
}
uidsForSubFetch.clear();
}
} }
fUIDsToFetch.clear();
fState = SELECT; fState = SELECT;
} }
} }
@@ -437,21 +424,6 @@ public:
return fState == DONE; return fState == DONE;
} }
private:
status_t QueueFetch(IMAPConnectionWorker& worker,
const IMAP::MessageUIDList& uids)
{
// Add pending command to fetch the message headers
WorkerCommand* command = new FetchHeadersCommand(*fFolder,
*fMailbox, uids,
WorkerPrivate(worker).BodyFetchLimit());
if (!fFetchCommands.AddItem(command)) {
delete command;
return B_ERROR;
}
return B_OK;
}
private: private:
enum State { enum State {
INIT, INIT,