some robustness changes

This commit is contained in:
Ward Wouts 2004-05-19 09:55:12 +00:00
parent d72ad30661
commit ce97d7e532

View file

@ -1,8 +1,8 @@
# $Dwarf: article.rb,v 1.79 2003/09/23 12:47:54 ward Exp $ # $Dwarf: article.rb,v 1.80 2003/11/12 14:01:43 ward Exp $
# $Source$ # $Source$
# #
# Copyright (c) 2002, 2003 Ward Wouts <ward@wouts.nl> # Copyright (c) 2002, 2003, 2004 Ward Wouts <ward@wouts.nl>
# #
# Permission to use, copy, modify, and distribute this software for any # Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above # purpose with or without fee is hereby granted, provided that the above
@ -67,7 +67,7 @@ def reconnect(server)
begin begin
sleep 3 sleep 3
@connections[server]["nntp"] = Net::NNTP.new(server) @connections[server]["nntp"] = Net::NNTP.new(server)
rescue SocketError, Errno::EINVAL, EOFError rescue SocketError, Errno::EINVAL, EOFError, Errno::ETIMEDOUT
print "Reconnect to #{server} failed: #{$!}\n" print "Reconnect to #{server} failed: #{$!}\n"
del_server(server) del_server(server)
raise PermError, "Couldn't connect to #{server}" raise PermError, "Couldn't connect to #{server}"
@ -222,6 +222,7 @@ def get_xhdr(server, range, header)
begin begin
timeout(180) do timeout(180) do
begin begin
p Time.now if Debuglevel > 1
print "getting headers: #{header}, #{range}\n" if Debuglevel > 1 print "getting headers: #{header}, #{range}\n" if Debuglevel > 1
resp, lines = @connections[server]["nntp"].xhdr(header, range) resp, lines = @connections[server]["nntp"].xhdr(header, range)
if resp.to_i == 500 if resp.to_i == 500
@ -374,7 +375,7 @@ end
def get_group_body_first(subj) def get_group_body_first(subj)
group_subject_sort(subj) group_subject_sort(subj)
i = 0 i = 0
unless @groups[subj]["messages"][0] unless @groups[subj]["messages"] != nil && @groups[subj]["messages"][0]
return false return false
end end
while @gotten.has_key?(@groups[subj]["messages"][0]) == false while @gotten.has_key?(@groups[subj]["messages"][0]) == false