summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-19 05:16:20 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-19 05:16:20 +0000
commit2bd37c71839858341cf2534657a60261e05f275f (patch)
tree713ca63b690755c9afb2129c4bde0823601e3014 /lib
parent5852b97e4eb18560b911848095025404926904da (diff)
* lib/net/imap.rb (idle): raises a Net::IMAP::Error when the
connection is closed. based on the patch by Hugo Barauna. [Bug #5190] [ruby-core:38930] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/imap.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 9095ea399a..eacf0e4cc4 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -905,10 +905,15 @@ module Net
@idle_done_cond = new_cond
@idle_done_cond.wait
@idle_done_cond = nil
+ if @receiver_thread_terminating
+ raise Net::IMAP::Error, "connection closed"
+ end
ensure
- remove_response_handler(response_handler)
- put_string("DONE#{CRLF}")
- response = get_tagged_response(tag, "IDLE")
+ unless @receiver_thread_terminating
+ remove_response_handler(response_handler)
+ put_string("DONE#{CRLF}")
+ response = get_tagged_response(tag, "IDLE")
+ end
end
end
@@ -1056,6 +1061,7 @@ module Net
rescue Exception
end
}
+ @receiver_thread_terminating = false
end
def receive_responses
@@ -1115,8 +1121,12 @@ module Net
end
end
synchronize do
+ @receiver_thread_terminating = true
@tagged_response_arrival.broadcast
@continuation_request_arrival.broadcast
+ if @idle_done_cond
+ @idle_done_cond.signal
+ end
end
end