qpid_client_connect_timeout.patch <http://qpid.2158936.n2.nabble.com/file/t396381/qpid_client_connect_timeout.patch>
Attached is a patch to add connect timeout to qpid-cpp client's open connection call. A new option called "connect-timeout" can be used to specify how long to wait (in seconds) for the connection::open call. When the "connect-timeout" is set, qpid-cpp client calls waitFor with a timeout. I have tested it in my environment, and it seems to be able to time out properly when the open call gets stucked. The main part of patch is this: diff --git a/src/qpid/client/ConnectionHandler.cpp b/src/qpid/client/ConnectionHandler.cpp index 4f044c2f3..77d43f191 100644 --- a/src/qpid/client/ConnectionHandler.cpp +++ b/src/qpid/client/ConnectionHandler.cpp @@ -148,16 +148,7 @@ void ConnectionHandler::outgoing(AMQFrame& frame) void ConnectionHandler::waitForOpen() { - if (ConnectionSettings::connectTimeout) { - if (!waitFor(ESTABLISHED, qpid::sys::Duration(ConnectionSettings::connectTimeout * qpid::sys::TIME_SEC))) { - errorText = "Connection open timed out"; - QPID_LOG(warning, errorText); - setState(FAILED); - } - } else { - waitFor(ESTABLISHED);//ESTABLISHED = OPEN, CLOSED or FAILED - } - -- Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org