diff options
author | Alan Conway <aconway@apache.org> | 2008-10-10 23:32:02 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-10-10 23:32:02 +0000 |
commit | 7a4f554f249787b7de06d1bf6e61d5c587a28f1a (patch) | |
tree | dba1865317e360d24728890310156b69d8fa789d /cpp | |
parent | b590b12a2f48f93d92a71d4fac2f2711189ce4ef (diff) | |
download | qpid-python-7a4f554f249787b7de06d1bf6e61d5c587a28f1a.tar.gz |
src/client/FailoverConnection.cpp: re-register callback after failures
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@703604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/examples/failover/direct_producer.cpp | 3 | ||||
-rw-r--r-- | cpp/src/qpid/client/FailoverConnection.cpp | 10 |
2 files changed, 5 insertions, 8 deletions
diff --git a/cpp/examples/failover/direct_producer.cpp b/cpp/examples/failover/direct_producer.cpp index 4f91c9c4d4..ef2231a7f0 100644 --- a/cpp/examples/failover/direct_producer.cpp +++ b/cpp/examples/failover/direct_producer.cpp @@ -39,6 +39,7 @@ main ( int argc, char ** argv) const char* host = argc>1 ? argv[1] : "127.0.0.1"; int port = argc>2 ? atoi(argv[2]) : 5672; int count = argc>3 ? atoi(argv[3]) : 30; + int delayMs = argc>4 ? atoi(argv[4]) : 1000; try { FailoverConnection connection; @@ -70,7 +71,7 @@ main ( int argc, char ** argv) 0, message ); - sleep ( 1 ); + usleep ( 1000*delayMs ); ++ sent; } message.setData ( "That's all, folks!" ); diff --git a/cpp/src/qpid/client/FailoverConnection.cpp b/cpp/src/qpid/client/FailoverConnection.cpp index c5d775bf82..3e982747ff 100644 --- a/cpp/src/qpid/client/FailoverConnection.cpp +++ b/cpp/src/qpid/client/FailoverConnection.cpp @@ -126,7 +126,7 @@ FailoverConnection::failover ( ) { std::vector<Url> knownBrokers = connection.getKnownBrokers(); if (knownBrokers.empty()) - throw Exception(QPID_MSG("FailoverConnection::failover " << name << " no known brokers.")); + throw Exception(QPID_MSG("FailoverConnection::failover " << name << " no known brokers.")); Connection newConnection; for (std::vector<Url>::iterator i = knownBrokers.begin(); i != knownBrokers.end(); ++i) { @@ -171,12 +171,8 @@ FailoverConnection::failover ( ) } connection = newConnection; - - // FIXME aconway 2008-10-09: use sys/Time.h functions. - if ( failoverCompleteTime ) - { - gettimeofday ( failoverCompleteTime, 0 ); - } + connection.registerFailureCallback + ( boost::bind(&FailoverConnection::failover, this)); } |