method
receive_responses
receive_responses()
private
Hide source
# File lib/net/imap.rb, line 931 def receive_responses while true synchronize do @exception = nil end begin resp = get_response rescue Exception => e synchronize do @sock.close unless @sock.closed? @exception = e end break end unless resp synchronize do @exception = EOFError.new("end of file reached") end break end begin synchronize do case resp when TaggedResponse @tagged_responses[resp.tag] = resp @response_arrival.broadcast if resp.tag == @logout_command_tag return end when UntaggedResponse record_response(resp.name, resp.data) if resp.data.instance_of?(ResponseText) && (code = resp.data.code) record_response(code.name, code.data) end if resp.name == "BYE" && @logout_command_tag.nil? @sock.close @exception = ByeResponseError.new(resp.raw_data) @response_arrival.broadcast return end when ContinuationRequest @continuation_request = resp @response_arrival.broadcast end @response_handlers.each do |handler| handler.call(resp) end end rescue Exception => e @exception = e synchronize do @response_arrival.broadcast end end end synchronize do @response_arrival.broadcast end end