diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 3a8145e..7fc2366 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -1037,6 +1037,7 @@ module Net break end begin + break_loop = false synchronize do case resp when TaggedResponse @@ -1054,7 +1055,7 @@ module Net if resp.name == "BYE" && @logout_command_tag.nil? @sock.close @exception = ByeResponseError.new(resp) - break + break_loop = true end when ContinuationRequest @continuation_request_arrival.signal @@ -1063,6 +1064,7 @@ module Net handler.call(resp) end end + break if break_loop rescue Exception => e @exception = e synchronize do