lib/bbiff/bbs_reader.rb in bbiff-0.4.0 vs lib/bbiff/bbs_reader.rb in bbiff-0.4.1
- old
+ new
@@ -364,15 +364,23 @@
end
def posts(range, opts = {})
fail ArgumentError unless range.is_a? Range
url = URI(dat_url)
- lines = @board.send(:download_text,
- if opts[:long_polling] then
- url + "?long_polling=1"
- else
- url
- end)
+ begin
+ lines = @board.send(:download_text,
+ if opts[:long_polling] then
+ url + "?long_polling=1"
+ else
+ url
+ end)
+ rescue Net::ReadTimeout => e
+ if opts[:long_polling]
+ retry
+ else
+ raise e
+ end
+ end
ary = []
lines.each_line.with_index(1) do |line, res_no|
next unless range.include?(res_no)
fields = line.chomp.split('<>', 5)