mscdex/node-imap — pull request #108 by antifuchs (2012-09-22 05:11:53+00:00)
Title: Fix IDLE for very fast connections

When issuing commands in rapid succession, it was possible for node-imap to send multiple "DONE" commands. This resulted in wedged state when the server dropped out of IDLE and then didn't know what to do with the second DONE command.

This change adds a safeguard that ensures _send never sends more than one DONE, and queues (non-DONE/IDLE) commands up for when the server was able to acknowledge.

As real-world testing goes, with this change, I've been able to download over 180k messages from my gmail account and fed them into a dovecot server running locally. (-: