add timeout on reconnect

This commit is contained in:
Ward Wouts 2004-06-02 21:05:08 +00:00
parent ce97d7e532
commit f7ed81c6aa

View file

@ -1,4 +1,4 @@
# $Dwarf: article.rb,v 1.80 2003/11/12 14:01:43 ward Exp $ # $Dwarf: article.rb,v 1.81 2004/05/19 09:55:12 ward Exp $
# $Source$ # $Source$
# #
@ -66,8 +66,10 @@ def reconnect(server)
end end
begin begin
sleep 3 sleep 3
@connections[server]["nntp"] = Net::NNTP.new(server) timeout(180) do
rescue SocketError, Errno::EINVAL, EOFError, Errno::ETIMEDOUT @connections[server]["nntp"] = Net::NNTP.new(server)
end
rescue SocketError, Errno::EINVAL, EOFError, Errno::ETIMEDOUT, TimeoutError
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}"