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
|
||||
begin
|
||||
super
|
||||
rescue EOFError
|
||||
rescue EOFError, Errno::EPIPE
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -171,10 +171,17 @@ end
|
|||
def reconnect(server)
|
||||
retries = 0
|
||||
begin
|
||||
puts "Trying to kill old connection #{Time.now}"
|
||||
timeout(10) do
|
||||
@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
|
||||
end
|
||||
begin
|
||||
puts "Trying to reconnect #{Time.now}"
|
||||
sleep 3
|
||||
#timeout(180) do
|
||||
timeout(60) do
|
||||
|
|
@ -182,7 +189,7 @@ def reconnect(server)
|
|||
end
|
||||
resp = @connections[server]["nntp"].mode_reader
|
||||
rescue SocketError, Errno::EINVAL, EOFError, Errno::ETIMEDOUT, TimeoutError, Errno::ECONNREFUSED
|
||||
print "Reconnect to #{server} failed: #{$!}\n"
|
||||
puts "Reconnect to #{server} failed: #{$!}"
|
||||
if retries > 1
|
||||
del_server(server)
|
||||
raise PermError, "Couldn't connect to #{server}"
|
||||
|
|
@ -384,7 +391,7 @@ def get_group_info(server)
|
|||
rescue TimeoutError
|
||||
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)
|
||||
retry
|
||||
end
|
||||
|
|
@ -399,7 +406,7 @@ def get_xhdr(server, range, header)
|
|||
timeout(180) do
|
||||
begin
|
||||
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)
|
||||
if resp.to_i == 500
|
||||
print "xhdr not implemented\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue