qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [3/4] qpid-proton git commit: PROTON-1095: Fixup example broker not to exit at the smallest insult!
Date Tue, 26 Jan 2016 20:28:52 GMT
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 <astitcher@apache.org>
Authored: Tue Jan 26 15:09:01 2016 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message