diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-06-22 12:44:35 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-06-22 12:44:35 -0700 |
commit | df321f5c64e584ea16bcd440ba8e56dde359d1e7 (patch) | |
tree | d74bf20532cf42e1415738401595bdd448fd9dd8 | |
parent | 610a7f3880dbf2b012b81781cc191cab90b1ba81 (diff) | |
download | omgf-df321f5c64e584ea16bcd440ba8e56dde359d1e7.tar.gz |
verify_paths: do not poll() on empty set
Sometimes, no sockets get created at all (due to errors like EMFILE, ENFILE, ENETUNREACH, ENETDOWN)
-rw-r--r-- | lib/omgf/verify_paths.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/omgf/verify_paths.rb b/lib/omgf/verify_paths.rb index 6d09047..cec7f5d 100644 --- a/lib/omgf/verify_paths.rb +++ b/lib/omgf/verify_paths.rb @@ -169,7 +169,7 @@ class OMGF::VerifyPaths sock = sock_get(uri) and iter_check(ok, sock, pollset) end - while ok.size < count && tout > 0 + while ok.size < count && tout > 0 && ! pollset.empty? t0 = Time.now ready = Kgio.poll(pollset.dup, tout) or break tout -= ((Time.now - t0) * 1000).to_i @@ -227,6 +227,7 @@ class OMGF::VerifyPaths sock.http_init(uri) sock rescue + # we'll return nil on any errors end # returns an idle socket to the pool |