You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/03/01 14:59:31 UTC

qpid-proton git commit: Revert "PROTON-1420: Cpp example direct_send receives instead. Fix it to send."

Repository: qpid-proton
Updated Branches:
  refs/heads/master b173c3a81 -> 49ec466a1


Revert "PROTON-1420: Cpp example direct_send receives instead. Fix it to send."

This reverts commit 13e40e9e6a158cdc3777f207387461483881e2c8.

The example was correct before this change, this change broke the self tests.

direct_send is a *server* not a client. It listens for an incoming connection
and sender and then sends. It does not *initiate* the connection or sender, it
send once the remote peer does.


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

Branch: refs/heads/master
Commit: 49ec466a15f41117081384fe2a7532b7bc458ce9
Parents: b173c3a
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Mar 1 09:57:56 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Mar 1 09:57:56 2017 -0500

----------------------------------------------------------------------
 examples/cpp/direct_send.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/49ec466a/examples/cpp/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_send.cpp b/examples/cpp/direct_send.cpp
index e6b4464..7de762d 100644
--- a/examples/cpp/direct_send.cpp
+++ b/examples/cpp/direct_send.cpp
@@ -22,14 +22,13 @@
 #include "options.hpp"
 
 #include <proton/connection.hpp>
-#include <proton/connection_options.hpp>
 #include <proton/container.hpp>
 #include <proton/default_container.hpp>
+#include <proton/listener.hpp>
 #include <proton/message.hpp>
 #include <proton/message_id.hpp>
 #include <proton/messaging_handler.hpp>
 #include <proton/value.hpp>
-#include <proton/thread_safe.hpp>
 #include <proton/tracker.hpp>
 #include <proton/types.hpp>
 
@@ -41,7 +40,7 @@
 class simple_send : public proton::messaging_handler {
   private:
     std::string url;
-    proton::sender sender;
+    proton::listener listener;
     int sent;
     int confirmed;
     int total;
@@ -50,8 +49,8 @@ class simple_send : public proton::messaging_handler {
     simple_send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
 
     void on_container_start(proton::container &c) OVERRIDE {
-        proton::connection_options co;
-        sender = c.open_sender(url, co);
+        listener = c.listen(url);
+        std::cout << "direct_send listening on " << url << std::endl;
     }
 
     void on_sendable(proton::sender &sender) OVERRIDE {
@@ -74,6 +73,7 @@ class simple_send : public proton::messaging_handler {
         if (confirmed == total) {
             std::cout << "all messages confirmed" << std::endl;
             t.connection().close();
+            listener.stop();
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org