aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-10 23:46:50 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-10 23:47:54 +0100
commit7fa59faf5b62eb108555fb8185eacbd1df13d44a (patch)
tree757c5d9b30ac5edbbe62b46495a964fd3ebdd770
parent2432afb0df49d86ee4d3dff8d19a2d3094ecec28 (diff)
IDLE: fix race condition when an untagged response is received after the DONE
-rw-r--r--lib/Net/IMAP/InterIMAP.pm4
1 files changed, 3 insertions, 1 deletions
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;
}