From 9c0bcb4bad11b2e83345222dea4962223429eb41 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Thu, 24 Jun 2010 03:43:32 +0000 Subject: [PATCH] Add timeouts to the retry category, helps with the nexpose instance is heavily loaded git-svn-id: file:///home/svn/framework3/trunk@9604 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rapid7/nexpose.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/rapid7/nexpose.rb b/lib/rapid7/nexpose.rb index 080c81241c..9f6743a6d7 100644 --- a/lib/rapid7/nexpose.rb +++ b/lib/rapid7/nexpose.rb @@ -140,7 +140,13 @@ class APIRequest @conn_tries += 1 retry end - rescue ::Timeout::Error, ::Errno::EHOSTUNREACH,::Errno::ENETDOWN,::Errno::ENETUNREACH,::Errno::ENETRESET,::Errno::EHOSTDOWN,::Errno::EACCES,::Errno::EINVAL,::Errno::EADDRNOTAVAIL + rescue ::Timeout::Error + if @conn_tries < 5 + @conn_tries += 1 + retry + end + @error = "NeXpose host did not respond" + rescue ::Errno::EHOSTUNREACH,::Errno::ENETDOWN,::Errno::ENETUNREACH,::Errno::ENETRESET,::Errno::EHOSTDOWN,::Errno::EACCES,::Errno::EINVAL,::Errno::EADDRNOTAVAIL @error = "NeXpose host is unreachable" # Handle console-level interrupts rescue ::Interrupt