make sure old connection is disconnected before reconnecting
This commit is contained in:
parent
ee6e367410
commit
45c50b1c7c
1 changed files with 7 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# $Dwarf: article.rb,v 1.75 2003/07/20 20:32:01 ward Exp $
|
||||
# $Dwarf: article.rb,v 1.76 2003/08/18 22:14:02 ward Exp $
|
||||
# $Source$
|
||||
|
||||
#
|
||||
|
|
@ -61,6 +61,11 @@ end
|
|||
|
||||
def reconnect(server)
|
||||
begin
|
||||
@connections[server]["nntp"].quit
|
||||
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError
|
||||
end
|
||||
begin
|
||||
sleep 3
|
||||
@connections[server]["nntp"] = Net::NNTP.new(server)
|
||||
rescue SocketError, Errno::EINVAL, EOFError
|
||||
print "Reconnect to #{server} failed: #{$!}\n"
|
||||
|
|
@ -170,7 +175,6 @@ def get_articles(cachedir=false)
|
|||
end
|
||||
end
|
||||
rescue PermError
|
||||
print "Error: #{$!}\n"
|
||||
del_server(server)
|
||||
next
|
||||
end
|
||||
|
|
@ -701,7 +705,7 @@ end
|
|||
def quit
|
||||
for server in @connections.keys
|
||||
begin
|
||||
@connections[server]["nntp"].quit
|
||||
@connections[server]["nntp"].quit
|
||||
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue