Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 97C34200CFD for ; Wed, 6 Sep 2017 19:28:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 964B91609D1; Wed, 6 Sep 2017 17:28:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DDC2D1609C5 for ; Wed, 6 Sep 2017 19:28:02 +0200 (CEST) Received: (qmail 25195 invoked by uid 500); 6 Sep 2017 17:28:01 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 25186 invoked by uid 99); 6 Sep 2017 17:28:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Sep 2017 17:28:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E103CF552A; Wed, 6 Sep 2017 17:28:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: astitcher@apache.org To: commits@qpid.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: qpid-proton git commit: PROTON-1566: [C++ binding] If we get connection forced close then set this as the transport error Date: Wed, 6 Sep 2017 17:28:00 +0000 (UTC) archived-at: Wed, 06 Sep 2017 17:28:03 -0000 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 Authored: Wed Sep 6 13:22:47 2017 -0400 Committer: Andrew Stitcher 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 #include -#include 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 +#include #include #include @@ -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