From: Guilhem Moulin Date: Thu, 10 Mar 2016 22:46:50 +0000 (+0100) Subject: IDLE: fix race condition when an untagged response is received after the DONE X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=7fa59faf5b62eb108555fb8185eacbd1df13d44a;p=interimap.git IDLE: fix race condition when an untagged response is received after the DONE --- diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm index 33ad4ee..45253c1 100644 --- a/lib/Net/IMAP/InterIMAP.pm +++ b/lib/Net/IMAP/InterIMAP.pm @@ -992,7 +992,9 @@ sub idle($;$&) { # done idling $self->_cmd_extend('DONE'); $self->_cmd_flush(); - $self->_recv($tag); + # run the callback again to update the return value if we received + # untagged responses between the DONE and the tagged response + $self->_recv($tag, $callback, 'IDLE'); return $timeout < 0 ? 1 : 0; }