small improvements
This commit is contained in:
parent
102205e9eb
commit
b0d94b8067
1 changed files with 12 additions and 5 deletions
|
|
@ -84,7 +84,7 @@ def quit
|
||||||
@thr.exit
|
@thr.exit
|
||||||
begin
|
begin
|
||||||
super
|
super
|
||||||
rescue EOFError
|
rescue EOFError, Errno::EPIPE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -171,10 +171,17 @@ end
|
||||||
def reconnect(server)
|
def reconnect(server)
|
||||||
retries = 0
|
retries = 0
|
||||||
begin
|
begin
|
||||||
|
puts "Trying to kill old connection #{Time.now}"
|
||||||
|
timeout(10) do
|
||||||
@connections[server]["nntp"].quit
|
@connections[server]["nntp"].quit
|
||||||
|
end
|
||||||
|
puts "Killed old connection #{Time.now}"
|
||||||
|
rescue TimeoutError
|
||||||
|
puts "Timeout killing old connection"
|
||||||
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError, Errno::ETIMEDOUT
|
rescue Errno::EPIPE, Errno::ECONNRESET, EOFError, Errno::ETIMEDOUT
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
|
puts "Trying to reconnect #{Time.now}"
|
||||||
sleep 3
|
sleep 3
|
||||||
#timeout(180) do
|
#timeout(180) do
|
||||||
timeout(60) do
|
timeout(60) do
|
||||||
|
|
@ -182,7 +189,7 @@ def reconnect(server)
|
||||||
end
|
end
|
||||||
resp = @connections[server]["nntp"].mode_reader
|
resp = @connections[server]["nntp"].mode_reader
|
||||||
rescue SocketError, Errno::EINVAL, EOFError, Errno::ETIMEDOUT, TimeoutError, Errno::ECONNREFUSED
|
rescue SocketError, Errno::EINVAL, EOFError, Errno::ETIMEDOUT, TimeoutError, Errno::ECONNREFUSED
|
||||||
print "Reconnect to #{server} failed: #{$!}\n"
|
puts "Reconnect to #{server} failed: #{$!}"
|
||||||
if retries > 1
|
if retries > 1
|
||||||
del_server(server)
|
del_server(server)
|
||||||
raise PermError, "Couldn't connect to #{server}"
|
raise PermError, "Couldn't connect to #{server}"
|
||||||
|
|
@ -384,7 +391,7 @@ def get_group_info(server)
|
||||||
rescue TimeoutError
|
rescue TimeoutError
|
||||||
timedout += 1
|
timedout += 1
|
||||||
raise PermError, "Too many timeouts! (get_group_info)" if timedout > 1
|
raise PermError, "Too many timeouts! (get_group_info)" if timedout > 1
|
||||||
print "Time out, reconnecting to server... (get_group_info)\n"
|
puts "Time out, reconnecting to server... (get_group_info)"
|
||||||
reconnect(server)
|
reconnect(server)
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
|
|
@ -399,7 +406,7 @@ def get_xhdr(server, range, header)
|
||||||
timeout(180) do
|
timeout(180) do
|
||||||
begin
|
begin
|
||||||
p Time.now if Debuglevel > 1
|
p Time.now if Debuglevel > 1
|
||||||
print "getting headers: #{header}, #{range}\n" if Debuglevel > 1
|
puts "getting headers: #{header}, #{range}" 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
|
||||||
print "xhdr not implemented\n"
|
print "xhdr not implemented\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue