You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by cwan <ch...@cloudistics.com> on 2018/07/24 14:27:34 UTC
Re: [qpid-cpp client] Open connection to broker waits forever -
patch attached
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-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: [qpid-cpp client] Open connection to broker waits forever -
patch attached
Posted by cwan <ch...@cloudistics.com>.
Hi Gordon,
You're right. My apologies for messing up the patch.
I have created https://issues.apache.org/jira/browse/QPID-8221, and attached
the correct patch to that issue.
Thanks,
Chen
--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: [qpid-cpp client] Open connection to broker waits forever - patch
attached
Posted by Gordon Sim <gs...@redhat.com>.
On 24/07/18 15:27, cwan wrote:
> 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.
Your patch seems to be reversed. The best thing is to open a JIRA for it
and attach the patch to that. It looks ok to me though.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org