From 7fa59faf5b62eb108555fb8185eacbd1df13d44a Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 10 Mar 2016 23:46:50 +0100 Subject: IDLE: fix race condition when an untagged response is received after the DONE --- lib/Net/IMAP/InterIMAP.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3