Commit 763a31c0 authored by Steven Murray's avatar Steven Murray
Browse files

connectWithTimeout() now handles POLLNVAL

parent 9705f748
...@@ -951,7 +951,7 @@ int castor::io::connectWithTimeout( ...@@ -951,7 +951,7 @@ int castor::io::connectWithTimeout(
const int pollRc = poll(&pollFd, 1, 1000 * timeout); const int pollRc = poll(&pollFd, 1, 1000 * timeout);
if(-1 == pollRc) { if(-1 == pollRc) {
castor::exception::Exception ex; castor::exception::Exception ex;
ex.getMessage() << "Call to poll()() failed: " ex.getMessage() << "Call to poll() failed: "
<< cta::utils::errnoToString(errno); << cta::utils::errnoToString(errno);
throw ex; throw ex;
} }
...@@ -965,6 +965,13 @@ int castor::io::connectWithTimeout( ...@@ -965,6 +965,13 @@ int castor::io::connectWithTimeout(
throw ex; throw ex;
} }
if(pollFd.revents | POLLNVAL) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to connect"
": File descriptor " << pollFd.fd << " is not open";
throw ex;
}
// Use getsockopt() to check whether or not the connection completed // Use getsockopt() to check whether or not the connection completed
// successfully // successfully
// //
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment