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$
|
# $Source$
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -61,6 +61,11 @@ end
|
||||||
|
|
||||||
def reconnect(server)
|
def reconnect(server)
|
||||||
begin
|
begin
|
||||||
|
@connections[server]["nntp"].quit
|
||||||
|
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
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
|
||||||
print "Reconnect to #{server} failed: #{$!}\n"
|
print "Reconnect to #{server} failed: #{$!}\n"
|
||||||
|
|
@ -170,7 +175,6 @@ def get_articles(cachedir=false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue PermError
|
rescue PermError
|
||||||
print "Error: #{$!}\n"
|
|
||||||
del_server(server)
|
del_server(server)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
@ -701,7 +705,7 @@ end
|
||||||
def quit
|
def quit
|
||||||
for server in @connections.keys
|
for server in @connections.keys
|
||||||
begin
|
begin
|
||||||
@connections[server]["nntp"].quit
|
@connections[server]["nntp"].quit
|
||||||
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError
|
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue