You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2017/09/06 17:28:00 UTC
qpid-proton git commit: PROTON-1566: [C++ binding] If we get
connection forced close then set this as the transport error
Repository: qpid-proton
Updated Branches:
refs/heads/master 33645b914 -> 790cada68
PROTON-1566: [C++ binding] If we get connection forced close then set this as the transport error
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/790cada6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/790cada6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/790cada6
Branch: refs/heads/master
Commit: 790cada6880c23922ef05f8a69fee039c0fd3796
Parents: 33645b9
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Sep 6 13:22:47 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Sep 6 13:26:31 2017 -0400
----------------------------------------------------------------------
proton-c/bindings/cpp/src/messaging_adapter.cpp | 14 +-------------
.../bindings/cpp/src/proactor_container_impl.cpp | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/790cada6/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index dea96bf..2ba053c 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -47,7 +47,6 @@
#include <proton/transport.h>
#include <assert.h>
-#include <string.h>
namespace proton {
@@ -222,19 +221,8 @@ void on_session_remote_close(messaging_handler& handler, pn_event_t* event) {
void on_connection_remote_close(messaging_handler& handler, pn_event_t* event) {
pn_connection_t *conn = pn_event_connection(event);
- pn_condition_t *cond = pn_connection_remote_condition(conn);
-
- // If we got a close with a condition of amqp:connection:forced then treat this
- // the same as just having the transport closed by the peer without sending any
- // events. This allows reconnection to happen transparently in this case
- if (pn_condition_is_set(cond)
- && !strcmp(pn_condition_get_name(cond),"amqp:connection:forced")) {
- pn_connection_close(conn);
- return;
- }
-
connection c(make_wrapper(conn));
- if (pn_condition_is_set(cond)) {
+ if (pn_condition_is_set(pn_connection_remote_condition(conn))) {
handler.on_connection_error(c);
}
handler.on_connection_close(c);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/790cada6/proton-c/bindings/cpp/src/proactor_container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proactor_container_impl.cpp b/proton-c/bindings/cpp/src/proactor_container_impl.cpp
index b818f65..e3468d2 100644
--- a/proton-c/bindings/cpp/src/proactor_container_impl.cpp
+++ b/proton-c/bindings/cpp/src/proactor_container_impl.cpp
@@ -38,6 +38,7 @@
#include "proton_bits.hpp"
#include <assert.h>
+#include <string.h>
#include <algorithm>
#include <vector>
@@ -547,6 +548,23 @@ bool container::impl::handle(pn_event_t* event) {
reset_reconnect(c);
break;
}
+ case PN_CONNECTION_REMOTE_CLOSE: {
+ pn_connection_t *c = pn_event_connection(event);
+ pn_condition_t *cc = pn_connection_remote_condition(c);
+
+ // If we got a close with a condition of amqp:connection:forced then don't send
+ // any close/error events now. Just set the error condition on the transport and
+ // close the connection - This should act as though a transport error occurred
+ if (pn_condition_is_set(cc)
+ && !strcmp(pn_condition_get_name(cc), "amqp:connection:forced")) {
+ pn_transport_t* t = pn_event_transport(event);
+ pn_condition_t* tc = pn_transport_condition(t);
+ pn_condition_copy(tc, cc);
+ pn_connection_close(c);
+ return false;
+ }
+
+ }
case PN_TRANSPORT_CLOSED: {
// If reconnect is turned on then handle closed on error here with reconnect attempt
pn_connection_t* c = pn_event_connection(event);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org