PROTON-1095: Fixup example broker not to exit at the smallest insult!

Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9d3e9953
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9d3e9953
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9d3e9953

Branch: refs/heads/master
Commit: 9d3e995393a918b80aca5ef60061b27a387d053d
Parents: fa11ada
Author: Andrew Stitcher <[email protected]>
Authored: Tue Jan 26 15:09:01 2016 -0500
Committer: Andrew Stitcher <[email protected]>
Committed: Tue Jan 26 15:09:01 2016 -0500

----------------------------------------------------------------------
 examples/cpp/broker.hpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d3e9953/examples/cpp/broker.hpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp
index c7fd0df..26e42e7 100644
--- a/examples/cpp/broker.hpp
+++ b/examples/cpp/broker.hpp
@@ -31,6 +31,7 @@
 #include "proton/message.hpp"
 #include "proton/handler.hpp"
 #include "proton/sender.hpp"
+#include "proton/transport.hpp"
 #include "proton/url.hpp"
 
 #include <iostream>
@@ -117,7 +118,7 @@ class queues {
         if (address.empty()) {
             throw std::runtime_error("empty queue name");
         }
-        
+
         queue*& q = queues_[address];
 
         if (!q) q = new queue(address);
@@ -175,7 +176,7 @@ class broker_handler : public proton::handler {
 
     void unsubscribe(proton::sender lnk) {
         std::string address = lnk.local_source().address();
-        
+
         if (queues_.get(address).unsubscribe(lnk)) {
             queues_.erase(address);
         }
@@ -197,9 +198,17 @@ class broker_handler : public proton::handler {
         remove_stale_consumers(e.connection());
     }
 
+    void on_transport_error(proton::event &e) {
+        std::cout << "broker client disconnect: " << 
e.transport().condition().str() << std::endl;
+    }
+
+    void on_unhandled_error(proton::event &e, const proton::condition &c) {
+        std::cerr << "broker error: " << e.name() << ":" << c.str() << 
std::endl;
+    }
+
     void remove_stale_consumers(proton::connection connection) {
         proton::link_range r = 
connection.find_links(proton::endpoint::REMOTE_ACTIVE);
-        
+
         for (proton::link_iterator l = r.begin(); l != r.end(); ++l) {
             if (!!l->sender()) {
                 unsubscribe(l->sender());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to